Repository: fynv/ScoreDraft Branch: master Commit: 8cc9519f60ed Files: 912 Total size: 37.3 MB Directory structure: gitextract_fqqiew6r/ ├── BasicSamplers/ │ ├── CMakeLists.txt │ ├── FrequencyDetection.cpp │ ├── FrequencyDetection.h │ ├── InstrumentMultiSampler.cpp │ ├── InstrumentMultiSampler.h │ ├── InstrumentSingleSampler.cpp │ ├── InstrumentSingleSampler.h │ ├── PercussionSampler.cpp │ ├── PercussionSampler.h │ ├── Sample.h │ └── api.cpp ├── CMakeLists.txt ├── DSPUtil/ │ ├── complex.cpp │ ├── complex.h │ ├── fft.cpp │ └── fft.h ├── KarplusStrong/ │ ├── CMakeLists.txt │ └── KarplusStrong.cpp ├── LICENSE ├── MIDIWriter/ │ ├── CMakeLists.txt │ └── MIDIWriter.cpp ├── Meteor/ │ ├── CMakeLists.txt │ ├── DrawText.cpp │ ├── DrawText.h │ ├── Meteor.cpp │ ├── Meteor.h │ ├── MeteorPlayer.cpp │ ├── MeteorPlayer.h │ ├── SubListLookUp.h │ ├── api.cpp │ ├── base64.hpp │ └── blob.hpp ├── PCMPlayer/ │ ├── CMakeLists.txt │ ├── PCMPlayer.cpp │ ├── PCMPlayer.h │ └── api.cpp ├── README.md ├── README_cn.md ├── ScoreDraftCore/ │ ├── CMakeLists.txt │ ├── ReadWav.cpp │ ├── ReadWav.h │ ├── TrackBuffer.cpp │ ├── TrackBuffer.h │ ├── WavBuffer.h │ ├── WriteWav.cpp │ ├── WriteWav.h │ ├── api.cpp │ ├── api.h │ └── utils.h ├── SimpleInstruments/ │ ├── CMakeLists.txt │ └── SimpleInstruments.cpp ├── SoundFont2/ │ ├── CMakeLists.txt │ ├── Presets.cpp │ ├── Presets.h │ ├── SF2.cpp │ ├── SF2.h │ ├── SF2Synth.cpp │ ├── SF2Synth.h │ ├── Synth.cpp │ ├── Synth.h │ └── api.cpp ├── Test/ │ ├── FlyMeToTheMoon.py │ ├── FlyMeToTheMoon_eq.py │ ├── Hello.py │ ├── HelloMeteor.py │ ├── InstrumentSamples/ │ │ ├── Ah.freq │ │ ├── Cello.freq │ │ ├── CleanGuitar.freq │ │ ├── Lah.freq │ │ ├── Piano/ │ │ │ ├── Alesis-Fusion-Bright-Acoustic-Piano-C2.freq │ │ │ ├── Alesis-Fusion-Bright-Acoustic-Piano-C4.freq │ │ │ └── Alesis-Fusion-Bright-Acoustic-Piano-C6.freq │ │ ├── String.freq │ │ └── Violin.freq │ ├── PrintCatalog.py │ ├── ZhenDeAiNi.ly │ ├── ZhenDeAiNi.xml │ ├── ZhenDeAiNi.yaml │ ├── florestan-subset.sf2 │ ├── percussion_test.py │ ├── piano_test.py │ ├── sunshine.yaml │ ├── test.yaml │ ├── test_xml.py │ └── test_yaml.py ├── VoiceSampler/ │ ├── CMakeLists.txt │ ├── DVVector.hpp │ ├── FrequencyDetection.cpp │ ├── FrequencyDetection.h │ ├── HNM.cu │ ├── SentenceDescriptor.h │ ├── SentenceGeneratorCPU.cpp │ ├── SentenceGeneratorCPU.h │ ├── SentenceGeneratorCUDA.cpp │ ├── SentenceGeneratorCUDA.h │ ├── SentenceGeneratorGeneral.cpp │ ├── SentenceGeneratorGeneral.h │ ├── VoiceUtil.cuh │ ├── VoiceUtil.h │ ├── api.cpp │ ├── fft.cuh │ └── helper_math.h ├── docs/ │ ├── README.md │ ├── _config.yml │ ├── intro_cn.html_files/ │ │ └── github-markdown.css │ ├── intro_cn.md │ ├── intro_eng.md │ └── meteor/ │ ├── MyLove.html_files/ │ │ └── github-markdown.css │ ├── MyLove.md │ ├── MyLove.meteor │ ├── SoreFeetSong.md │ ├── SoreFeetSong.meteor │ ├── TaLang.md │ ├── TaLang.meteor │ ├── WuYa.md │ ├── WuYa.meteor │ ├── meteor.js │ ├── ouchi.md │ ├── ouchi.meteor │ ├── tiktok.md │ └── tiktok.meteor ├── python/ │ ├── CMakeLists.txt │ ├── README.md │ ├── ScoreDraft/ │ │ ├── BasicSamplers.py │ │ ├── CVVCChineseConverter.py │ │ ├── Catalog.py │ │ ├── Document.py │ │ ├── Initializers.py │ │ ├── Instrument.py │ │ ├── JPVCVConverter.py │ │ ├── KarplusStrong.py │ │ ├── MIDIWriter.py │ │ ├── Meteor.py │ │ ├── MusicXMLDocument.py │ │ ├── Notes.py │ │ ├── PCMPlayer.py │ │ ├── Percussion.py │ │ ├── RapChinese.py │ │ ├── ScoreDraftCore.py │ │ ├── SimpleInstruments.py │ │ ├── Singer.py │ │ ├── SoundFont2.py │ │ ├── TTEnglishConverter.py │ │ ├── TTLyricSet.data │ │ ├── TsuroVCVConverter.py │ │ ├── UTAUUtils.py │ │ ├── UtauDraft.py │ │ ├── VCCVEnglishConverter.py │ │ ├── VCCVLyricSet.data │ │ ├── VoiceSampler.py │ │ ├── XiaYYConverter.py │ │ ├── YAMLDocument.py │ │ ├── __init__.py │ │ └── musicxml/ │ │ ├── __init__.py │ │ ├── musicxml.py │ │ ├── xlink.py │ │ └── xml.py │ └── setup.py └── thirdparty/ ├── fonts/ │ ├── NotoSansSC-Bold.hpp │ └── NotoSansSC-Bold.otf ├── freetype/ │ ├── include/ │ │ └── freetype2/ │ │ ├── freetype/ │ │ │ ├── config/ │ │ │ │ ├── ftconfig.h │ │ │ │ ├── ftheader.h │ │ │ │ ├── ftmodule.h │ │ │ │ ├── ftoption.h │ │ │ │ ├── ftstdlib.h │ │ │ │ ├── integer-types.h │ │ │ │ ├── mac-support.h │ │ │ │ └── public-macros.h │ │ │ ├── freetype.h │ │ │ ├── ftadvanc.h │ │ │ ├── ftbbox.h │ │ │ ├── ftbdf.h │ │ │ ├── ftbitmap.h │ │ │ ├── ftbzip2.h │ │ │ ├── ftcache.h │ │ │ ├── ftchapters.h │ │ │ ├── ftcid.h │ │ │ ├── ftcolor.h │ │ │ ├── ftdriver.h │ │ │ ├── fterrdef.h │ │ │ ├── fterrors.h │ │ │ ├── ftfntfmt.h │ │ │ ├── ftgasp.h │ │ │ ├── ftglyph.h │ │ │ ├── ftgxval.h │ │ │ ├── ftgzip.h │ │ │ ├── ftimage.h │ │ │ ├── ftincrem.h │ │ │ ├── ftlcdfil.h │ │ │ ├── ftlist.h │ │ │ ├── ftlogging.h │ │ │ ├── ftlzw.h │ │ │ ├── ftmac.h │ │ │ ├── ftmm.h │ │ │ ├── ftmodapi.h │ │ │ ├── ftmoderr.h │ │ │ ├── ftotval.h │ │ │ ├── ftoutln.h │ │ │ ├── ftparams.h │ │ │ ├── ftpfr.h │ │ │ ├── ftrender.h │ │ │ ├── ftsizes.h │ │ │ ├── ftsnames.h │ │ │ ├── ftstroke.h │ │ │ ├── ftsynth.h │ │ │ ├── ftsystem.h │ │ │ ├── fttrigon.h │ │ │ ├── fttypes.h │ │ │ ├── ftwinfnt.h │ │ │ ├── t1tables.h │ │ │ ├── ttnameid.h │ │ │ ├── tttables.h │ │ │ └── tttags.h │ │ └── ft2build.h │ └── lib/ │ └── freetype.lib ├── glfw/ │ ├── CMake/ │ │ ├── GenerateMappings.cmake │ │ ├── MacOSXBundleInfo.plist.in │ │ ├── i686-w64-mingw32-clang.cmake │ │ ├── i686-w64-mingw32.cmake │ │ ├── modules/ │ │ │ ├── FindEpollShim.cmake │ │ │ ├── FindOSMesa.cmake │ │ │ ├── FindWaylandProtocols.cmake │ │ │ └── FindXKBCommon.cmake │ │ ├── x86_64-w64-mingw32-clang.cmake │ │ └── x86_64-w64-mingw32.cmake │ ├── CMakeLists.txt │ ├── LICENSE.md │ ├── README.md │ ├── cmake_uninstall.cmake.in │ ├── deps/ │ │ ├── getopt.c │ │ ├── getopt.h │ │ ├── glad/ │ │ │ ├── gl.h │ │ │ ├── khrplatform.h │ │ │ ├── vk_platform.h │ │ │ └── vulkan.h │ │ ├── glad_gl.c │ │ ├── glad_vulkan.c │ │ ├── linmath.h │ │ ├── mingw/ │ │ │ ├── _mingw_dxhelper.h │ │ │ ├── dinput.h │ │ │ └── xinput.h │ │ ├── nuklear.h │ │ ├── nuklear_glfw_gl2.h │ │ ├── stb_image_write.h │ │ ├── tinycthread.c │ │ ├── tinycthread.h │ │ └── vs2008/ │ │ └── stdint.h │ ├── docs/ │ │ ├── CMakeLists.txt │ │ ├── CODEOWNERS │ │ ├── CONTRIBUTING.md │ │ ├── Doxyfile.in │ │ ├── DoxygenLayout.xml │ │ ├── SUPPORT.md │ │ ├── build.dox │ │ ├── compat.dox │ │ ├── compile.dox │ │ ├── context.dox │ │ ├── extra.css │ │ ├── extra.less │ │ ├── footer.html │ │ ├── header.html │ │ ├── html/ │ │ │ ├── bug.html │ │ │ ├── build_8dox.html │ │ │ ├── build_guide.html │ │ │ ├── compat_8dox.html │ │ │ ├── compat_guide.html │ │ │ ├── compile_8dox.html │ │ │ ├── compile_guide.html │ │ │ ├── context_8dox.html │ │ │ ├── context_guide.html │ │ │ ├── deprecated.html │ │ │ ├── dir_15a5176d7c9cc5c407ed4f611edf0684.html │ │ │ ├── dir_a58ef735c5cc5a9a31d321e1abe7c42e.html │ │ │ ├── dir_abae1f34c5d965773b98e3c915cdaeb5.html │ │ │ ├── dir_bc6505cac00d7a6291dbfd9af70666b7.html │ │ │ ├── doxygen.css │ │ │ ├── dynsections.js │ │ │ ├── extra.css │ │ │ ├── files.html │ │ │ ├── glfw3_8h.html │ │ │ ├── glfw3_8h_source.html │ │ │ ├── glfw3native_8h.html │ │ │ ├── glfw3native_8h_source.html │ │ │ ├── group__buttons.html │ │ │ ├── group__context.html │ │ │ ├── group__errors.html │ │ │ ├── group__gamepad__axes.html │ │ │ ├── group__gamepad__buttons.html │ │ │ ├── group__hat__state.html │ │ │ ├── group__init.html │ │ │ ├── group__input.html │ │ │ ├── group__joysticks.html │ │ │ ├── group__keys.html │ │ │ ├── group__mods.html │ │ │ ├── group__monitor.html │ │ │ ├── group__native.html │ │ │ ├── group__shapes.html │ │ │ ├── group__vulkan.html │ │ │ ├── group__window.html │ │ │ ├── index.html │ │ │ ├── input_8dox.html │ │ │ ├── input_guide.html │ │ │ ├── internal_8dox.html │ │ │ ├── internals_guide.html │ │ │ ├── intro_8dox.html │ │ │ ├── intro_guide.html │ │ │ ├── jquery.js │ │ │ ├── main_8dox.html │ │ │ ├── menu.js │ │ │ ├── menudata.js │ │ │ ├── modules.html │ │ │ ├── monitor_8dox.html │ │ │ ├── monitor_guide.html │ │ │ ├── moving_8dox.html │ │ │ ├── moving_guide.html │ │ │ ├── news.html │ │ │ ├── news_8dox.html │ │ │ ├── pages.html │ │ │ ├── quick_8dox.html │ │ │ ├── quick_guide.html │ │ │ ├── search/ │ │ │ │ ├── all_0.html │ │ │ │ ├── all_0.js │ │ │ │ ├── all_1.html │ │ │ │ ├── all_1.js │ │ │ │ ├── all_10.html │ │ │ │ ├── all_10.js │ │ │ │ ├── all_11.html │ │ │ │ ├── all_11.js │ │ │ │ ├── all_2.html │ │ │ │ ├── all_2.js │ │ │ │ ├── all_3.html │ │ │ │ ├── all_3.js │ │ │ │ ├── all_4.html │ │ │ │ ├── all_4.js │ │ │ │ ├── all_5.html │ │ │ │ ├── all_5.js │ │ │ │ ├── all_6.html │ │ │ │ ├── all_6.js │ │ │ │ ├── all_7.html │ │ │ │ ├── all_7.js │ │ │ │ ├── all_8.html │ │ │ │ ├── all_8.js │ │ │ │ ├── all_9.html │ │ │ │ ├── all_9.js │ │ │ │ ├── all_a.html │ │ │ │ ├── all_a.js │ │ │ │ ├── all_b.html │ │ │ │ ├── all_b.js │ │ │ │ ├── all_c.html │ │ │ │ ├── all_c.js │ │ │ │ ├── all_d.html │ │ │ │ ├── all_d.js │ │ │ │ ├── all_e.html │ │ │ │ ├── all_e.js │ │ │ │ ├── all_f.html │ │ │ │ ├── all_f.js │ │ │ │ ├── classes_0.html │ │ │ │ ├── classes_0.js │ │ │ │ ├── defines_0.html │ │ │ │ ├── defines_0.js │ │ │ │ ├── files_0.html │ │ │ │ ├── files_0.js │ │ │ │ ├── files_1.html │ │ │ │ ├── files_1.js │ │ │ │ ├── files_2.html │ │ │ │ ├── files_2.js │ │ │ │ ├── files_3.html │ │ │ │ ├── files_3.js │ │ │ │ ├── files_4.html │ │ │ │ ├── files_4.js │ │ │ │ ├── files_5.html │ │ │ │ ├── files_5.js │ │ │ │ ├── files_6.html │ │ │ │ ├── files_6.js │ │ │ │ ├── files_7.html │ │ │ │ ├── files_7.js │ │ │ │ ├── files_8.html │ │ │ │ ├── files_8.js │ │ │ │ ├── functions_0.html │ │ │ │ ├── functions_0.js │ │ │ │ ├── groups_0.html │ │ │ │ ├── groups_0.js │ │ │ │ ├── groups_1.html │ │ │ │ ├── groups_1.js │ │ │ │ ├── groups_2.html │ │ │ │ ├── groups_2.js │ │ │ │ ├── groups_3.html │ │ │ │ ├── groups_3.js │ │ │ │ ├── groups_4.html │ │ │ │ ├── groups_4.js │ │ │ │ ├── groups_5.html │ │ │ │ ├── groups_5.js │ │ │ │ ├── groups_6.html │ │ │ │ ├── groups_6.js │ │ │ │ ├── groups_7.html │ │ │ │ ├── groups_7.js │ │ │ │ ├── groups_8.html │ │ │ │ ├── groups_8.js │ │ │ │ ├── groups_9.html │ │ │ │ ├── groups_9.js │ │ │ │ ├── groups_a.html │ │ │ │ ├── groups_a.js │ │ │ │ ├── nomatches.html │ │ │ │ ├── pages_0.html │ │ │ │ ├── pages_0.js │ │ │ │ ├── pages_1.html │ │ │ │ ├── pages_1.js │ │ │ │ ├── pages_2.html │ │ │ │ ├── pages_2.js │ │ │ │ ├── pages_3.html │ │ │ │ ├── pages_3.js │ │ │ │ ├── pages_4.html │ │ │ │ ├── pages_4.js │ │ │ │ ├── pages_5.html │ │ │ │ ├── pages_5.js │ │ │ │ ├── pages_6.html │ │ │ │ ├── pages_6.js │ │ │ │ ├── pages_7.html │ │ │ │ ├── pages_7.js │ │ │ │ ├── pages_8.html │ │ │ │ ├── pages_8.js │ │ │ │ ├── pages_9.html │ │ │ │ ├── pages_9.js │ │ │ │ ├── pages_a.html │ │ │ │ ├── pages_a.js │ │ │ │ ├── search.css │ │ │ │ ├── search.js │ │ │ │ ├── searchdata.js │ │ │ │ ├── typedefs_0.html │ │ │ │ ├── typedefs_0.js │ │ │ │ ├── variables_0.html │ │ │ │ ├── variables_0.js │ │ │ │ ├── variables_1.html │ │ │ │ ├── variables_1.js │ │ │ │ ├── variables_2.html │ │ │ │ ├── variables_2.js │ │ │ │ ├── variables_3.html │ │ │ │ ├── variables_3.js │ │ │ │ ├── variables_4.html │ │ │ │ ├── variables_4.js │ │ │ │ ├── variables_5.html │ │ │ │ ├── variables_5.js │ │ │ │ ├── variables_6.html │ │ │ │ ├── variables_6.js │ │ │ │ ├── variables_7.html │ │ │ │ └── variables_7.js │ │ │ ├── structGLFWgamepadstate.html │ │ │ ├── structGLFWgammaramp.html │ │ │ ├── structGLFWimage.html │ │ │ ├── structGLFWvidmode.html │ │ │ ├── tabs.css │ │ │ ├── vulkan_8dox.html │ │ │ ├── vulkan_guide.html │ │ │ ├── window_8dox.html │ │ │ └── window_guide.html │ │ ├── input.dox │ │ ├── internal.dox │ │ ├── intro.dox │ │ ├── main.dox │ │ ├── monitor.dox │ │ ├── moving.dox │ │ ├── news.dox │ │ ├── quick.dox │ │ ├── vulkan.dox │ │ └── window.dox │ ├── examples/ │ │ ├── CMakeLists.txt │ │ ├── boing.c │ │ ├── gears.c │ │ ├── glfw.icns │ │ ├── glfw.rc │ │ ├── heightmap.c │ │ ├── offscreen.c │ │ ├── particles.c │ │ ├── sharing.c │ │ ├── simple.c │ │ ├── splitview.c │ │ └── wave.c │ ├── include/ │ │ └── GLFW/ │ │ ├── glfw3.h │ │ └── glfw3native.h │ ├── src/ │ │ ├── CMakeLists.txt │ │ ├── cocoa_init.m │ │ ├── cocoa_joystick.h │ │ ├── cocoa_joystick.m │ │ ├── cocoa_monitor.m │ │ ├── cocoa_platform.h │ │ ├── cocoa_time.c │ │ ├── cocoa_window.m │ │ ├── context.c │ │ ├── egl_context.c │ │ ├── egl_context.h │ │ ├── glfw3.pc.in │ │ ├── glfw3Config.cmake.in │ │ ├── glfw_config.h.in │ │ ├── glx_context.c │ │ ├── glx_context.h │ │ ├── init.c │ │ ├── input.c │ │ ├── internal.h │ │ ├── linux_joystick.c │ │ ├── linux_joystick.h │ │ ├── mappings.h │ │ ├── mappings.h.in │ │ ├── monitor.c │ │ ├── nsgl_context.h │ │ ├── nsgl_context.m │ │ ├── null_init.c │ │ ├── null_joystick.c │ │ ├── null_joystick.h │ │ ├── null_monitor.c │ │ ├── null_platform.h │ │ ├── null_window.c │ │ ├── osmesa_context.c │ │ ├── osmesa_context.h │ │ ├── posix_thread.c │ │ ├── posix_thread.h │ │ ├── posix_time.c │ │ ├── posix_time.h │ │ ├── vulkan.c │ │ ├── wgl_context.c │ │ ├── wgl_context.h │ │ ├── win32_init.c │ │ ├── win32_joystick.c │ │ ├── win32_joystick.h │ │ ├── win32_monitor.c │ │ ├── win32_platform.h │ │ ├── win32_thread.c │ │ ├── win32_time.c │ │ ├── win32_window.c │ │ ├── window.c │ │ ├── wl_init.c │ │ ├── wl_monitor.c │ │ ├── wl_platform.h │ │ ├── wl_window.c │ │ ├── x11_init.c │ │ ├── x11_monitor.c │ │ ├── x11_platform.h │ │ ├── x11_window.c │ │ ├── xkb_unicode.c │ │ └── xkb_unicode.h │ └── tests/ │ ├── CMakeLists.txt │ ├── clipboard.c │ ├── cursor.c │ ├── empty.c │ ├── events.c │ ├── gamma.c │ ├── glfwinfo.c │ ├── icon.c │ ├── iconify.c │ ├── inputlag.c │ ├── joysticks.c │ ├── monitors.c │ ├── msaa.c │ ├── opacity.c │ ├── reopen.c │ ├── tearing.c │ ├── threads.c │ ├── timeout.c │ ├── title.c │ ├── triangle-vulkan.c │ └── windows.c └── portaudio/ ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ └── bug_report.md │ └── workflows/ │ ├── MSBuild.yml │ └── c-cpp.yml ├── .gitignore ├── CMakeLists.txt ├── Doxyfile ├── Doxyfile.developer ├── LICENSE.txt ├── Makefile.in ├── README.configure.txt ├── README.md ├── SConstruct ├── aclocal.m4 ├── bindings/ │ ├── cpp/ │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── NEWS │ │ ├── README │ │ ├── SConscript │ │ ├── aclocal.m4 │ │ ├── bin/ │ │ │ ├── Makefile.am │ │ │ └── Makefile.in │ │ ├── build/ │ │ │ ├── gnu/ │ │ │ │ ├── Makefile.in │ │ │ │ ├── OUT_OF_DATE │ │ │ │ ├── aclocal.m4 │ │ │ │ ├── config.guess │ │ │ │ ├── config.sub │ │ │ │ ├── configure │ │ │ │ ├── configure.ac │ │ │ │ └── install-sh │ │ │ ├── vc6/ │ │ │ │ ├── devs_example.dsp │ │ │ │ ├── devs_example.dsw │ │ │ │ ├── sine_example.dsp │ │ │ │ ├── sine_example.dsw │ │ │ │ ├── static_library.dsp │ │ │ │ └── static_library.dsw │ │ │ ├── vc7/ │ │ │ │ └── OUT_OF_DATE │ │ │ └── vc7_1/ │ │ │ ├── devs_example.sln │ │ │ ├── devs_example.vcproj │ │ │ ├── sine_example.sln │ │ │ ├── sine_example.vcproj │ │ │ ├── static_library.sln │ │ │ └── static_library.vcproj │ │ ├── configure │ │ ├── configure.ac │ │ ├── doc/ │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── README │ │ │ ├── config.doxy │ │ │ └── config.doxy.linux │ │ ├── example/ │ │ │ ├── devs.cxx │ │ │ └── sine.cxx │ │ ├── include/ │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ └── portaudiocpp/ │ │ │ ├── AsioDeviceAdapter.hxx │ │ │ ├── AutoSystem.hxx │ │ │ ├── BlockingStream.hxx │ │ │ ├── CFunCallbackStream.hxx │ │ │ ├── CallbackInterface.hxx │ │ │ ├── CallbackStream.hxx │ │ │ ├── CppFunCallbackStream.hxx │ │ │ ├── Device.hxx │ │ │ ├── DirectionSpecificStreamParameters.hxx │ │ │ ├── Exception.hxx │ │ │ ├── HostApi.hxx │ │ │ ├── InterfaceCallbackStream.hxx │ │ │ ├── MemFunCallbackStream.hxx │ │ │ ├── PortAudioCpp.hxx │ │ │ ├── SampleDataFormat.hxx │ │ │ ├── Stream.hxx │ │ │ ├── StreamParameters.hxx │ │ │ ├── System.hxx │ │ │ ├── SystemDeviceIterator.hxx │ │ │ └── SystemHostApiIterator.hxx │ │ ├── lib/ │ │ │ ├── Makefile.am │ │ │ └── Makefile.in │ │ ├── portaudiocpp.pc.in │ │ └── source/ │ │ └── portaudiocpp/ │ │ ├── AsioDeviceAdapter.cxx │ │ ├── BlockingStream.cxx │ │ ├── CFunCallbackStream.cxx │ │ ├── CallbackInterface.cxx │ │ ├── CallbackStream.cxx │ │ ├── CppFunCallbackStream.cxx │ │ ├── Device.cxx │ │ ├── DirectionSpecificStreamParameters.cxx │ │ ├── Exception.cxx │ │ ├── HostApi.cxx │ │ ├── InterfaceCallbackStream.cxx │ │ ├── MemFunCallbackStream.cxx │ │ ├── Stream.cxx │ │ ├── StreamParameters.cxx │ │ ├── System.cxx │ │ ├── SystemDeviceIterator.cxx │ │ └── SystemHostApiIterator.cxx │ └── java/ │ ├── c/ │ │ ├── build/ │ │ │ └── vs2010/ │ │ │ └── PortAudioJNI/ │ │ │ ├── PortAudioJNI.sln │ │ │ ├── PortAudioJNI.vcproj │ │ │ └── PortAudioJNI.vcxproj │ │ └── src/ │ │ ├── com_portaudio_BlockingStream.c │ │ ├── com_portaudio_BlockingStream.h │ │ ├── com_portaudio_PortAudio.c │ │ ├── com_portaudio_PortAudio.h │ │ ├── jpa_tools.c │ │ └── jpa_tools.h │ ├── jportaudio/ │ │ ├── .classpath │ │ ├── .project │ │ ├── jtests/ │ │ │ └── com/ │ │ │ └── portaudio/ │ │ │ ├── PlaySine.java │ │ │ └── TestBasic.java │ │ └── src/ │ │ └── com/ │ │ └── portaudio/ │ │ ├── BlockingStream.java │ │ ├── DeviceInfo.java │ │ ├── HostApiInfo.java │ │ ├── PortAudio.java │ │ ├── StreamInfo.java │ │ └── StreamParameters.java │ ├── jportaudio.dox │ └── scripts/ │ └── make_header.bat ├── build/ │ ├── msvc/ │ │ ├── portaudio.def │ │ ├── portaudio.dsp │ │ ├── portaudio.dsw │ │ ├── portaudio.sln │ │ ├── portaudio.vcproj │ │ └── readme.txt │ └── scons/ │ ├── SConscript_common │ └── SConscript_opts ├── clear_gitrevision.sh ├── cmake_support/ │ ├── FindASIOSDK.cmake │ ├── FindJack.cmake │ ├── cmake_uninstall.cmake.in │ ├── options_cmake.h.in │ ├── portaudio-2.0.pc.in │ ├── portaudioConfig.cmake.in │ └── template_portaudio.def ├── config.guess ├── config.sub ├── configure ├── configure.in ├── depcomp ├── doc/ │ ├── src/ │ │ ├── api_overview.dox │ │ ├── license.dox │ │ ├── mainpage.dox │ │ ├── srcguide.dox │ │ └── tutorial/ │ │ ├── blocking_read_write.dox │ │ ├── compile_cmake.dox │ │ ├── compile_linux.dox │ │ ├── compile_mac_coreaudio.dox │ │ ├── compile_windows.dox │ │ ├── compile_windows_asio_msvc.dox │ │ ├── compile_windows_mingw.dox │ │ ├── exploring.dox │ │ ├── initializing_portaudio.dox │ │ ├── open_default_stream.dox │ │ ├── querying_devices.dox │ │ ├── start_stop_abort.dox │ │ ├── terminating_portaudio.dox │ │ ├── tutorial_start.dox │ │ ├── utility_functions.dox │ │ └── writing_a_callback.dox │ └── utils/ │ └── checkfiledocs.py ├── examples/ │ ├── CMakeLists.txt │ ├── pa_devs.c │ ├── pa_fuzz.c │ ├── paex_mono_asio_channel_select.c │ ├── paex_ocean_shore.c │ ├── paex_pink.c │ ├── paex_read_write_wire.c │ ├── paex_record.c │ ├── paex_record_file.c │ ├── paex_saw.c │ ├── paex_sine.c │ ├── paex_sine_c++.cpp │ ├── paex_wmme_ac3.c │ ├── paex_wmme_surround.c │ ├── paex_write_sine.c │ └── paex_write_sine_nonint.c ├── i686-w64-mingw32.cmake ├── include/ │ ├── pa_asio.h │ ├── pa_jack.h │ ├── pa_linux_alsa.h │ ├── pa_mac_core.h │ ├── pa_win_ds.h │ ├── pa_win_wasapi.h │ ├── pa_win_waveformat.h │ ├── pa_win_wdmks.h │ ├── pa_win_wmme.h │ └── portaudio.h ├── install-sh ├── ltmain.sh ├── missing ├── pablio/ │ ├── README.txt │ ├── pablio.c │ ├── pablio.def │ ├── pablio.h │ ├── test_rw.c │ ├── test_rw_echo.c │ ├── test_w_saw.c │ └── test_w_saw8.c ├── portaudio-2.0.pc.in ├── qa/ │ ├── loopback/ │ │ ├── README.txt │ │ └── src/ │ │ ├── audio_analyzer.c │ │ ├── audio_analyzer.h │ │ ├── biquad_filter.c │ │ ├── biquad_filter.h │ │ ├── paqa.c │ │ ├── paqa_tools.c │ │ ├── paqa_tools.h │ │ ├── qa_tools.h │ │ ├── test_audio_analyzer.c │ │ ├── test_audio_analyzer.h │ │ ├── write_wav.c │ │ └── write_wav.h │ ├── paqa_devs.c │ ├── paqa_errs.c │ └── paqa_latency.c ├── src/ │ ├── SConscript │ ├── common/ │ │ ├── pa_allocation.c │ │ ├── pa_allocation.h │ │ ├── pa_converters.c │ │ ├── pa_converters.h │ │ ├── pa_cpuload.c │ │ ├── pa_cpuload.h │ │ ├── pa_debugprint.c │ │ ├── pa_debugprint.h │ │ ├── pa_dither.c │ │ ├── pa_dither.h │ │ ├── pa_endianness.h │ │ ├── pa_front.c │ │ ├── pa_gitrevision.h │ │ ├── pa_hostapi.h │ │ ├── pa_memorybarrier.h │ │ ├── pa_process.c │ │ ├── pa_process.h │ │ ├── pa_ringbuffer.c │ │ ├── pa_ringbuffer.h │ │ ├── pa_stream.c │ │ ├── pa_stream.h │ │ ├── pa_trace.c │ │ ├── pa_trace.h │ │ ├── pa_types.h │ │ └── pa_util.h │ ├── hostapi/ │ │ ├── alsa/ │ │ │ └── pa_linux_alsa.c │ │ ├── asihpi/ │ │ │ └── pa_linux_asihpi.c │ │ ├── asio/ │ │ │ ├── ASIO-README.txt │ │ │ ├── iasiothiscallresolver.cpp │ │ │ ├── iasiothiscallresolver.h │ │ │ └── pa_asio.cpp │ │ ├── coreaudio/ │ │ │ ├── notes.txt │ │ │ ├── pa_mac_core.c │ │ │ ├── pa_mac_core_blocking.c │ │ │ ├── pa_mac_core_blocking.h │ │ │ ├── pa_mac_core_internal.h │ │ │ ├── pa_mac_core_utilities.c │ │ │ └── pa_mac_core_utilities.h │ │ ├── dsound/ │ │ │ ├── pa_win_ds.c │ │ │ ├── pa_win_ds_dynlink.c │ │ │ └── pa_win_ds_dynlink.h │ │ ├── jack/ │ │ │ └── pa_jack.c │ │ ├── oss/ │ │ │ ├── low_latency_tip.txt │ │ │ ├── pa_unix_oss.c │ │ │ └── recplay.c │ │ ├── skeleton/ │ │ │ ├── README.txt │ │ │ └── pa_hostapi_skeleton.c │ │ ├── wasapi/ │ │ │ ├── mingw-include/ │ │ │ │ ├── AudioSessionTypes.h │ │ │ │ ├── PropIdl.h │ │ │ │ ├── ShTypes.h │ │ │ │ ├── audioclient.h │ │ │ │ ├── devicetopology.h │ │ │ │ ├── endpointvolume.h │ │ │ │ ├── functiondiscoverykeys.h │ │ │ │ ├── functiondiscoverykeys_devpkey.h │ │ │ │ ├── ks.h │ │ │ │ ├── ksguid.h │ │ │ │ ├── ksmedia.h │ │ │ │ ├── ksproxy.h │ │ │ │ ├── ksuuids.h │ │ │ │ ├── mmdeviceapi.h │ │ │ │ ├── propkey.h │ │ │ │ ├── propkeydef.h │ │ │ │ ├── propsys.h │ │ │ │ ├── rpcsal.h │ │ │ │ ├── sal.h │ │ │ │ ├── sdkddkver.h │ │ │ │ ├── structuredquery.h │ │ │ │ └── winapifamily.h │ │ │ ├── pa_win_wasapi.c │ │ │ └── readme.txt │ │ ├── wdmks/ │ │ │ ├── pa_win_wdmks.c │ │ │ └── readme.txt │ │ └── wmme/ │ │ └── pa_win_wmme.c │ └── os/ │ ├── unix/ │ │ ├── pa_unix_hostapis.c │ │ ├── pa_unix_util.c │ │ └── pa_unix_util.h │ └── win/ │ ├── pa_win_coinitialize.c │ ├── pa_win_coinitialize.h │ ├── pa_win_hostapis.c │ ├── pa_win_util.c │ ├── pa_win_waveformat.c │ ├── pa_win_wdmks_utils.c │ ├── pa_win_wdmks_utils.h │ ├── pa_x86_plain_converters.c │ └── pa_x86_plain_converters.h ├── test/ │ ├── CMakeLists.txt │ ├── README.txt │ ├── pa_minlat.c │ ├── patest1.c │ ├── patest_buffer.c │ ├── patest_callbackstop.c │ ├── patest_clip.c │ ├── patest_converters.c │ ├── patest_dither.c │ ├── patest_dsound_find_best_latency_params.c │ ├── patest_dsound_low_level_latency_params.c │ ├── patest_dsound_surround.c │ ├── patest_hang.c │ ├── patest_in_overflow.c │ ├── patest_jack_wasapi.c │ ├── patest_latency.c │ ├── patest_leftright.c │ ├── patest_longsine.c │ ├── patest_many.c │ ├── patest_maxsines.c │ ├── patest_mono.c │ ├── patest_multi_sine.c │ ├── patest_out_underflow.c │ ├── patest_prime.c │ ├── patest_read_record.c │ ├── patest_ringmix.c │ ├── patest_sine8.c │ ├── patest_sine_channelmaps.c │ ├── patest_sine_formats.c │ ├── patest_sine_srate.c │ ├── patest_sine_time.c │ ├── patest_start_stop.c │ ├── patest_stop.c │ ├── patest_stop_playout.c │ ├── patest_suggested_vs_streaminfo_latency.c │ ├── patest_suggested_vs_streaminfo_latency.py │ ├── patest_sync.c │ ├── patest_timing.c │ ├── patest_toomanysines.c │ ├── patest_two_rates.c │ ├── patest_underflow.c │ ├── patest_unplug.c │ ├── patest_wire.c │ ├── patest_wmme_find_best_latency_params.c │ ├── patest_wmme_low_level_latency_params.c │ ├── patest_write_stop.c │ └── patest_write_stop_hang_illegal.c └── update_gitrevision.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: BasicSamplers/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(BasicSamplers) set(SOURCES ../DSPUtil/complex.cpp ../DSPUtil/fft.cpp api.cpp FrequencyDetection.cpp PercussionSampler.cpp InstrumentSingleSampler.cpp InstrumentMultiSampler.cpp ) set(HEADERS ../DSPUtil/complex.h ../DSPUtil/fft.h FrequencyDetection.h Sample.h PercussionSampler.h InstrumentSingleSampler.h InstrumentMultiSampler.h ) set (INCLUDE_DIR ../ScoreDraftCore ../DSPUtil ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) add_library (BasicSamplers SHARED ${SOURCES} ${HEADERS}) target_link_libraries(BasicSamplers ScoreDraftCore) if (WIN32) target_compile_definitions(BasicSamplers PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS BasicSamplers RUNTIME DESTINATION ScoreDraft) else() install(TARGETS BasicSamplers DESTINATION ScoreDraft) endif() ================================================ FILE: BasicSamplers/FrequencyDetection.cpp ================================================ #include "FrequencyDetection.h" #include "fft.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif class Window { public: virtual ~Window(){} float m_halfWidth; std::vector m_data; void Allocate(float halfWidth) { unsigned u_halfWidth = (unsigned)ceilf(halfWidth); unsigned u_width = u_halfWidth << 1; m_halfWidth = halfWidth; m_data.resize(u_width); SetZero(); } void SetZero() { memset(m_data.data(), 0, sizeof(float)*m_data.size()); } void CreateFromBuffer(const Buffer& src, float center, float halfWidth) { unsigned u_halfWidth = (unsigned)ceilf(halfWidth); unsigned u_width = u_halfWidth << 1; m_halfWidth = halfWidth; m_data.resize(u_width); SetZero(); int i_Center = (int)center; for (int i = -(int)u_halfWidth; i < (int)u_halfWidth; i++) { float window = (cosf((float)i * (float)PI / halfWidth) + 1.0f)*0.5f; int srcIndex = i_Center + i; float v_src = src.GetSample(srcIndex); SetSample(i, window* v_src); } } void MergeToBuffer(Buffer& buf, float pos) { int ipos = (int)floorf(pos); unsigned u_halfWidth = GetHalfWidthOfData(); for (int i = max(-(int)u_halfWidth, -ipos); i < (int)u_halfWidth; i++) { int dstIndex = ipos + i; if (dstIndex >= (int)buf.m_size) break; buf.m_data[dstIndex] += GetSample(i); } } virtual unsigned GetHalfWidthOfData() const { unsigned u_width = (unsigned)m_data.size(); unsigned u_halfWidth = u_width >> 1; return u_halfWidth; } virtual float GetSample(int i) const { unsigned u_width = (unsigned)m_data.size(); unsigned u_halfWidth = u_width >> 1; unsigned pos; if (i >= 0) { if ((unsigned)i > u_halfWidth - 1) return 0.0f; pos = (unsigned)i; } else { if (((int)u_width + i) < (int)u_halfWidth + 1) return 0.0f; pos = u_width - (unsigned)(-i); } return m_data[pos]; } virtual void SetSample(int i, float v) { unsigned u_width = (unsigned)m_data.size(); unsigned u_halfWidth = u_width >> 1; unsigned pos; if (i >= 0) { if ((unsigned)i > u_halfWidth - 1) return; pos = (unsigned)i; } else { if (((int)u_width + i) < (int)u_halfWidth + 1) return; pos = u_width - (unsigned)(-i); } m_data[pos] = v; } }; float fetchFrequency(const Buffer& buf, unsigned sampleRate) { unsigned l = 12; unsigned halfWinLen = 1 << (l - 1); float* fft_acc = new float[halfWinLen]; memset(fft_acc, 0, sizeof(float)*halfWinLen); DComp* fftData = new DComp[halfWinLen * 2]; fftData[0].Re = 0.0; fftData[0].Im = 0.0; for (unsigned center = 0; center < buf.m_size; center += halfWinLen) { Window win; win.CreateFromBuffer(buf, (float)center, (float)halfWinLen); for (unsigned i = 1; i lastV) ascending = true; } else { if (v < lastV) { if (fftData[i - 1].Re>maxV) { maxV = fftData[i - 1].Re; maxi = i - 1; } ascending = false; } } lastV = v; } float freq = (float)sampleRate / (float)maxi; delete[] fft_acc; return freq; } ================================================ FILE: BasicSamplers/FrequencyDetection.h ================================================ #ifndef _FrequencyDetection_h #define _FrequencyDetection_h #include #include #include class Buffer { std::vector _data; public: unsigned m_size; float* m_data; void Allocate(unsigned size) { _data.resize(size); m_size = size; m_data = &_data[0]; SetZero(); } float GetSample(int i) const { if (i<0 || i >= (int)m_size) return 0.0f; return m_data[i]; } void SetZero() { memset(m_data, 0, sizeof(float)*m_size); } void SetSample(int i, float v) { if (i < 0 || i >= (int)m_size) return; m_data[i] = v; } void AddToSample(int i, float v) { if (i < 0 || i >= (int)m_size) return; m_data[i] += v; } float GetMax() { float maxv = 0.0f; for (size_t i = 0; i < m_size; i++) { if (fabsf(m_data[i])>maxv) maxv = fabsf(m_data[i]); } return maxv; } }; float fetchFrequency(const Buffer& buf, unsigned sampleRate); #endif ================================================ FILE: BasicSamplers/InstrumentMultiSampler.cpp ================================================ #include #include #include "Sample.h" #include "InstrumentMultiSampler.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif static void s_generateNoteWave(const InstrumentSample& sample, float* outBuf, unsigned outBufLen, float sampleFreq, float k) { unsigned chn = sample.m_chn; float origin_SampleFreq = sample.m_origin_freq / (float)sample.m_origin_sample_rate; unsigned maxSample = (unsigned)((float)sample.m_wav_length*origin_SampleFreq / sampleFreq); float mult = 1.0f / sample.m_max_v; bool interpolation = sampleFreq <= origin_SampleFreq; for (unsigned j = 0; j < min(outBufLen, maxSample); j++) { float wave[2]; if (interpolation) { float pos = (float)j *sampleFreq / origin_SampleFreq; int ipos1 = (int)pos; float frac = pos - (float)ipos1; int ipos2 = ipos1 + 1; if (ipos2 >= (int)sample.m_wav_length) ipos2 = (int)sample.m_wav_length - 1; // linear interpolation //wave = m_wav_samples[ipos1] * (1.0f - frac) + m_wav_samples[ipos2] * frac; // cubic interpolation int ipos0 = ipos1 - 1; if (ipos0 < 0) ipos0 = 0; int ipos3 = ipos1 + 2; if (ipos3 >= (int)sample.m_wav_length) ipos3 = (int)sample.m_wav_length - 1; for (unsigned c = 0; c < chn; c++) { float p0 = sample.m_wav_samples[ipos0*chn + c]; float p1 = sample.m_wav_samples[ipos1*chn + c]; float p2 = sample.m_wav_samples[ipos2*chn + c]; float p3 = sample.m_wav_samples[ipos3*chn + c]; wave[c] = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } } else { int ipos1 = (int)ceilf(((float)j - 0.5f)*sampleFreq / origin_SampleFreq); int ipos2 = (int)floorf(((float)j + 0.5f)*sampleFreq / origin_SampleFreq); if (ipos1 < 0) ipos1 = 0; if (ipos2 >= (int)sample.m_wav_length) ipos2 = (int)sample.m_wav_length - 1; int count = ipos2 - ipos1 + 1; for (unsigned c = 0; c < chn; c++) { float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += sample.m_wav_samples[ipos*chn + c]; } wave[c] = sum / (float)count; } } for (unsigned c = 0; c < chn; c++) { outBuf[j*chn + c] += k* wave[c] * mult; } } } void InstrumentMultiSample(const std::vector& samples, float* outBuf, unsigned outBufLen, float sampleFreq) { if (samples.size() < 1) return; unsigned chn = samples[0].m_chn; bool useSingle = false; unsigned I; { const InstrumentSample& wav = samples[0]; float origin_SampleFreq = wav.m_origin_freq / (float)wav.m_origin_sample_rate; if (sampleFreq <= origin_SampleFreq) { I = 0; useSingle = true; } } if (!useSingle) { const InstrumentSample& wav = samples[samples.size() - 1]; float origin_SampleFreq = wav.m_origin_freq / (float)wav.m_origin_sample_rate; if (sampleFreq >= origin_SampleFreq) { I = (unsigned)(samples.size() - 1); useSingle = true; } } if (!useSingle) { for (size_t i = 0; i < samples.size() - 1; i++) { const InstrumentSample& wav = samples[i + 1]; float origin_SampleFreq = wav.m_origin_freq / (float)wav.m_origin_sample_rate; if (sampleFreq == origin_SampleFreq) { I = (unsigned)(i + 1); useSingle = true; break; } else if (sampleFreq < origin_SampleFreq) { I = (unsigned)i; break; } } } memset(outBuf, 0, sizeof(float)*outBufLen*chn); if (useSingle) { s_generateNoteWave(samples[I], outBuf, outBufLen, sampleFreq, 1.0f); } else { const InstrumentSample& wav1 = samples[I]; const InstrumentSample& wav2 = samples[I + 1]; float origin_SampleFreq1 = wav1.m_origin_freq / (float)wav1.m_origin_sample_rate; float origin_SampleFreq2 = wav2.m_origin_freq / (float)wav2.m_origin_sample_rate; float k2 = logf(sampleFreq / origin_SampleFreq1) / logf(origin_SampleFreq2 / origin_SampleFreq1); float k1 = 1.0f - k2; s_generateNoteWave(wav1, outBuf, outBufLen, sampleFreq, k1); s_generateNoteWave(wav2, outBuf, outBufLen, sampleFreq, k2); } for (unsigned j = 0; j < outBufLen; j++) { float x2 = (float)j / (float)outBufLen; float amplitude = 1.0f - expf((x2 - 1.0f)*10.0f); for (unsigned c = 0; c < chn; c++) outBuf[j*chn + c] = amplitude*outBuf[j*chn + c]; } } ================================================ FILE: BasicSamplers/InstrumentMultiSampler.h ================================================ #ifndef _InstrumentMultiSampler_h #define _InstrumentMultiSampler_h #include struct InstrumentSample; void InstrumentMultiSample(const std::vector& samples, float* outBuf, unsigned outBufLen, float sampleFreq); #endif ================================================ FILE: BasicSamplers/InstrumentSingleSampler.cpp ================================================ #include #include #include "Sample.h" #include "InstrumentSingleSampler.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif void InstrumentSingleSample(const InstrumentSample& sample, float* outBuf, unsigned outBufLen, float sampleFreq) { unsigned chn = sample.m_chn; memset(outBuf, 0, sizeof(float)*outBufLen*chn); float origin_SampleFreq = sample.m_origin_freq / (float)sample.m_origin_sample_rate; unsigned maxSample = (unsigned)((float)sample.m_wav_length*origin_SampleFreq / sampleFreq); float mult = 1.0f / sample.m_max_v; bool interpolation = sampleFreq <= origin_SampleFreq; for (unsigned j = 0; j < min(outBufLen, maxSample); j++) { float x2 = (float)j / (float)outBufLen; float amplitude = 1.0f - expf((x2 - 1.0f)*10.0f); float wave[2]; if (interpolation) { float pos = (float)j *sampleFreq / origin_SampleFreq; int ipos1 = (int)pos; float frac = pos - (float)ipos1; int ipos2 = ipos1 + 1; if (ipos2 >= (int)sample.m_wav_length) ipos2 = (int)sample.m_wav_length - 1; // linear interpolation //wave = m_wav_samples[ipos1] * (1.0f - frac) + m_wav_samples[ipos2] * frac; // cubic interpolation int ipos0 = ipos1 - 1; if (ipos0 < 0) ipos0 = 0; int ipos3 = ipos1 + 2; if (ipos3 >= (int)sample.m_wav_length) ipos3 = (int)sample.m_wav_length - 1; for (unsigned c = 0; c < chn; c++) { float p0 = sample.m_wav_samples[ipos0*chn + c]; float p1 = sample.m_wav_samples[ipos1*chn + c]; float p2 = sample.m_wav_samples[ipos2*chn + c]; float p3 = sample.m_wav_samples[ipos3*chn + c]; wave[c] = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } } else { int ipos1 = (int)ceilf(((float)j - 0.5f)*sampleFreq / origin_SampleFreq); int ipos2 = (int)floorf(((float)j + 0.5f)*sampleFreq / origin_SampleFreq); if (ipos1 < 0) ipos1 = 0; if (ipos2 >= (int)sample.m_wav_length) ipos2 = (int)sample.m_wav_length - 1; int count = ipos2 - ipos1 + 1; for (unsigned c = 0; c < chn; c++) { float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += sample.m_wav_samples[ipos*chn + c]; } wave[c] = sum / (float)count; } } for (unsigned c = 0; c < chn; c++) { outBuf[j*chn + c] = amplitude*wave[c] * mult; } } } ================================================ FILE: BasicSamplers/InstrumentSingleSampler.h ================================================ #ifndef _InstrumentSingleSampler_h #define _InstrumentSingleSampler_h struct InstrumentSample; void InstrumentSingleSample(const InstrumentSample& sample, float* outBuf, unsigned outBufLen, float sampleFreq); #endif ================================================ FILE: BasicSamplers/PercussionSampler.cpp ================================================ #include #include #include "Sample.h" #include "PercussionSampler.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif void PercussionSample(const Sample& sample, float* outBuf, unsigned outBufLen, float sampleRatio) { unsigned chn = sample.m_chn; memset(outBuf, 0, sizeof(float)*outBufLen*chn); unsigned maxSample = (unsigned)((float)sample.m_wav_length*sampleRatio); float mult = 1.0f / sample.m_max_v; if (sampleRatio==1.0f) { for (unsigned j = 0; j < min(outBufLen, maxSample); j++) { float x2 = (float)j / (float)outBufLen; float amplitude = 1.0f - expf((x2 - 1.0f)*10.0f); for (unsigned c = 0; c < chn; c++) { outBuf[j * chn + c] = amplitude*sample.m_wav_samples[j * chn + c] * mult; } } } else { bool interpolation = sampleRatio > 1.0f; float inv_sampleRatio = 1.0f / sampleRatio; for (unsigned j = 0; j < min(outBufLen, maxSample); j++) { float x2 = (float)j / (float)outBufLen; float amplitude = 1.0f - expf((x2 - 1.0f)*10.0f); float wave[2]; if (interpolation) { float pos = (float)j *inv_sampleRatio; int ipos1 = (int)pos; float frac = pos - (float)ipos1; int ipos2 = ipos1 + 1; if (ipos2 >= (int)sample.m_wav_length) ipos2 = (int)sample.m_wav_length - 1; // cubic interpolation int ipos0 = ipos1 - 1; if (ipos0 < 0) ipos0 = 0; int ipos3 = ipos1 + 2; if (ipos3 >= (int)sample.m_wav_length) ipos3 = (int)sample.m_wav_length - 1; for (unsigned c = 0; c < chn; c++) { float p0 = sample.m_wav_samples[ipos0*chn + c]; float p1 = sample.m_wav_samples[ipos1*chn + c]; float p2 = sample.m_wav_samples[ipos2*chn + c]; float p3 = sample.m_wav_samples[ipos3*chn + c]; wave[c] = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } } else { int ipos1 = (int)ceilf(((float)j - 0.5f)*inv_sampleRatio); int ipos2 = (int)floorf(((float)j + 0.5f)*inv_sampleRatio); if (ipos1 < 0) ipos1 = 0; if (ipos2 >= (int)sample.m_wav_length) ipos2 = (int)sample.m_wav_length - 1; int count = ipos2 - ipos1 + 1; for (unsigned c = 0; c < chn; c++) { float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += sample.m_wav_samples[ipos*chn + c]; } wave[c] = sum / (float)count; } } for (unsigned c = 0; c < chn; c++) { outBuf[j*chn + c] = amplitude*wave[c] * mult; } } } } ================================================ FILE: BasicSamplers/PercussionSampler.h ================================================ #ifndef _PercussionSampler_h #define _PercussionSampler_h struct Sample; void PercussionSample(const Sample& sample, float* outBuf, unsigned outBufLen, float sampleRatio); #endif ================================================ FILE: BasicSamplers/Sample.h ================================================ #pragma once struct Sample { Sample() {} virtual ~Sample() {} unsigned m_wav_length; unsigned m_chn; float *m_wav_samples; float m_max_v; unsigned m_origin_sample_rate; }; struct InstrumentSample : public Sample { float m_origin_freq; }; ================================================ FILE: BasicSamplers/api.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API void* SampleCreate(unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v); SCOREDRAFT_API void* InstrumentSampleCreate(unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v, float origin_freq); SCOREDRAFT_API void SampleDestroy(void *ptr); SCOREDRAFT_API void PercussionGenerate(void* ptr_wavbuf, void* ptr_sample, float fduration); SCOREDRAFT_API void InstrumentSingleGenerate(void* ptr_wavbuf, void* ptr_sample, float freq, float fduration); SCOREDRAFT_API void InstrumentMultiGenerate(void* ptr_wavbuf, void* ptr_sample_lst, float freq, float fduration); } #include #include #include "Sample.h" #include "FrequencyDetection.h" #include "PercussionSampler.h" #include "InstrumentSingleSampler.h" #include "InstrumentMultiSampler.h" void CreateSample(Sample* sample, unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v) { F32Buf* buf = (F32Buf*)ptr_f32_buf; if (max_v <= 0.0f) { max_v = 0.0f; for (size_t i = 0; i < buf->size(); i++) { float v = fabsf((*buf)[i]); if (v > max_v) max_v = v; } } sample->m_wav_length = (unsigned)buf->size()/chn; sample->m_chn = chn; sample->m_wav_samples = buf->data(); sample->m_max_v = max_v; sample->m_origin_sample_rate = origin_sample_rate; } void* SampleCreate(unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v) { Sample* sample = new Sample; CreateSample(sample, origin_sample_rate, chn, ptr_f32_buf, max_v); return sample; } static float s_DetectBaseFreq(const Sample& sample) { float* localMono = nullptr; float* pSamples = nullptr; if (sample.m_chn == 1) { pSamples = sample.m_wav_samples; } else if (sample.m_chn == 2) { localMono = new float[sample.m_wav_length]; pSamples = localMono; for (unsigned i = 0; i < sample.m_wav_length; i++) { localMono[i] = 0.5f*(sample.m_wav_samples[i * 2] + sample.m_wav_samples[i * 2 + 1]); } } Buffer buf; buf.m_size = sample.m_wav_length; buf.m_data = pSamples; float baseFreq = fetchFrequency(buf, sample.m_origin_sample_rate); delete[] localMono; return baseFreq; } void* InstrumentSampleCreate(unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v, float origin_freq) { InstrumentSample* sample = new InstrumentSample; CreateSample(sample, origin_sample_rate, chn, ptr_f32_buf, max_v); if (origin_freq <= 0.0f) { sample->m_origin_freq = s_DetectBaseFreq(*sample); } else { sample->m_origin_freq = origin_freq; } return sample; } void SampleDestroy(void *ptr) { delete (Sample*)ptr; } void PercussionGenerate(void* ptr_wavbuf, void* ptr_sample, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; Sample* sample = (Sample*)ptr_sample; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); wavbuf->Allocate(sample->m_chn, len); PercussionSample(*sample, wavbuf->m_data, (unsigned)len, sampleRate / (float)sample->m_origin_sample_rate); } void InstrumentSingleGenerate(void* ptr_wavbuf, void* ptr_sample, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; InstrumentSample* sample = (InstrumentSample*)ptr_sample; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(sample->m_chn, len); InstrumentSingleSample(*sample, wavbuf->m_data, (unsigned)len, sampleFreq); } static int compareSampleWav(const void* a, const void* b) { InstrumentSample& wavA = *((InstrumentSample*)a); InstrumentSample& wavB = *((InstrumentSample*)b); float origin_SampleFreqA = wavA.m_origin_freq / (float)wavA.m_origin_sample_rate; float origin_SampleFreqB = wavB.m_origin_freq / (float)wavB.m_origin_sample_rate; return origin_SampleFreqA > origin_SampleFreqB ? 1 : -1; } void InstrumentMultiGenerate(void* ptr_wavbuf, void* ptr_sample_lst, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; PtrArray* sampleList = (PtrArray*)ptr_sample_lst; unsigned chn = 0; std::vector samples; for (size_t i = 0; i < sampleList->size(); i++) { InstrumentSample* sample = (InstrumentSample*)(*sampleList)[i]; if (i == 0) chn = sample->m_chn; else if (chn != sample->m_chn) { printf("All samples does not have the same number of channels\n"); return; } samples.push_back(*sample); } std::qsort(samples.data(), samples.size(), sizeof(InstrumentSample), compareSampleWav); float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(chn, len); InstrumentMultiSample(samples, wavbuf->m_data, (unsigned)len, sampleFreq); } ================================================ FILE: CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(ScoreDraft) IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) SET(CMAKE_INSTALL_PREFIX ../Test CACHE PATH "Install path" FORCE) ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) add_subdirectory(ScoreDraftCore) add_subdirectory(SimpleInstruments) add_subdirectory(KarplusStrong) add_subdirectory(BasicSamplers) add_subdirectory(SoundFont2) add_subdirectory(VoiceSampler) add_subdirectory(MIDIWriter) set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_subdirectory(thirdparty/portaudio) add_subdirectory(thirdparty/glfw) # add_subdirectory(thirdparty/glew) add_subdirectory(PCMPlayer) add_subdirectory(Meteor) add_subdirectory(python) ================================================ FILE: DSPUtil/complex.cpp ================================================ #include #include "stdio.h" #include "complex.h" double DCEnergy(const DComp* c) { return c->Im*c->Im + c->Re*c->Re; } double DCAbs(const DComp* c) { return sqrt(c->Im*c->Im+c->Re*c->Re); } double DCAng(const DComp* c) { return atan2(c->Im,c->Re); } void DCSetAA(DComp* c,double Abs,double Ang) { c->Re=Abs*cos(Ang); c->Im=Abs*sin(Ang); } void DCConjugate(DComp* c,const DComp* c1) { c->Re=c1->Re; c->Im=-c1->Im; } void DCAdd(DComp* c,const DComp* c1,const DComp* c2) { c->Re=c1->Re+c2->Re; c->Im=c1->Im+c2->Im; } void DCSub(DComp* c,const DComp* c1,const DComp* c2) { c->Re=c1->Re-c2->Re; c->Im=c1->Im-c2->Im; } void DCMul(DComp* c,const DComp* c1,const DComp* c2) { DComp temp; temp.Re=c1->Re*c2->Re-c1->Im*c2->Im; temp.Im=c1->Re*c2->Im+c1->Im*c2->Re; *c=temp; } void DCCW90(DComp* c,const DComp* c1) { DComp temp; temp.Im=c1->Re; temp.Re=-c1->Im; *c=temp; } void DCCCW90(DComp* c,const DComp* c1) { DComp temp; temp.Im=-c1->Re; temp.Re=c1->Im; *c=temp; } void DCPowN(DComp* c,const DComp* c1,int n) { DCSetAA(c,pow(DCAbs(c1),n),DCAng(c1)*n); } void DCPrint(const DComp *c,FILE* f) { if (c->Im==0) fprintf(f,"%g",c->Re); if (c->Im>0) fprintf(f,"%g+%gj",c->Re,c->Im); if (c->Im<0) fprintf(f,"%g%gj",c->Re,c->Im); } ================================================ FILE: DSPUtil/complex.h ================================================ #ifndef YF_COMPLEX #define YF_COMPLEX typedef struct { double Re; double Im; }DComp; double DCEnergy(const DComp* c); double DCAbs(const DComp*); double DCAng(const DComp*); void DCSetAA(DComp*,double,double); void DCConjugate(DComp*,const DComp*); void DCAdd(DComp*,const DComp*,const DComp*); void DCSub(DComp*,const DComp*,const DComp*); void DCMul(DComp*,const DComp*,const DComp*); void DCCW90(DComp*,const DComp*); void DCCCW90(DComp*,const DComp*); void DCPowN(DComp*,const DComp*,int n); #endif ================================================ FILE: DSPUtil/fft.cpp ================================================ #include "fft.h" #include "math.h" void fft(DComp *a,unsigned l) { DComp u,w,t; unsigned n=1,nv2,i,j,k; unsigned le,lei,ip,m; double tmp; n<<=l; nv2=n>>1; j=0; for (i=0;i>=1; } j+=k; } le=1; for(m=1;m<=l;m++) { lei=le; le<<=1; u.Re=1; u.Im=0; tmp=PI/lei; w.Re=cos(tmp); w.Im=-sin(tmp); for (j=0;j>1; j=0; for (i=0;i>=1; } j+=k; } le=1; for(m=1;m<=l;m++) { lei=le; le<<=1; u.Re=0.5; u.Im=0; tmp=PI/lei; w.Re=cos(tmp); w.Im=sin(tmp); for (j=0;jIm*=0.5; (a+i)->Re*=0.5; DCSub(a+ip,a+i,&t); DCAdd(a+i,a+i,&t); } DCMul(&u,&u,&w); } } } ================================================ FILE: DSPUtil/fft.h ================================================ #ifndef YF_FFT #define YF_FFT #include "complex.h" #define PI 3.1415926535897932384626433832795 void fft(DComp *a,unsigned l); void ifft(DComp *a,unsigned l); #endif ================================================ FILE: KarplusStrong/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(KarplusStrong) set (INCLUDE_DIR ../ScoreDraftCore ../DSPUtil ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) add_library (KarplusStrong SHARED KarplusStrong.cpp ../DSPUtil/complex.cpp ../DSPUtil/fft.cpp) target_link_libraries(KarplusStrong ScoreDraftCore) if (WIN32) target_compile_definitions(KarplusStrong PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS KarplusStrong RUNTIME DESTINATION ScoreDraft) else() install(TARGETS KarplusStrong DESTINATION ScoreDraft) endif() ================================================ FILE: KarplusStrong/KarplusStrong.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API void KarplusStrongGenerate(void* ptr_wavbuf, float freq, float fduration, float cut_freq, float loop_gain, float sustain_gain); } #include #include #include #include #include #include "fft.h" inline float rand01() { float f = (float)rand() / (float)RAND_MAX; if (f < 0.0000001f) f = 0.0000001f; if (f > 0.9999999f) f = 0.9999999f; return f; } inline void GeneratePinkNoise(float period, std::vector& buf) { unsigned uLen = (unsigned)ceilf(period); unsigned l = 0; unsigned fftLen = 1; while (fftLen < uLen) { fftLen <<= 1; l++; } std::vector fftData(fftLen); memset(&fftData[0], 0, sizeof(DComp)*fftLen); for (unsigned i = 1; i < (unsigned)(period) / 2; i++) { float amplitude = (float)fftLen / sqrtf((float)i); float phase = rand01()*(float)(2.0*PI); fftData[i].Re = (double)(amplitude*cosf(phase)); fftData[i].Im = (double)(amplitude*sinf(phase)); fftData[fftLen - i].Re = fftData[i].Re; fftData[fftLen - i].Im = -fftData[i].Im; } ifft(&fftData[0], l); unsigned pnLen = (unsigned)ceilf(period*2.0f); buf.resize(pnLen); float rate = (float)fftLen / period; for (unsigned i = 0; i < pnLen; i++) { int ipos1 = (int)ceilf(((float)i - 0.5f)*rate); if (ipos1 < 0) ipos1 = 0; int ipos2 = (int)floorf(((float)i + 0.5f)*rate); int count = ipos2 - ipos1 + 1; float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { int _ipos = ipos; while (_ipos >= fftLen) _ipos -= fftLen; sum += (float)fftData[_ipos].Re; } buf[i] = sum / (float)count; } } void KarplusStrongGenerate(void* ptr_wavbuf, float freq, float fduration, float cut_freq, float loop_gain, float sustain_gain) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float sustain_periods = logf(0.01f) / logf(sustain_gain); float fNumOfSamples = fduration * sampleRate*0.001f; float period = sampleRate / freq; std::vector pinkNoise; GeneratePinkNoise(period, pinkNoise); float sustainLen = sustain_periods * period; size_t totalLen = (size_t)ceilf(fNumOfSamples + sustainLen); wavbuf->Allocate(1, totalLen); cut_freq = cut_freq / 261.626f* freq; float a = (float)(1.0 - exp(-2.0*PI* cut_freq / sampleRate)); unsigned pos = 0; while (pos < totalLen) { float value = 0.0f; if ((float)pos < period*2.0f) value += pinkNoise[pos] * 0.5f*(cosf(((float)pos - period) / period * PI) + 1.0f); if ((float)pos >= period) { float gain = (float)pos < fNumOfSamples ? loop_gain : sustain_gain; float refPos = (float)pos - period; int refPos1 = (int)refPos; int refPos2 = refPos1 + 1; float frac = refPos - (float)refPos1; // linear interpolation float ref = wavbuf->m_data[refPos1] * (1.0f - frac) + wavbuf->m_data[refPos2] * frac; value += gain * a*ref + (1.0f - a)*wavbuf->m_data[pos - 1]; } wavbuf->m_data[pos] = value; pos++; } } ================================================ FILE: LICENSE ================================================ Copyright (C) 2018 - 2021 Fei Yang 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. Acknowledgements Source code under /SoundFont2 is based on TinySoundFont, Copyright (C) 2017 Bernhard Schelling (https://github.com/schellingb/TinySoundFont) Noto Sans Font: /thirdparty/fonts/NotoSansSC-Bold.otf Licensed under the Open Font License (https://fonts.google.com/noto/specimen/Noto+Sans+SC) FreeType: /thirdparty/freetype Licensed: https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT GLFW: /thirdparty/glfw Licensed: https://www.glfw.org/license.html PortAudio: /thirdparty/portaudio Licensed: http://www.portaudio.com/license.html Audio Samples From https://freewavesamples.com ================================================ FILE: MIDIWriter/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(MIDIWriter) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++14) add_compile_options(-fPIC) endif() include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) add_library (MIDIWriter SHARED MIDIWriter.cpp) if (WIN32) install(TARGETS MIDIWriter RUNTIME DESTINATION ScoreDraft) else() install(TARGETS MIDIWriter DESTINATION ScoreDraft) endif() ================================================ FILE: MIDIWriter/MIDIWriter.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API void* NoteCreate(float freq_rel, int duration); SCOREDRAFT_API void NoteDestroy(void* ptr); SCOREDRAFT_API void* WriteToMidi(void* ptr_seq_list, unsigned tempo, float refFreq, const char* fileName); } #include #include #include inline void ByteSwap(unsigned short& word) { unsigned short a = word & 0xFF; a <<= 8; word >>= 8; word |= a; } inline void ByteSwap(unsigned& word) { unsigned a = word & 0xFF; a <<= 24; word >>= 8; unsigned b = word & 0xFF; b <<= 16; word >>= 8; unsigned c = word & 0xFF; c <<= 8; word |= a | b | c; } inline void ToVariableLength(unsigned fixed, unsigned& variable, unsigned& bytes) { variable = 0; bytes = 1; unsigned mask = 0; while (fixed) { variable += (fixed & 0x7F) | mask; fixed >>= 7; if (fixed) { variable <<= 8; bytes++; mask = 0x80; } } } inline void WriteBigEdianWord(FILE *fp, unsigned short aword) { ByteSwap(aword); fwrite(&aword, 2, 1, fp); } inline void WriteBigEdianDWord(FILE *fp, unsigned int adword) { ByteSwap(adword); fwrite(&adword, 4, 1, fp); } inline void WriteVariableLengthDWord(FILE *fp, unsigned fixeddword) { unsigned variable; unsigned bytes; ToVariableLength(fixeddword, variable, bytes); fwrite(&variable, 1, bytes, fp); } struct Note { float m_freq_rel = -1.0f; int m_duration = 48; }; void* NoteCreate(float freq_rel, int duration) { return new Note({ freq_rel, duration }); } void NoteDestroy(void* ptr) { delete (Note*)ptr; } struct NoteEvent { bool isOn; unsigned time; unsigned char note; }; typedef std::vector NoteEventList; inline void AddNoteEvent(NoteEventList& list, const NoteEvent& nevent) { if (list.empty() || (list.end() - 1)->time <= nevent.time) { list.push_back(nevent); return; } NoteEventList::iterator it = list.end() - 1; while (it != list.begin() && (it - 1)->time > nevent.time) it--; list.insert(it, nevent); } #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #define TIME_DIVISION 48 void* WriteToMidi(void* ptr_seq_list, unsigned tempo, float refFreq, const char* fileName) { std::vector*>* seqList = (std::vector*>*)ptr_seq_list; size_t numOfTracks = seqList->size(); FILE *fp = fopen(fileName, "wb"); fwrite("MThd", 1, 4, fp); WriteBigEdianDWord(fp, 6); WriteBigEdianWord(fp, 1); WriteBigEdianWord(fp, (unsigned short)numOfTracks); WriteBigEdianWord(fp, TIME_DIVISION); unsigned timeFactor = TIME_DIVISION / 48; //pitch shift float pitchShift = logf(refFreq / 261.626f)*12.0f / logf(2.0f) + 0.5f; unsigned maxTrackLength = 0; for (unsigned i = 0; i < numOfTracks; i++) { const std::vector& seq = *(*seqList)[i]; fwrite("MTrk", 1, 4, fp); WriteBigEdianDWord(fp, 0); // trackLength; unsigned beginPoint = ftell(fp); unsigned char aByte; //Tempo Event WriteVariableLengthDWord(fp, 0); aByte = 0xff; fwrite(&aByte, 1, 1, fp); aByte = 0x51; fwrite(&aByte, 1, 1, fp); aByte = 3; fwrite(&aByte, 1, 1, fp); unsigned theTempo = 60000000 / tempo; aByte = (theTempo & 0xff0000) >> 16; fwrite(&aByte, 1, 1, fp); aByte = (theTempo & 0xff00) >> 8; fwrite(&aByte, 1, 1, fp); aByte = theTempo & 0xff; fwrite(&aByte, 1, 1, fp); //Note Events NoteEventList elist; unsigned timeTicks = 0; unsigned j; for (j = 0; j < seq.size(); j++) { NoteEvent nevent; if (seq[j]->m_freq_rel < 0.0f) timeTicks += seq[j]->m_duration*timeFactor; else if (seq[j]->m_freq_rel > 0.0f) { nevent.isOn = true; nevent.time = timeTicks; nevent.note = (unsigned char)(logf(seq[j]->m_freq_rel)*12.0f / logf(2.0f) + 60.0f + pitchShift); AddNoteEvent(elist, nevent); timeTicks += seq[j]->m_duration*timeFactor; nevent.isOn = false; nevent.time = timeTicks; AddNoteEvent(elist, nevent); } } maxTrackLength = max(maxTrackLength, timeTicks); timeTicks = 0; for (j = 0; j < elist.size(); j++) { unsigned start = elist[j].time - timeTicks; timeTicks = elist[j].time; WriteVariableLengthDWord(fp, start); if (elist[j].isOn) aByte = 0x90; else aByte = 0x80; fwrite(&aByte, 1, 1, fp); aByte = elist[j].note; fwrite(&aByte, 1, 1, fp); aByte = 64; fwrite(&aByte, 1, 1, fp); } //// End of Track aByte = 0; fwrite(&aByte, 1, 1, fp); aByte = 0xff; fwrite(&aByte, 1, 1, fp); aByte = 0x2f; fwrite(&aByte, 1, 1, fp); aByte = 0; fwrite(&aByte, 1, 1, fp); ////////////////////////// unsigned length = ftell(fp) - beginPoint; fseek(fp, beginPoint - 4, SEEK_SET); WriteBigEdianDWord(fp, length); fseek(fp, length, SEEK_CUR); } fclose(fp); } ================================================ FILE: Meteor/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(Meteor) set(SOURCES api.cpp Meteor.cpp MeteorPlayer.cpp DrawText.cpp ) set(HEADERS SubListLookUp.h Meteor.h MeteorPlayer.h DrawText.h base64.hpp blob.hpp ) set (INCLUDE_DIR ../ScoreDraftCore ../thirdparty/portaudio/include ../thirdparty/glfw/include ../thirdparty/fonts ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) set (INCLUDE_DIR ${INCLUDE_DIR} ../thirdparty/freetype/include/freetype2 ) set (LIB_DIR ../thirdparty/freetype/lib/ ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) set (INCLUDE_DIR ${INCLUDE_DIR} /usr/include/freetype2 ) endif() include_directories(${INCLUDE_DIR}) link_directories(${LIB_DIR}) add_definitions(${DEFINES}) add_library (Meteor SHARED ${SOURCES} ${HEADERS}) target_link_libraries(Meteor ScoreDraftCore portaudio_static glfw freetype) if (WIN32) target_link_libraries(Meteor opengl32) else() target_link_libraries(Meteor GL) endif() if (WIN32) target_compile_definitions(Meteor PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS Meteor RUNTIME DESTINATION ScoreDraft) else() install(TARGETS Meteor DESTINATION ScoreDraft) endif() ================================================ FILE: Meteor/DrawText.cpp ================================================ #include "DrawText.h" #include #include FT_FREETYPE_H #include #include #include #include #include #include #include "NotoSansSC-Bold.hpp" inline bool exists_test(const char* name) { if (FILE *file = fopen(name, "r")) { fclose(file); return true; } else { return false; } } class LibHolder { public: static LibHolder& singlton() { thread_local static LibHolder* lh = nullptr; if (lh == nullptr) { lh = new LibHolder; } return *lh; } FT_Library get_library() const { return m_library; } void add_face(const std::string& name, const std::string& path_ttf) { FT_New_Face(m_library, path_ttf.c_str(), 0, &m_faces[name]); } void set_current_face(const std::string& name) { m_name_current_face = name; } FT_Face get_face(const std::string& name = "") const { std::string fnt_name = name; if (fnt_name == "") fnt_name = m_name_current_face; auto iter = m_faces.find(fnt_name); if (iter == m_faces.end()) { return m_faces.begin()->second; } else { return iter->second; } } private: FT_Library m_library; std::unordered_map m_faces; std::string m_name_current_face; LibHolder() { FT_Init_FreeType(&m_library); FT_New_Memory_Face(m_library, (const FT_Byte*)noto_sans_bold, noto_sans_bold_size, 0, &m_faces["noto_sans_bold"]); } ~LibHolder() { for (auto iter = m_faces.begin(); iter != m_faces.end(); iter++) { FT_Done_Face(iter->second); } FT_Done_FreeType(m_library); } }; #define FT_LIB LibHolder::singlton().get_library() #define FT_FACE LibHolder::singlton().get_face() void FTAddFont(const std::string& name, const std::string& path_ttf) { LibHolder::singlton().add_face(name, path_ttf); } void FTSetCurrentFont(const std::string& name) { LibHolder::singlton().set_current_face(name); } std::wstring UTF8_to_wchar(const char * in) { std::wstring out; unsigned int codepoint; while (*in != 0) { unsigned char ch = static_cast(*in); if (ch <= 0x7f) codepoint = ch; else if (ch <= 0xbf) codepoint = (codepoint << 6) | (ch & 0x3f); else if (ch <= 0xdf) codepoint = ch & 0x1f; else if (ch <= 0xef) codepoint = ch & 0x0f; else codepoint = ch & 0x07; ++in; if (((*in & 0xc0) != 0x80) && (codepoint <= 0x10ffff)) { if (sizeof(wchar_t) > 2) out.append(1, static_cast(codepoint)); else if (codepoint > 0xffff) { out.append(1, static_cast(0xd800 + (codepoint >> 10))); out.append(1, static_cast(0xdc00 + (codepoint & 0x03ff))); } else if (codepoint < 0xd800 || codepoint >= 0xe000) out.append(1, static_cast(codepoint)); } } return out; } struct Character { int width = 0; int height = 0; int offset_x = 0; int offset_y = 0; std::vector data; }; Text::Text(const char* text, int size) { std::wstring wtext = UTF8_to_wchar(text); size_t total_chars = wtext.size(); FT_Set_Char_Size(FT_FACE, 0, size * 64, 72, 72); FT_GlyphSlot slot = FT_FACE->glyph; std::vector characters(total_chars); int min_x = 0x7FFFFFFF; int max_x = 0x80000000; int min_y = 0x7FFFFFFF; int max_y = 0x80000000; int off_x = 0; int off_y = size; for (size_t j = 0; j < total_chars; j++) { wchar_t c = wtext[j]; FT_Load_Char(FT_FACE, c, FT_LOAD_DEFAULT); FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL); Character& character = characters[j]; character.offset_x = off_x + slot->bitmap_left; character.offset_y = off_y - slot->bitmap_top; character.width = (int)slot->bitmap.width; character.height = (int)slot->bitmap.rows; character.data.resize(character.width*character.height); if (character.width > 0 && character.height > 0) memcpy(character.data.data(), slot->bitmap.buffer, character.width*character.height); if (character.offset_x < min_x) min_x = character.offset_x; if (character.offset_y < min_y) min_y = character.offset_y; if (character.offset_x + character.width > max_x) max_x = character.offset_x + character.width; if (character.offset_y + character.height > max_y) max_y = character.offset_y + character.height; off_x += (slot->advance.x >> 6); off_y += slot->advance.y >> 6; } m_width = max_x - min_x; m_height = max_y - min_y; m_offset_x = min_x; m_offset_y = min_y; m_data.resize(m_width*m_height, 0); for (size_t i = 0; i < total_chars; i++) { const Character& character = characters[i]; int off_x = character.offset_x - m_offset_x; int off_y = character.offset_y - m_offset_y; for (int y = 0; y < character.height; y++) { for (int x = 0; x < character.width; x++) { int pos_x = x + off_x; int pos_y = y + off_y; m_data[pos_x + pos_y * m_width] = character.data[x + y * character.width]; } } } } Text::~Text() { } ================================================ FILE: Meteor/DrawText.h ================================================ #pragma once #include class Text { public: Text(const char* text, int size = 32); ~Text(); int m_width = 0; int m_height = 0; int m_offset_x = 0; int m_offset_y = 0; std::vector m_data; }; ================================================ FILE: Meteor/Meteor.cpp ================================================ #include "Meteor.h" #include "blob.hpp" #include "base64.hpp" void Meteor::_updateSublists() { m_notes_sublists.SetData(m_notes, 3.0f); m_beats_sublists.SetData(m_beats, 3.0f); m_singing_sublists.SetData(m_singings, 3.0f); m_needUpdateSublists = false; } void Meteor::InstEvent(EventInst& e) { VisNote note; note.instrumentId = e.instrument_id; double freq = e.freq; note.pitch = (int)floor(log(freq / 261.626)*12.0 / log(2.0) + 0.5); note.start = e.offset / 1000.0f; note.end = note.start + e.fduration / 1000.0f; m_notes.push_back(note); m_needUpdateSublists = true; } void Meteor::PercEvent(EventPerc& e) { VisBeat beat; beat.percId = e.instrument_id; beat.start = e.offset / 1000.0f; beat.end = beat.start + e.fduration / 1000.0; m_beats.push_back(beat); m_needUpdateSublists = true; } void Meteor::SingEvent(EventSing& e) { unsigned id = e.instrument_id; unsigned count = (unsigned)e.syllableList.size(); double pos = e.offset / 1000.0f; for (unsigned i = 0; i < count; i++) { Syllable& syllable = e.syllableList[i]; VisSinging sing; sing.singerId = id; sing.lyric = syllable.lyric; sing.start = (float)pos; std::vector& ctrlPnts = syllable.ctrlPnts; unsigned num_ctrlPnts = (unsigned)ctrlPnts.size(); double totalLen = 0.0; std::vector freqs; std::vector durations; freqs.resize(num_ctrlPnts); durations.resize(num_ctrlPnts); for (unsigned j = 0; j < num_ctrlPnts; j++) { CtrlPnt& ctrlPnt = ctrlPnts[j]; double freq = ctrlPnt.freq; double duration = ctrlPnt.fduration / 1000.0; freqs[j] = freq; durations[j] = duration; totalLen += duration; } sing.end = sing.start + totalLen; double pitchPerSec = 50.0; double secPerPitchSample = 1.0 / pitchPerSec; unsigned pitchLen = (unsigned)ceil(totalLen*pitchPerSec); sing.pitch.resize(pitchLen); unsigned pitchPos = 0; double fPitchPos = 0.0; double nextPitchPos = 0.0; for (unsigned j = 0; j < num_ctrlPnts; j++) { double duration = durations[j]; double freq1 = freqs[j]; double freq2 = j < num_ctrlPnts - 1 ? freqs[j + 1] : freq1; double thisPitchPos = nextPitchPos; nextPitchPos += duration; for (; fPitchPos < nextPitchPos && pitchPos < pitchLen; fPitchPos += secPerPitchSample, pitchPos++) { double k = (fPitchPos - thisPitchPos) / duration; sing.pitch[pitchPos] = (float)(freq1*(1.0f - k) + freq2 * k); } } std::vector temp; temp.resize(pitchLen); temp[0] = sing.pitch[0]; temp[pitchLen - 1] = sing.pitch[pitchLen - 1]; for (unsigned i = 1; i < pitchLen - 1; i++) { temp[i] = 0.25f*(sing.pitch[i - 1] + sing.pitch[i + 1]) + 0.5f*sing.pitch[i]; } for (unsigned i = 0; i < pitchLen; i++) { sing.pitch[i] = logf(temp[i] / 261.626f)*12.0f / logf(2.0f); } m_singings.push_back(sing); pos += totalLen; } m_needUpdateSublists = true; } void Meteor::SaveToFile(const char* filename) { if (m_needUpdateSublists) _updateSublists(); FILE *fp = fopen(filename, "wb"); unsigned countNotes = (unsigned)m_notes.size(); fwrite(&countNotes, sizeof(unsigned), 1, fp); fwrite(&m_notes[0], sizeof(VisNote), countNotes, fp); m_notes_sublists.SaveToFile(fp); unsigned countBeats = (unsigned)m_beats.size(); fwrite(&countBeats, sizeof(unsigned), 1, fp); fwrite(&m_beats[0], sizeof(VisBeat), countBeats, fp); m_beats_sublists.SaveToFile(fp); unsigned countSinging = (unsigned)m_singings.size(); fwrite(&countSinging, sizeof(unsigned), 1, fp); for (unsigned i = 0; i < countSinging; i++) { const VisSinging& singing = m_singings[i]; fwrite(&singing.singerId, sizeof(unsigned), 1, fp); unsigned char len = (unsigned char)singing.lyric.length(); fwrite(&len, 1, 1, fp); if (len > 0) fwrite(singing.lyric.data(), 1, len, fp); unsigned count = (unsigned)singing.pitch.size(); fwrite(&count, sizeof(unsigned), 1, fp); fwrite(singing.pitch.data(), sizeof(float), count, fp); fwrite(&singing.start, sizeof(float), 2, fp); } m_singing_sublists.SaveToFile(fp); fclose(fp); } void Meteor::LoadFromFile(const char* filename) { FILE *fp = fopen(filename, "rb"); unsigned countNotes; fread(&countNotes, sizeof(unsigned), 1, fp); m_notes.clear(); m_notes.resize(countNotes); fread(&m_notes[0], sizeof(VisNote), countNotes, fp); m_notes_sublists.LoadFromFile(fp); unsigned countBeats; fread(&countBeats, sizeof(unsigned), 1, fp); m_beats.clear(); m_beats.resize(countBeats); fread(&m_beats[0], sizeof(VisBeat), countBeats, fp); m_beats_sublists.LoadFromFile(fp); unsigned countSinging; fread(&countSinging, sizeof(unsigned), 1, fp); m_singings.clear(); m_singings.resize(countSinging); for (unsigned i = 0; i < countSinging; i++) { VisSinging& singing = m_singings[i]; fread(&singing.singerId, sizeof(unsigned), 1, fp); unsigned char len; fread(&len, 1, 1, fp); if (len > 0) { char _str[256]; fread(_str, 1, len, fp); _str[len] = 0; singing.lyric = _str; } else singing.lyric = ""; unsigned count; fread(&count, sizeof(unsigned), 1, fp); singing.pitch.resize(count); fread(singing.pitch.data(), sizeof(float), count, fp); fread(&singing.start, sizeof(float), 2, fp); } m_singing_sublists.LoadFromFile(fp); fclose(fp); m_needUpdateSublists = true; } void Meteor::ToBlob(std::vector& blob) { if (m_needUpdateSublists) _updateSublists(); blob.clear(); unsigned countNotes = (unsigned)m_notes.size(); blob_write(blob, &countNotes, sizeof(unsigned)); blob_write(blob, &m_notes[0], sizeof(VisNote) * countNotes); m_notes_sublists.ToBlob(blob); unsigned countBeats = (unsigned)m_beats.size(); blob_write(blob, &countBeats, sizeof(unsigned)); blob_write(blob, &m_beats[0], sizeof(VisBeat)*countBeats); m_beats_sublists.ToBlob(blob); unsigned countSinging = (unsigned)m_singings.size(); blob_write(blob, &countSinging, sizeof(unsigned)); for (unsigned i = 0; i < countSinging; i++) { const VisSinging& singing = m_singings[i]; blob_write(blob, &singing.singerId, sizeof(unsigned)); unsigned char len = (unsigned char)singing.lyric.length(); blob_write(blob, &len, 1); if (len > 0) blob_write(blob, singing.lyric.data(), len); unsigned count = (unsigned)singing.pitch.size(); blob_write(blob, &count, sizeof(unsigned)); blob_write(blob, singing.pitch.data(), sizeof(float) * count); blob_write(blob, &singing.start, sizeof(float)*2); } m_singing_sublists.ToBlob(blob); } void Meteor::ToBase64(std::string& base64) { std::vector blob; ToBlob(blob); base64_encode(blob, base64); } Meteor::Meteor(size_t num_events, const Event** events) { for (unsigned i = 0; i < num_events; i++) { const Event* e = events[i]; switch (e->type) { case 0: InstEvent(*(EventInst*)e); break; case 1: PercEvent(*(EventPerc*)e); break; case 2: SingEvent(*(EventSing*)e); break; } } } #include "MeteorPlayer.h" void Meteor::Play(TrackBuffer* buffer) { if (m_needUpdateSublists) _updateSublists(); MeteorPlayer player(this, buffer); player.main_loop(); } ================================================ FILE: Meteor/Meteor.h ================================================ #pragma once #include #include #include class Event { public: unsigned type; unsigned instrument_id; float offset; Event(unsigned type, unsigned instrument_id) : type(type), instrument_id(instrument_id) { } virtual ~Event() { } }; class EventInst : public Event { public: double freq; float fduration; EventInst(unsigned instrument_id, double freq, float fduration) : Event(0, instrument_id) , freq(freq) , fduration(fduration) { } }; class EventPerc : public Event { public: float fduration; EventPerc(unsigned instrument_id, float fduration) : Event(1, instrument_id) , fduration(fduration) { } }; struct CtrlPnt { double freq; double fduration; }; struct Syllable { std::string lyric; std::vector ctrlPnts; }; class EventSing : public Event { public: std::vector syllableList; EventSing(unsigned instrument_id, size_t num_syllables, const Syllable** syllables) : Event(2, instrument_id), syllableList(num_syllables) { for (size_t i = 0; i < num_syllables; i++) { syllableList[i] = *syllables[i]; } } }; struct VisNote { unsigned instrumentId; int pitch; float start; float end; }; struct VisBeat { unsigned percId; float start; float end; }; typedef std::vector> TempoMap; struct VisSinging { unsigned singerId; std::string lyric; std::vector pitch; float start; float end; }; class TrackBuffer; #include "SubListLookUp.h" class Meteor { std::vector m_notes; std::vector m_beats; std::vector m_singings; SubLists m_notes_sublists; SubLists m_beats_sublists; SubLists m_singing_sublists; bool m_needUpdateSublists = true; void _updateSublists(); public: Meteor(){} ~Meteor(){} Meteor(size_t num_events, const Event** events); void InstEvent(EventInst& e); void PercEvent(EventPerc& e); void SingEvent(EventSing& e); void SaveToFile(const char* filename); void LoadFromFile(const char* filename); void ToBlob(std::vector& blob); void ToBase64(std::string& base64); const std::vector& GetNotes() const { return m_notes; } const std::vector& GetBeats() const { return m_beats; } const std::vector& GetSingings() const { return m_singings; } const SubLists& GetNotesSublists() const { return m_notes_sublists; } const SubLists& GetBeatsSublists() const { return m_beats_sublists; } const SubLists& GetSingingSublists() const { return m_singing_sublists; } void Play(TrackBuffer* buffer); }; ================================================ FILE: Meteor/MeteorPlayer.cpp ================================================ #include #include #include #include #include #include #include #include #include #include #include #include #include "MeteorPlayer.h" #include "Meteor.h" #include "DrawText.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif class AudioBufferQueue { public: AudioBufferQueue(int cache_size) : m_semaphore_in(cache_size) { } ~AudioBufferQueue() { } size_t Size() { return m_queue.size(); } AudioBuffer* Front() { return m_queue.front(); } void Push(AudioBuffer* packet) { m_semaphore_in.wait(); m_mutex.lock(); m_queue.push(packet); m_mutex.unlock(); m_semaphore_out.notify(); } AudioBuffer* Pop() { m_semaphore_out.wait(); m_mutex.lock(); AudioBuffer* ret = m_queue.front(); m_queue.pop(); m_mutex.unlock(); m_semaphore_in.notify(); return ret; } private: std::queue m_queue; std::mutex m_mutex; Semaphore m_semaphore_in; Semaphore m_semaphore_out; }; void MeteorPlayer::_set_sync_point(size_t playback_pos, double time_playback_pos) { m_mutex_sync.lock(); m_playback_pos = playback_pos; m_time_playback_pos = time_playback_pos; m_mutex_sync.unlock(); } void MeteorPlayer::_get_sync_point(size_t& playback_pos, double& time_playback_pos) { m_mutex_sync.lock(); playback_pos = m_playback_pos; time_playback_pos = m_time_playback_pos; m_mutex_sync.unlock(); } int MeteorPlayer::stream_callback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, unsigned long statusFlags, void *userData) { MeteorPlayer* self = (MeteorPlayer*)userData; AudioBufferQueue* queue = self->m_audio_queue.get(); self->_set_sync_point(self->m_playback_pos_next, time_sec()); unsigned long pos_out = 0; short *out = (short*)outputBuffer; while (pos_out < framesPerBuffer) { if (queue->Size() < 1) break; AudioBuffer* buf_in = queue->Front(); size_t copy_size = min(AUDIO_BUF_LEN - self->m_audio_read_pos, framesPerBuffer - pos_out); memcpy(out + pos_out * 2, buf_in->data + self->m_audio_read_pos * 2, sizeof(short)*copy_size * 2); self->m_audio_read_pos += copy_size; pos_out += (unsigned long)copy_size; if (self->m_audio_read_pos == AUDIO_BUF_LEN) { self->m_audio_read_pos = 0; queue->Pop(); delete buf_in; } } if (pos_out < framesPerBuffer) memset(out + pos_out * 2, 0, sizeof(short) * (framesPerBuffer - pos_out) * 2); self->m_playback_pos_next = self->m_playback_pos + framesPerBuffer; return paContinue; } void MeteorPlayer::thread_demux(MeteorPlayer* self) { TrackBuffer* buf_in = self->m_trackbuffer; unsigned size = buf_in->NumberOfSamples(); unsigned chn = buf_in->NumberOfChannels(); float volume = buf_in->AbsoluteVolume(); float pan = buf_in->Pan(); AudioBufferQueue* queue_out = self->m_audio_queue.get(); while (self->m_demuxing) { AudioBuffer* buf_out = new AudioBuffer; size_t pos_out = 0; while (pos_out < AUDIO_BUF_LEN) { size_t copy_size = min(size - self->m_input_read_pos, AUDIO_BUF_LEN - pos_out); for (size_t i = 0; i < copy_size; i++) { size_t read_pos = self->m_input_read_pos + i; float sample_in[2]; buf_in->Sample(read_pos, sample_in); short sample_out[2]; if (chn == 1) { sample_out[0] = sample_out[1] = (short)(max(min(sample_in[0] * volume, 1.0f), -1.0f)*32767.0f); } else { CalcPan(pan, sample_in[0], sample_in[1]); sample_out[0] = (short)(max(min(sample_in[0] * volume, 1.0f), -1.0f)*32767.0f); sample_out[1] = (short)(max(min(sample_in[1] * volume, 1.0f), -1.0f)*32767.0f); } size_t write_pos = pos_out + i; buf_out->data[write_pos * 2] = sample_out[0]; buf_out->data[write_pos * 2 + 1] = sample_out[1]; } self->m_input_read_pos += copy_size; pos_out += copy_size; if (self->m_input_read_pos == size) { self->m_demuxing = false; break; } } if (pos_out < AUDIO_BUF_LEN) memset(buf_out->data + pos_out * 2, 0, sizeof(short) * (AUDIO_BUF_LEN - pos_out) * 2); queue_out->Push(buf_out); } } #define PI 3.1415926535897932384626433832795 inline float rand01() { float f = (float)rand() / (float)RAND_MAX; if (f < 0.0000001f) f = 0.0000001f; if (f > 0.9999999f) f = 0.9999999f; return f; } unsigned char MeteorPlayer::s_ColorBank[15][3] = { { 0x41, 0x8C, 0xF0 }, { 0xFC, 0xB4, 0x41 }, { 0xDF, 0x3A, 0x02 }, { 0x05, 0x64, 0x92 }, { 0xBF, 0xBF, 0xBF }, { 0x1A, 0x3B, 0x69 }, { 0xFF, 0xE3, 0x82 }, { 0x12, 0x9C, 0xDD }, { 0xCA, 0x6B, 0x4B }, { 0x00, 0x5C, 0xDB }, { 0xF3, 0xD2, 0x88 }, { 0x50, 0x63, 0x81 }, { 0xF1, 0xB9, 0xA8 }, { 0xE0, 0x83, 0x0A }, { 0x78, 0x93, 0xBE } }; thread_local int MeteorPlayer::s_instance_count = 0; MeteorPlayer::MeteorPlayer(Meteor* meteor, TrackBuffer* trackbuffer) : m_meteor(meteor), m_trackbuffer(trackbuffer) { m_time_playback_pos = time_sec(); if (s_instance_count == 0) Pa_Initialize(); s_instance_count++; m_audio_queue = std::unique_ptr(new AudioBufferQueue(8)); m_demuxing = true; m_thread_demux = (std::unique_ptr)(new std::thread(thread_demux, this)); PaStreamParameters outputParameters = {}; outputParameters.device = Pa_GetDefaultOutputDevice(); outputParameters.channelCount = 2; outputParameters.sampleFormat = paInt16; outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; double sample_rate = (double)trackbuffer->Rate(); Pa_OpenStream(&m_stream, nullptr, &outputParameters, sample_rate, (unsigned long)(sample_rate*0.01), paClipOff, stream_callback, this); Pa_StartStream(m_stream); glfwInit(); glfwWindowHint(GLFW_SAMPLES, 4); m_window = glfwCreateWindow(640, 480, "ScoreDraft Meteor Player", NULL, NULL); glfwMakeContextCurrent(m_window); glfwSwapInterval(1); _buildColorMap(); _buildTexs(); } MeteorPlayer::~MeteorPlayer() { auto iter = m_texs.begin(); while (iter != m_texs.end()) { glDeleteTextures(1, &iter->second.texId); iter++; } glfwDestroyWindow(m_window); glfwTerminate(); m_demuxing = false; Pa_StopStream(m_stream); Pa_CloseStream(m_stream); while (m_audio_queue->Size() > 0) { AudioBuffer* p = m_audio_queue->Pop(); delete p; } m_thread_demux->join(); m_thread_demux = nullptr; s_instance_count--; if (s_instance_count == 0) Pa_Terminate(); } void MeteorPlayer::_buildColorMap() { unsigned bankRef = 0; const std::vector& beats = m_meteor->GetBeats(); m_beats_centers.clear(); for (unsigned i = 0; i < (unsigned)beats.size(); i++) { unsigned perc = beats[i].percId; if (m_PercColorMap.find(perc) == m_PercColorMap.end()) { m_PercColorMap[perc] = s_ColorBank[bankRef]; bankRef++; if (bankRef >= 15) bankRef = 0; } float x = rand01(); float y = rand01(); m_beats_centers.push_back({ x, y }); } const std::vector& singings = m_meteor->GetSingings(); for (unsigned i = 0; i < (unsigned)singings.size(); i++) { unsigned singer = singings[i].singerId; if (m_SingerColorMap.find(singer) == m_SingerColorMap.end()) { m_SingerColorMap[singer] = s_ColorBank[bankRef]; bankRef++; if (bankRef >= 15) bankRef = 0; } } const std::vector& notes = m_meteor->GetNotes(); for (unsigned i = 0; i < (unsigned)notes.size(); i++) { unsigned inst = notes[i].instrumentId; if (m_InstColorMap.find(inst) == m_InstColorMap.end()) { m_InstColorMap[inst] = s_ColorBank[bankRef]; bankRef++; if (bankRef >= 15) bankRef = 0; } } } void MeteorPlayer::_buildTexs() { const std::vector& lst_singings = m_meteor->GetSingings(); for (size_t i = 0; i < lst_singings.size(); i++) { const VisSinging* pnote = &lst_singings[i]; std::string lyric = pnote->lyric; Text text(lyric.c_str()); TexText tex; tex.width = text.m_width; tex.height = text.m_height; glGenTextures(1, &tex.texId); glBindTexture(GL_TEXTURE_2D, tex.texId); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex.width, tex.height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, text.m_data.data()); glBindTexture(GL_TEXTURE_2D, 0); m_texs[lyric] = tex; } } void MeteorPlayer::_draw_tex(const TexText& tex, float x, float y) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, tex.texId); glBegin(GL_QUADS); glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y); glTexCoord2f(1.0f, 1.0f); glVertex2f(x + tex.width, y); glTexCoord2f(1.0f, 0.0f); glVertex2f(x + tex.width, y + tex.height); glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y + tex.height); glEnd(); glDisable(GL_TEXTURE_2D); } void MeteorPlayer::_draw_key(float left, float right, float bottom, float top, float lineWidth, bool black) { if (black) glColor3f(0.0f, 0.0f, 0.0f); else glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); // top glVertex2f(left + m_cornerSize, top); glVertex2f(right - m_cornerSize, top); glVertex2f(right, top - m_cornerSize); glVertex2f(left, top - m_cornerSize); // mid glVertex2f(left, top - m_cornerSize); glVertex2f(right, top - m_cornerSize); glVertex2f(right, bottom + m_cornerSize); glVertex2f(left, bottom + m_cornerSize); // bottom glVertex2f(left, bottom + m_cornerSize); glVertex2f(right, bottom + m_cornerSize); glVertex2f(right - m_cornerSize, bottom); glVertex2f(left + m_cornerSize, bottom); glEnd(); // outline if (black) glColor3f(1.0f, 1.0f, 1.0f); else glColor3f(0.0f, 0.0f, 0.0f); glLineWidth(lineWidth); glBegin(GL_LINE_STRIP); glVertex2f(left + m_cornerSize, top); glVertex2f(right - m_cornerSize, top); glVertex2f(right, top - m_cornerSize); glVertex2f(right, bottom + m_cornerSize); glVertex2f(right - m_cornerSize, bottom); glVertex2f(left + m_cornerSize, bottom); glVertex2f(left, bottom + m_cornerSize); glVertex2f(left, top - m_cornerSize); glVertex2f(left + m_cornerSize, top); glEnd(); } void MeteorPlayer::_draw_flash(float centerx, float centery, float radius, unsigned char color[3], float alpha) { unsigned div = 36; unsigned char uAlpha = (unsigned char)(alpha*255.0f); glBegin(GL_TRIANGLES); for (unsigned i = 0; i < div; i++) { float theta1 = (float)i / (float)div * 2.0f*(float)PI; float theta2 = (float)(i + 1) / (float)div * 2.0f*(float)PI; float x1 = centerx + cosf(theta1)*radius; float y1 = centery + sinf(theta1)*radius; float x2 = centerx + cosf(theta2)*radius; float y2 = centery + sinf(theta2)*radius; glColor4ub(color[0], color[1], color[2], uAlpha); glVertex2f(centerx, centery); glColor4ub(color[0], color[1], color[2], 0); glVertex2f(x1, y1); glVertex2f(x2, y2); } glEnd(); } void MeteorPlayer::draw() { int width, height; glfwGetFramebufferSize(m_window, &width, &height); glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, (double)width, 0.0, (double)height, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glDisable(GL_DEPTH_TEST); const SubLists& notes_sublists = m_meteor->GetNotesSublists(); const SubLists& beats_sublists = m_meteor->GetBeatsSublists(); const SubLists& singing_sublists = m_meteor->GetSingingSublists(); size_t playback_pos; double time_playback_pos; _get_sync_point(playback_pos, time_playback_pos); double ref_time = (double)playback_pos / (double)m_trackbuffer->Rate(); double time_now = time_sec(); float note_inTime = (float)(ref_time + (time_now - time_playback_pos)); unsigned note_intervalId = notes_sublists.GetIntervalId(note_inTime); float note_outTime = note_inTime - m_showTime; unsigned note_intervalId_min = notes_sublists.GetIntervalId(note_outTime); /// draw meteors glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); //notes if (notes_sublists.m_subLists.size() > 0) { std::unordered_set visiableNotes; for (unsigned i = note_intervalId_min; i <= note_intervalId; i++) { const SubList& subList = notes_sublists.m_subLists[i]; for (unsigned j = 0; j < (unsigned)subList.size(); j++) { const VisNote& note = m_meteor->GetNotes()[subList[j]]; if (note.start note_outTime) visiableNotes.insert(¬e); } } glBegin(GL_QUADS); float keyPos[12] = { 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.5f, 4.0f, 4.5f, 5.0f, 5.5f, 6.0f, 6.5f }; for (auto iter = visiableNotes.begin(); iter != visiableNotes.end(); iter++) { float startY = ((*iter)->start - note_inTime) / -m_showTime * ((float)height - m_whiteKeyHeight) + m_whiteKeyHeight; float endY = ((*iter)->end - note_inTime) / -m_showTime * ((float)height - m_whiteKeyHeight) + m_whiteKeyHeight; unsigned instId = (*iter)->instrumentId; unsigned char* color = m_InstColorMap[instId]; int pitch = (*iter)->pitch; int octave = 0; while (pitch < 0) { pitch += 12; octave--; } while (pitch >= 12) { pitch -= 12; octave++; } float x = (float)width*0.5f + ((float)octave*7.0f + keyPos[pitch])*m_whiteKeyWidth; glColor4ub(color[0], color[1], color[2], 255); glVertex2f(x, startY); glVertex2f(x + m_meteorHalfWidth, startY - m_meteorHalfWidth); glColor4ub(color[0], color[1], color[2], 0); glVertex2f(x, endY); glColor4ub(color[0], color[1], color[2], 255); glVertex2f(x - m_meteorHalfWidth, startY - m_meteorHalfWidth); } glEnd(); } // beats if (beats_sublists.m_subLists.size() > 0) { unsigned beat_intervalId = beats_sublists.GetIntervalId(note_inTime); const SubList& subList = beats_sublists.m_subLists[beat_intervalId]; for (unsigned i = 0; i < (unsigned)subList.size(); i++) { unsigned beatIndex = subList[i]; const VisBeat& beat = m_meteor->GetBeats()[beatIndex]; float start = beat.start; float end = beat.end; // limting percussion flash time if (end - start > m_percussion_flash_limit) end = start + m_percussion_flash_limit; if (note_inTime >= start && note_inTime <= end) { float centerx = m_beats_centers[beatIndex].x*width; float centery = m_beats_centers[beatIndex].y*(height - m_whiteKeyHeight) + m_whiteKeyHeight; float radius = width * m_percussion_flash_size_factor; unsigned char* color = m_PercColorMap[beat.percId]; float alpha = (end - note_inTime) / (end - start); _draw_flash(centerx, centery, radius, color, alpha); } } } // singing if (singing_sublists.m_subLists.size() > 0) { unsigned singing_intervalId = singing_sublists.GetIntervalId(note_inTime); unsigned singing_intervalId_min = singing_sublists.GetIntervalId(note_outTime); std::unordered_set visiableNotes; for (unsigned i = singing_intervalId_min; i <= singing_intervalId; i++) { const SubList& subList = singing_sublists.m_subLists[i]; for (unsigned j = 0; j < (unsigned)subList.size(); j++) { const VisSinging& note = m_meteor->GetSingings()[subList[j]]; if (note.start note_outTime) visiableNotes.insert(¬e); } } float pixelPerPitch = m_whiteKeyWidth * 7.0f / 12.0f; glBegin(GL_QUADS); for (auto iter = visiableNotes.begin(); iter != visiableNotes.end(); iter++) { float startY = ((*iter)->start - note_inTime) / -m_showTime * ((float)height - m_whiteKeyHeight) + m_whiteKeyHeight; float endY = ((*iter)->end - note_inTime) / -m_showTime * ((float)height - m_whiteKeyHeight) + m_whiteKeyHeight; unsigned singerId = (*iter)->singerId; unsigned char* color = m_SingerColorMap[singerId]; const float* pitches = &(*iter)->pitch[0]; unsigned num_pitches = (unsigned)(*iter)->pitch.size(); for (unsigned i = 0; i < num_pitches - 1; i++) { float x1 = pitches[i] * pixelPerPitch + (float)width*0.5f + m_whiteKeyWidth * 0.5f; float x2 = pitches[i + 1] * pixelPerPitch + (float)width*0.5f + m_whiteKeyWidth * 0.5f; float k1 = (float)i / (float)(num_pitches - 1); float y1 = startY * (1.0f - k1) + endY * k1; float k2 = (float)(i + 1) / (float)(num_pitches - 1); float y2 = startY * (1.0f - k2) + endY * k2; glColor4ub(color[0], color[1], color[2], (unsigned char)((1.0f - k1)*255.0f)); glVertex2f(x1 - m_singing_half_width, y1); glVertex2f(x1 + m_singing_half_width, y1); glVertex2f(x2 + m_singing_half_width, y2); glVertex2f(x2 - m_singing_half_width, y2); } } glEnd(); } // lyrics if (singing_sublists.m_subLists.size() > 0) { unsigned singing_intervalId = singing_sublists.GetIntervalId(note_inTime); unsigned singing_intervalId_min = singing_sublists.GetIntervalId(note_outTime); std::unordered_set visiableNotes; for (unsigned i = singing_intervalId_min; i <= singing_intervalId; i++) { const SubList& subList = singing_sublists.m_subLists[i]; for (unsigned j = 0; j < (unsigned)subList.size(); j++) { const VisSinging& note = m_meteor->GetSingings()[subList[j]]; if (note.start note_outTime) visiableNotes.insert(¬e); } } float pixelPerPitch = m_whiteKeyWidth * 7.0f / 12.0f; for (auto iter = visiableNotes.begin(); iter != visiableNotes.end(); iter++) { float startY = ((*iter)->start - note_inTime) / -m_showTime * ((float)height - m_whiteKeyHeight) + m_whiteKeyHeight; unsigned singerId = (*iter)->singerId; unsigned char* color = m_SingerColorMap[singerId]; float x = (*iter)->pitch[0] * pixelPerPitch + (float)width*0.5f + m_whiteKeyWidth * 0.5f + m_singing_half_width; std::string lyric = (*iter)->lyric; TexText& tex = m_texs[lyric]; glColor3ub(color[0], color[1], color[2]); _draw_tex(tex, x, startY); } } /// draw keyboard glDisable(GL_BLEND); static int whitePitchs[7] = { 0, 2, 4, 5, 7, 9, 11 }; static int blackPitchs[5] = { 1, 3, 6, 8, 10 }; static int blackPos[5] = { 1, 2, 4, 5, 6 }; float center = (float)width *0.5f; float octaveWidth = m_whiteKeyWidth * 7.0f; int minOctave = -(int)ceilf(center / octaveWidth); int maxOctave = (int)floorf(center / octaveWidth); int numKeys = (maxOctave - minOctave + 1) * 12; int indexShift = -minOctave * 12; bool* pressed = new bool[numKeys]; memset(pressed, 0, sizeof(bool)* numKeys); // notes if (notes_sublists.m_subLists.size() > 0) { const SubList& subList = notes_sublists.m_subLists[note_intervalId]; for (unsigned i = 0; i < (unsigned)subList.size(); i++) { const VisNote& note = m_meteor->GetNotes()[subList[i]]; float start = note.start; float end = note.end; // early key-up movement end -= (end - start)*0.1f; if (note_inTime >= start && note_inTime <= end) { int index = note.pitch + indexShift; if (index >= 0 && index < numKeys) { pressed[index] = true; } } } } for (int i = minOctave; center + (float)i*octaveWidth < width; i++) { float octaveLeft = center + (float)i*octaveWidth; for (int j = 0; j < 7; j++) { int index = whitePitchs[j] + i * 12 + indexShift; bool keyPressed = pressed[index]; float left = octaveLeft + (float)j*m_whiteKeyWidth; float right = left + m_whiteKeyWidth; float bottom = keyPressed ? m_whiteKeyPressedDelta : 0.0f; float top = m_whiteKeyHeight; _draw_key(left, right, bottom, top, keyPressed ? m_pressedLineWidth : 1.0f); } for (int j = 0; j < 5; j++) { int index = blackPitchs[j] + i * 12 + indexShift; bool keyPressed = pressed[index]; float keyCenter = octaveLeft + (float)blackPos[j] * m_whiteKeyWidth; float left = keyCenter - m_blackKeyWidth / 2.0f; float right = keyCenter + m_blackKeyWidth / 2.0f; float bottom = keyPressed ? m_whiteKeyHeight - m_blackKeyHeight + m_blackKeyPressedDelta : m_whiteKeyHeight - m_blackKeyHeight; float top = m_whiteKeyHeight; _draw_key(left, right, bottom, top, keyPressed ? m_pressedLineWidth : 1.0f, true); } } delete[] pressed; } void MeteorPlayer::main_loop() { while (m_demuxing && glfwWindowShouldClose(m_window) == 0) { glfwMakeContextCurrent(m_window); draw(); glfwSwapBuffers(m_window); glfwPollEvents(); } } ================================================ FILE: Meteor/MeteorPlayer.h ================================================ #pragma once #include #include #include #include typedef std::unordered_map ColorMap; struct Pos2D { float x; float y; }; namespace std { class thread; } #define AUDIO_BUF_LEN 512 struct AudioBuffer { short data[AUDIO_BUF_LEN * 2]; }; class TrackBuffer; class AudioBufferQueue; struct PaStreamCallbackTimeInfo; struct GLFWwindow; class Meteor; struct VisSinging; class MeteorPlayer { public: MeteorPlayer(Meteor* meteor, TrackBuffer* trackbuffer); ~MeteorPlayer(); void main_loop(); private: static thread_local int s_instance_count; void *m_stream; static int stream_callback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, unsigned long statusFlags, void *userData); double m_sample_rate = 44100.0; Meteor* m_meteor = nullptr; TrackBuffer* m_trackbuffer = nullptr; std::unique_ptr m_audio_queue; size_t m_input_read_pos = 0; size_t m_audio_read_pos = 0; size_t m_playback_pos = 0; size_t m_playback_pos_next = 0; double m_time_playback_pos = 0.0; std::mutex m_mutex_sync; void _set_sync_point(size_t playback_pos, double time_playback_pos); void _get_sync_point(size_t& playback_pos, double& time_playback_pos); bool m_demuxing = false; static void thread_demux(MeteorPlayer* self); std::unique_ptr m_thread_demux; // UI GLFWwindow* m_window = nullptr; void draw(); struct TexText { int width; int height; unsigned texId; }; std::unordered_map m_texs; void _buildTexs(); void _draw_tex(const TexText& tex, float x, float y); void _buildColorMap(); void _draw_key(float left, float right, float bottom, float top, float lineWidth, bool black = false); void _draw_flash(float centerx, float centery, float radius, unsigned char color[3], float alpha); static unsigned char s_ColorBank[15][3]; ColorMap m_InstColorMap; ColorMap m_PercColorMap; std::vector m_beats_centers; ColorMap m_SingerColorMap; // UI settings float m_whiteKeyWidth = 18.0f; float m_blackKeyWidth = 14.0f; float m_whiteKeyHeight = 80.0f; float m_blackKeyHeight = 50.0f; float m_cornerSize = 3.0f; float m_whiteKeyPressedDelta = 3.0f; float m_blackKeyPressedDelta = 2.0f; float m_pressedLineWidth = 3.0f; float m_showTime = 1.0f; float m_meteorHalfWidth = 5.0f; float m_percussion_flash_size_factor = 0.15f; float m_percussion_flash_limit = 0.3f; float m_singing_half_width = 8.0f; }; ================================================ FILE: Meteor/SubListLookUp.h ================================================ #ifndef _SubListLookUp_h #define _SubListLookUp_h #include #include #include #include #include "blob.hpp" typedef std::vector SubList; class SubLists { public: float m_minStart; float m_maxEnd; float m_interval; std::vector m_subLists; SubLists() {} unsigned GetIntervalId(float v) const { if (v < m_minStart) return 0; unsigned id = (unsigned)((v - m_minStart) / m_interval); if (id >= (unsigned)m_subLists.size()) id = (unsigned)m_subLists.size() - 1; return id; } void SaveToFile(FILE* fp) const { fwrite(&m_minStart, sizeof(float), 3, fp); unsigned count = (unsigned)m_subLists.size(); fwrite(&count, sizeof(unsigned), 1, fp); for (unsigned i = 0; i < count; i++) { unsigned sub_count = (unsigned)m_subLists[i].size(); fwrite(&sub_count, sizeof(unsigned), 1, fp); fwrite(&m_subLists[i][0], sizeof(unsigned), sub_count, fp); } } void LoadFromFile(FILE* fp) { fread(&m_minStart, sizeof(float), 3, fp); unsigned count; fread(&count, sizeof(unsigned), 1, fp); m_subLists.clear(); m_subLists.resize(count); for (unsigned i = 0; i < count; i++) { unsigned sub_count; fread(&sub_count, sizeof(unsigned), 1, fp); m_subLists[i].resize(sub_count); fread(&m_subLists[i][0], sizeof(unsigned), sub_count, fp); } } void ToBlob(std::vector& blob) { blob_write(blob, &m_minStart, sizeof(float) * 3); unsigned count = (unsigned)m_subLists.size(); blob_write(blob, &count, sizeof(unsigned)); for (unsigned i = 0; i < count; i++) { unsigned sub_count = (unsigned)m_subLists[i].size(); blob_write(blob, &sub_count, sizeof(unsigned)); blob_write(blob, &m_subLists[i][0], sizeof(unsigned)*sub_count); } } template void SetData(const std::vector& fullList, float interval) { m_interval = interval; m_minStart = FLT_MAX; m_maxEnd = -FLT_MAX; if (fullList.size()==0) return; for (unsigned i = 0; i < (unsigned) fullList.size(); i++) { if (fullList[i].start < m_minStart) m_minStart = fullList[i].start; if (fullList[i].end> m_maxEnd) m_maxEnd = fullList[i].end; } unsigned numIntervals = (unsigned)ceilf((m_maxEnd - m_minStart) / interval); m_subLists.clear(); m_subLists.resize(numIntervals); for (unsigned i = 0; i < (unsigned)fullList.size(); i++) { unsigned startInterval = (unsigned)((fullList[i].start - m_minStart) / interval); unsigned endInterval = (unsigned)((fullList[i].end - m_minStart) / interval); if (endInterval >= numIntervals) endInterval = numIntervals - 1; for (unsigned j = startInterval; j <= endInterval; j++) { m_subLists[j].push_back(i); } } } }; #endif ================================================ FILE: Meteor/api.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API void* CtrlPntCreate(double freq, double fduration); SCOREDRAFT_API void CtrlPntDestroy(void* ptr); SCOREDRAFT_API void* SyllableCreate(const char* lyric, void* ptr_lst_ctrl_pnts); SCOREDRAFT_API void SyllableDestroy(void* ptr); SCOREDRAFT_API void EventDestroy(void* ptr); SCOREDRAFT_API void EventSetOffset(void* ptr, float offset); SCOREDRAFT_API void* EventInstCreate(unsigned instrument_id, double freq, float fduration); SCOREDRAFT_API void* EventPercCreate(unsigned instrument_id, float fduration); SCOREDRAFT_API void* EventSingCreate(unsigned instrument_id, void* ptr_syllable_list); SCOREDRAFT_API void* MeteorCreate0(); SCOREDRAFT_API void* MeteorCreate(void* ptr_event_list); SCOREDRAFT_API void MeteorDestroy(void* ptr); SCOREDRAFT_API void MeteorSaveToFile(void* ptr, const char* filename); SCOREDRAFT_API void MeteorLoadFromFile(void* ptr, const char* filename); SCOREDRAFT_API void MeteorPlay(void* ptr_meteor, void* ptr_track); SCOREDRAFT_API void* Base64Create(void* ptr_meteor); SCOREDRAFT_API void Base64Destroy(void* ptr); SCOREDRAFT_API const char* Base64Get(void* ptr); } #include "Meteor.h" void* CtrlPntCreate(double freq, double fduration) { return new CtrlPnt({ freq, fduration }); } void CtrlPntDestroy(void* ptr) { delete (CtrlPnt*)ptr; } void* SyllableCreate(const char* lyric, void* ptr_lst_ctrl_pnts) { std::vector* lst_ctrl_pnts = (std::vector*)ptr_lst_ctrl_pnts; Syllable* syllable = new Syllable; syllable->lyric = lyric; syllable->ctrlPnts.resize(lst_ctrl_pnts->size()); for (size_t i = 0; i < lst_ctrl_pnts->size(); i++) { syllable->ctrlPnts[i] = *(*lst_ctrl_pnts)[i]; } return syllable; } void SyllableDestroy(void* ptr) { delete (Syllable*)ptr; } void EventDestroy(void* ptr) { delete (Event*)ptr; } void EventSetOffset(void* ptr, float offset) { Event* e = (Event*)ptr; e->offset = offset; } void* EventInstCreate(unsigned instrument_id, double freq, float fduration) { return new EventInst(instrument_id, freq, fduration); } void* EventPercCreate(unsigned instrument_id, float fduration) { return new EventPerc(instrument_id, fduration); } void* EventSingCreate(unsigned instrument_id, void* ptr_syllable_list) { std::vector* syllable_list = (std::vector*)ptr_syllable_list; return new EventSing(instrument_id, syllable_list->size(), syllable_list->data()); } #include "DrawText.h" void* MeteorCreate0() { Text text("测试"); return new Meteor; } void* MeteorCreate(void* ptr_event_list) { std::vector* event_list = (std::vector*)ptr_event_list; return new Meteor(event_list->size(), event_list->data()); } void MeteorDestroy(void* ptr) { delete (Meteor*)ptr; } void MeteorSaveToFile(void* ptr, const char* filename) { Meteor* meteor = (Meteor*)ptr; meteor->SaveToFile(filename); } void MeteorLoadFromFile(void* ptr, const char* filename) { Meteor* meteor = (Meteor*)ptr; meteor->LoadFromFile(filename); } void MeteorPlay(void* ptr_meteor, void* ptr_track) { Meteor* meteor = (Meteor*)ptr_meteor; TrackBuffer* track = (TrackBuffer*)ptr_track; meteor->Play(track); } void* Base64Create(void* ptr_meteor) { Meteor* meteor = (Meteor*)ptr_meteor; std::string* base64 = new std::string; meteor->ToBase64(*base64); return base64; } void Base64Destroy(void* ptr) { delete (std::string*)ptr; } const char* Base64Get(void* ptr) { return ((std::string*)ptr)->c_str(); } ================================================ FILE: Meteor/base64.hpp ================================================ #pragma once #include #include #include #include inline void base64_encode(const std::vector& input, std::string& output) { static const char kEncodeLookup[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const char kPadCharacter = '='; output = ""; output.reserve(((input.size() / 3) + (input.size() % 3 > 0)) * 4); std::uint32_t temp{}; auto it = input.begin(); for(std::size_t i = 0; i < input.size() / 3; ++i) { temp = (*it++) << 16; temp += (*it++) << 8; temp += (*it++); output.append(1, kEncodeLookup[(temp & 0x00FC0000) >> 18]); output.append(1, kEncodeLookup[(temp & 0x0003F000) >> 12]); output.append(1, kEncodeLookup[(temp & 0x00000FC0) >> 6 ]); output.append(1, kEncodeLookup[(temp & 0x0000003F) ]); } switch(input.size() % 3) { case 1: temp = (*it++) << 16; output.append(1, kEncodeLookup[(temp & 0x00FC0000) >> 18]); output.append(1, kEncodeLookup[(temp & 0x0003F000) >> 12]); output.append(2, kPadCharacter); break; case 2: temp = (*it++) << 16; temp += (*it++) << 8; output.append(1, kEncodeLookup[(temp & 0x00FC0000) >> 18]); output.append(1, kEncodeLookup[(temp & 0x0003F000) >> 12]); output.append(1, kEncodeLookup[(temp & 0x00000FC0) >> 6 ]); output.append(1, kPadCharacter); break; } } ================================================ FILE: Meteor/blob.hpp ================================================ #pragma once #include #include #include #include inline void blob_write(std::vector& blob, const void* data, size_t size) { blob.resize(blob.size() + size); memcpy(blob.data() + blob.size() - size, data, size); } ================================================ FILE: PCMPlayer/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(PCMPlayer) set(SOURCES ../DSPUtil/complex.cpp ../DSPUtil/fft.cpp api.cpp PCMPlayer.cpp ) set(HEADERS ../DSPUtil/complex.h ../DSPUtil/fft.h PCMPlayer.h ) set (INCLUDE_DIR ../ScoreDraftCore ../DSPUtil ../thirdparty/portaudio/include ../thirdparty/glfw/include ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) add_library (PCMPlayer SHARED ${SOURCES} ${HEADERS}) target_link_libraries(PCMPlayer ScoreDraftCore portaudio_static glfw) if (WIN32) target_link_libraries(PCMPlayer opengl32) else() target_link_libraries(PCMPlayer GL) endif() if (WIN32) target_compile_definitions(PCMPlayer PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS PCMPlayer RUNTIME DESTINATION ScoreDraft) else() install(TARGETS PCMPlayer DESTINATION ScoreDraft) endif() ================================================ FILE: PCMPlayer/PCMPlayer.cpp ================================================ #include #include #include #include #include #include #include #include #include #include #include #include "PCMPlayer.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif class TrackBufferCopy { public: TrackBufferCopy(TrackBuffer& input) { m_AlignPos = input.AlignPos(); m_chn = input.NumberOfChannels(); unsigned size = input.NumberOfSamples(); m_data.resize(size*m_chn); float volume = input.AbsoluteVolume(); float pan = input.Pan(); for (unsigned i = 0; i < size; i++) { float sample[2]; input.Sample(i, sample); if (m_chn == 1) { m_data[i] = (short)(max(min(sample[0] * volume, 1.0f), -1.0f)*32767.0f); } else if (m_chn == 2) { CalcPan(pan, sample[0], sample[1]); m_data[2 * i] = (short)(max(min(sample[0] * volume, 1.0f), -1.0f)*32767.0f); m_data[2 * i + 1] = (short)(max(min(sample[1] * volume, 1.0f), -1.0f)*32767.0f); } } } ~TrackBufferCopy() { } std::vector m_data; unsigned m_AlignPos; unsigned m_chn; }; class TrackBufferQueue { public: TrackBufferQueue() { } ~TrackBufferQueue() { } size_t Size() { return m_queue.size(); } void Front2(TrackBufferCopy*& track0, TrackBufferCopy*& track1) { track0 = nullptr; track1 = nullptr; m_mutex.lock(); auto iter = m_queue.begin(); if (iter != m_queue.end()) { track0 = *iter; iter++; if (iter != m_queue.end()) { track1 = *iter; } } m_mutex.unlock(); } void Push(TrackBufferCopy* buf) { m_mutex.lock(); m_queue.push_back(buf); m_mutex.unlock(); } TrackBufferCopy* Pop() { m_mutex.lock(); TrackBufferCopy* ret = m_queue.front(); m_queue.pop_front(); m_mutex.unlock(); return ret; } private: std::list m_queue; std::mutex m_mutex; }; class AudioBufferQueue { public: AudioBufferQueue(int cache_size) : m_semaphore_in(cache_size) { } ~AudioBufferQueue() { } size_t Size() { return m_queue.size(); } AudioBuffer* Front() { return m_queue.front(); } void Push(AudioBuffer* packet) { m_semaphore_in.wait(); m_mutex.lock(); m_queue.push(packet); m_mutex.unlock(); m_semaphore_out.notify(); } AudioBuffer* Pop() { m_semaphore_out.wait(); m_mutex.lock(); AudioBuffer* ret = m_queue.front(); m_queue.pop(); m_mutex.unlock(); m_semaphore_in.notify(); return ret; } private: std::queue m_queue; std::mutex m_mutex; Semaphore m_semaphore_in; Semaphore m_semaphore_out; }; int PCMPlayer::stream_callback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, unsigned long statusFlags, void *userData) { PCMPlayer* self = (PCMPlayer*)userData; AudioBufferQueue* queue = self->m_audio_queue.get(); unsigned long pos_out = 0; short *out = (short*)outputBuffer; while (pos_out < framesPerBuffer) { if (queue->Size() < 1) break; AudioBuffer* buf_in = queue->Front(); size_t copy_size = min(AUDIO_BUF_LEN - self->m_audio_read_pos, framesPerBuffer - pos_out); memcpy(out + pos_out * 2, buf_in->data + self->m_audio_read_pos * 2, sizeof(short)*copy_size * 2); self->m_audio_read_pos += copy_size; pos_out += (unsigned long)copy_size; if (self->m_audio_read_pos == AUDIO_BUF_LEN) { self->m_audio_read_pos = 0; queue->Pop(); delete buf_in; } } if (pos_out < framesPerBuffer) memset(out + pos_out * 2, 0, sizeof(short) * (framesPerBuffer - pos_out) * 2); return paContinue; } void PCMPlayer::thread_demux(PCMPlayer* self) { TrackBufferQueue* queue_in = self->m_input_queue.get(); AudioBufferQueue* queue_out = self->m_audio_queue.get(); while (self->m_demuxing) { AudioBuffer* buf_out = new AudioBuffer; size_t pos_out = 0; while (pos_out < AUDIO_BUF_LEN) { TrackBufferCopy *buf_in, *buf_in2; queue_in->Front2(buf_in, buf_in2); if (buf_in == nullptr) break; size_t size_in = buf_in->m_data.size() / buf_in->m_chn; size_t copy_size = min(size_in - self->m_input_read_pos, AUDIO_BUF_LEN - pos_out); for (size_t i = 0; i < copy_size; i++) { size_t read_pos = self->m_input_read_pos + i; short value[2] = { 0,0 }; if (buf_in->m_chn == 1) { value[0] = value[1] = buf_in->m_data[read_pos]; } else if (buf_in->m_chn == 2) { value[0] = buf_in->m_data[read_pos * 2]; value[1] = buf_in->m_data[read_pos * 2 + 1]; } if (buf_in2 != nullptr && read_pos > size_in - buf_in2->m_AlignPos) { unsigned read_pos2 = (unsigned)read_pos - (unsigned)(size_in - buf_in2->m_AlignPos); short value2[2] = { 0,0 }; if (buf_in2->m_chn == 1) { value2[0] = value2[1] = buf_in2->m_data[read_pos2]; } else if (buf_in2->m_chn == 2) { value2[0] = buf_in2->m_data[read_pos2 * 2]; value2[1] = buf_in2->m_data[read_pos2 * 2 + 1]; } for (unsigned j = 0; j < 2; j++) { int v = (int)value[j] + (int)value2[j]; if (v > 32767) v = 32767; else if (v < -32767) v = -32767; value[j] = (short)v; } } size_t write_pos = pos_out + i; buf_out->data[write_pos * 2] = value[0]; buf_out->data[write_pos * 2 + 1] = value[1]; } pos_out += copy_size; self->m_mutex_progress.lock(); self->m_input_read_pos += copy_size; if (self->m_input_read_pos == size_in) { self->m_total_length -= buf_in->m_data.size() / buf_in->m_chn; if (buf_in2 != nullptr) { self->m_input_read_pos = buf_in2->m_AlignPos; } else { self->m_input_read_pos = 0; } self->m_mutex_progress.unlock(); queue_in->Pop(); delete buf_in; } else { self->m_mutex_progress.unlock(); } } if (pos_out < AUDIO_BUF_LEN) memset(buf_out->data + pos_out * 2, 0, sizeof(short) * (AUDIO_BUF_LEN - pos_out) * 2); self->m_ring_buf[self->m_next_buf] = *buf_out; self->m_next_buf = (self->m_next_buf + 1) % 12; queue_out->Push(buf_out); } } thread_local int PCMPlayer::s_instance_count = 0; PCMPlayer::PCMPlayer(double sample_rate, bool ui) : m_sample_rate(sample_rate) { if (s_instance_count == 0) Pa_Initialize(); s_instance_count++; m_input_queue = std::unique_ptr(new TrackBufferQueue); m_audio_queue = std::unique_ptr(new AudioBufferQueue(8)); m_demuxing = true; m_thread_demux = (std::unique_ptr)(new std::thread(thread_demux, this)); PaStreamParameters outputParameters = {}; outputParameters.device = Pa_GetDefaultOutputDevice(); outputParameters.channelCount = 2; outputParameters.sampleFormat = paInt16; outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; Pa_OpenStream(&m_stream, nullptr, &outputParameters, sample_rate, (unsigned long)(sample_rate*0.01), paClipOff, stream_callback, this); Pa_StartStream(m_stream); if (ui) { glfwInit(); m_window = glfwCreateWindow(640, 320, "ScoreDraft PCM Player", NULL, NULL); glfwMakeContextCurrent(m_window); glfwSwapInterval(1); glfwSetWindowUserPointer(m_window, this); glfwSetKeyCallback(m_window, key_callback); printf("Press 'W' to show waveform.\n"); printf("Press 'S' to show spectrum.\n"); } } PCMPlayer::~PCMPlayer() { if (m_window != nullptr) { glfwDestroyWindow(m_window); glfwTerminate(); } m_demuxing = false; Pa_StopStream(m_stream); Pa_CloseStream(m_stream); while (m_audio_queue->Size() > 0) { AudioBuffer* p = m_audio_queue->Pop(); delete p; } while (m_input_queue->Size() > 0) { TrackBufferCopy* p = m_input_queue->Pop(); delete p; } m_thread_demux->join(); m_thread_demux = nullptr; s_instance_count--; if (s_instance_count == 0) Pa_Terminate(); } void PCMPlayer::PlayTrack(TrackBuffer &track) { m_input_queue->Push(new TrackBufferCopy(track)); m_mutex_progress.lock(); m_total_length += track.NumberOfSamples(); m_mutex_progress.unlock(); } float PCMPlayer::GetRemainingTime() { m_mutex_progress.lock(); float remaining = (float)(m_total_length - m_input_read_pos) / (float)m_sample_rate; m_mutex_progress.unlock(); return remaining; } void PCMPlayer::draw() { int width, height; glfwGetFramebufferSize(m_window, &width, &height); glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glDisable(GL_DEPTH_TEST); switch (m_mode) { case Mode::WaveForm: { int start_buf = (m_next_buf + 10) % 12; for (int i = 0; i < 2; i++) { int buf_i = (start_buf + i) % 12; for (int j = 0; j < AUDIO_BUF_LEN; j++) { int k = i * AUDIO_BUF_LEN + j; m_wavaform_cache[k] = ((float)m_ring_buf[buf_i].data[j * 2] + (float)m_ring_buf[buf_i].data[j * 2 + 1]) / 65536.0f; } } glColor3f(1.0f, 1.0f, 0.0f); glBegin(GL_LINE_STRIP); for (int i = 0; i < AUDIO_BUF_LEN * 2; i++) { float x = (float)i / (float)(AUDIO_BUF_LEN * 2 - 1)*2.0f - 1.0f; float y = m_wavaform_cache[i]*0.75f; glVertex2f(x, y); } glEnd(); } break; case Mode::Spectrum: { int start_buf = (m_next_buf + 8) % 12; for (int i = 0; i < 4; i++) { int buf_i = (start_buf + i) % 12; for (int j = 0; j < AUDIO_BUF_LEN; j++) { int k = i * AUDIO_BUF_LEN + j; m_spectrum_cache[k] = ((float)m_ring_buf[buf_i].data[j * 2] + (float)m_ring_buf[buf_i].data[j * 2 + 1]) / 65536.0f; } } for (unsigned i = 0; i < 2048; i++) { float x = (float)((int)i - 1024) / 1024.0f; float win = 0.5f*(cosf(x*(float)PI) + 1.0f); m_fftData[i].Re = win * m_spectrum_cache[i]; m_fftData[i].Im = 0.0f; } fft(m_fftData, 11); for (unsigned i = 0; i < 100; i++) { float fstart = powf(2.0f, (float)i*0.1f); float fstop = powf(2.0f, (float)(i + 1)*0.1f); unsigned ustart = (unsigned)ceilf(fstart); unsigned ustop = (unsigned)ceilf(fstop); float ave = 0.0f; if (ustart == ustop) ave = DCAbs(&m_fftData[ustart]); else { for (unsigned j = ustart; j < ustop; j++) { ave += DCAbs(&m_fftData[j]); } ave /= (float)(ustop - ustart); } m_barv[i] = logf(ave*10.0f) / 10.0f; } glBegin(GL_QUADS); for (unsigned i = 0; i < 100.0f; i++) { float center = ((float)i + 0.5f) / 100.0f; float halfWidth = 0.4f / 100.0f; float left = center - halfWidth; float right = center + halfWidth; left = left * 2.0f - 1.0f; right = right * 2.0f - 1.0f; float bottom = -1.0f; float v = m_barv[i]; if (v > 1.0f) v = 1.0f; float top = v * 2.0f - 1.0f; glColor3f(0.5f, 1.0f, 0.0f); glVertex2f(right, bottom); glVertex2f(left, bottom); glColor3f(0.5f + 0.5f*v, 1.0f - v, 0.0f); glVertex2f(left, top); glVertex2f(right, top); } glEnd(); } break; } } void PCMPlayer::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { PCMPlayer* self = (PCMPlayer*)glfwGetWindowUserPointer(window); if (key == GLFW_KEY_W && action == GLFW_PRESS) { self->m_mode = Mode::WaveForm; } if (key == GLFW_KEY_S && action == GLFW_PRESS) { self->m_mode = Mode::Spectrum; } } void PCMPlayer::main_loop() { if (m_window == nullptr) return; while (glfwWindowShouldClose(m_window) == 0) { glfwMakeContextCurrent(m_window); draw(); glfwSwapBuffers(m_window); glfwPollEvents(); } } ================================================ FILE: PCMPlayer/PCMPlayer.h ================================================ #pragma once #include #include #include "fft.h" namespace std { class thread; } #define AUDIO_BUF_LEN 512 struct AudioBuffer { short data[AUDIO_BUF_LEN * 2]; }; class TrackBuffer; class TrackBufferQueue; class AudioBufferQueue; struct PaStreamCallbackTimeInfo; struct GLFWwindow; class PCMPlayer { public: PCMPlayer(double sample_rate = 44100.0, bool ui = false); ~PCMPlayer(); void PlayTrack(TrackBuffer &track); float GetRemainingTime(); // UI void main_loop(); private: static thread_local int s_instance_count; void *m_stream; static int stream_callback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, unsigned long statusFlags, void *userData); double m_sample_rate; std::unique_ptr m_input_queue; std::unique_ptr m_audio_queue; size_t m_input_read_pos = 0; size_t m_audio_read_pos = 0; size_t m_total_length = 0; std::mutex m_mutex_progress; bool m_demuxing = false; static void thread_demux(PCMPlayer* self); std::unique_ptr m_thread_demux; // UI GLFWwindow* m_window = nullptr; void draw(); static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods); enum class Mode { Spectrum, WaveForm }; Mode m_mode = Mode::WaveForm; int m_next_buf = 0; AudioBuffer m_ring_buf[12]; float m_wavaform_cache[AUDIO_BUF_LEN * 2]; float m_spectrum_cache[AUDIO_BUF_LEN * 4]; DComp m_fftData[2048]; float m_barv[100]; }; ================================================ FILE: PCMPlayer/api.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API void* PCMPlayerCreate(double sample_rate, unsigned ui); SCOREDRAFT_API void PCMPlayerDestroy(void* ptr); SCOREDRAFT_API void PlayTrack(void* ptr, void* ptr_track); SCOREDRAFT_API float GetRemainingTime(void* ptr); SCOREDRAFT_API void MainLoop(void* ptr); } #include "PCMPlayer.h" void* PCMPlayerCreate(double sample_rate, unsigned ui) { return new PCMPlayer(sample_rate, ui!=0); } void PCMPlayerDestroy(void* ptr) { PCMPlayer* player = (PCMPlayer*)ptr; delete player; } void PlayTrack(void* ptr, void* ptr_track) { PCMPlayer* player = (PCMPlayer*)ptr; TrackBuffer* track = (TrackBuffer*)ptr_track; player->PlayTrack(*track); } float GetRemainingTime(void* ptr) { PCMPlayer* player = (PCMPlayer*)ptr; return player->GetRemainingTime(); } void MainLoop(void* ptr) { PCMPlayer* player = (PCMPlayer*)ptr; player->main_loop(); } ================================================ FILE: README.md ================================================ [-> 中文Readme](README_cn.md) # ScoreDraft ScoreDraft is a music/singing synthesizer that provides a Python based score authoring interface. Currently, it includes the following synthesizer engines: * Instrumental - SimpleInstruments: simple mathematic functions like sine-waves - KarplusStrong: guitar simulator using pure algorithm - BasicSamplers: tones generated by sampling one or multiple waveform samples - SoundFont2 * Percussion - BasicSamplers - SoundFont2 (GM Drums) * Voice - VoiceSampler: a PSOLA-like algorithm is used to sample voice samples. A front-end "UtauDraft" is provided making it compatible to existing UTAU voice banks. The framework is open and can be easily extended. A PCM Player is provided to playback and visualize generated waveforms. A more sophisticated visualizer "Meteor" is provided to visualize the notes/beats/syllables where the music is generated from. The following example shows how easily a piece of musical sound can be generated using ScoreDraft. ```Python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.Document() seq=[do(),do(),so(),so(),la(),la(),so(5,96)] doc.playNoteSeq(seq, ScoreDraft.Piano()) doc.mixDown('twinkle.wav') ``` Starting from version 1.0.3, ScoreDraft now supports a YAML based input format, which looks like: ```yaml # test.yaml score: staffs: - relative: c'' instrument: Piano() content: | c4 c g g a a g2 ``` where in the 'content' part, LilyPond syntax can be used to input notes. The following shell command can be used to generate a wav: ``` # scoredraft -wav twinkle.wav test.yaml ``` For GUI editor, see [ScoreDraftEditor](https://github.com/fynv/ScoreDraftEditor) For more detailed introduction and demos see: [https://fynv.github.io/ScoreDraft/](https://fynv.github.io/ScoreDraft/) ## Installation ScoreDraft is now available from PyPi. Windows x64/Linux x64 supported. ``` # pip install scoredraft ``` Known issue: For Linux, it is only tested on Ubuntu 20.04. It is known to be not working on Ubuntu 18.04. ## Building Build-time dependencies: * CMake 3.0+ * Python3 * CUDA(optional): To build without CUDA, disable the CMake option "USE_CUDA" * FreeType: - Library included for Windows - Ubuntu: sudo apt install libfreetype-dev * GLFW: - Source code included - Ubuntu: sudo apt install libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev * PortAudio: - Source code included - Ubuntu: sudo apt-get install libasound-dev libjack-dev Build process: ``` # mkdir build # cd build # cmake .. -DCMAKE_INSTALL_PREFIX=../Test # make # make install ``` Run-time dependencies: * Python3 * cffi * X-org, ALSA drivers are optionally needed for players * xsdata, python_ly are optionally needed for MusicXML and LilyPond support * pyyaml is optionally needed for YAML support ## Samples & Voice Banks To avoid causing troubles, ScoreDraft now only includes a minimal set of instrumental/percussion samples to support the tests. The PyPi package doesn't include any of these. ScoreDraft indexes the samples and banks by searching specific directory where the python script is started. * Directory InstrumentSamples: wav instrument samples - There can be sub-directories containing multiple wav samples defining a single instrument for different pitch ranges. - Optionally, a freq file can be provided to define the frequency of the sample tone. * Directory PercussionSamples: wav percussion samples * Directory SF2: SoundFont2 bank files * Directory UTAUVoice: UTAU voice banks (as sub-directories) Users need to help themselves to download and organize extra samples and voicebanks. Here are just some recommandations, which is what I do at my place. * Instrument/Percussion wav samples: - https://freewavesamples.com * SoundFont2 Instruments - Arachno: http://www.arachnosoft.com/main/download.php?id=soundfont-sf2 - SynthFontViena: http://www.synthfont.com/ * UTAU - uta(Japanese): default voice-bank that comes with UTAU - TetoEng(English): https://kasaneteto.jp/en/voicebank.html - Ayaka(Chinese): https://bowlroll.net/file/53297 - Ayaka2 (Japanese): https://bowlroll.net/file/69898 - WanEr(Chinese): http://lindayana.lofter.com/waner ## License ScoreDraft is now formally available under [MIT license](https://choosealicense.com/licenses/mit/). ## Version History ScoreDraft was my first Python project. There were some severe limitations for pythonic packaging and releasing. As a result, there was no formal release before the Nov 2021 refactoring (version 1.0.0). [SingingGadgets](https://pypi.org/project/singinggadgets/) was a refactoring attempt in 2018, which only partially solves the issues. After the Nov 2021 refactoring, ScoreDraft have all the benefits of both SingingGadgets and the old ScoreDraft. Therefore, the SingingGadgets project is now closed. * Dec 17, 2021. ScoreDraft 1.0.11, fix slur handling * Dec 12, 2021. ScoreDraft 1.0.10, support track volume for YAML input * Dec 12, 2021. ScoreDraft 1.0.8 & 1.0.9, bug fix * Dec 04, 2021. ScoreDraft 1.0.7, percussion visualization bug fix * Dec 01, 2021. ScoreDraft 1.0.6, expose more low-level functions * Nov 29, 2021. ScoreDraft 1.0.4, 1.0.5, YAML function updates * Nov 27, 2021. ScoreDraft 1.0.3, adding a YAML based input routine support * Nov 24, 2021. ScoreDraft 1.0.2, adding MusicXML & LilyPond support * Nov 19, 2021. ScoreDraft 1.0.0 & 1.0.1 * Jun 16, 2018. SingingGadgets 0.0.3 ================================================ FILE: README_cn.md ================================================ # ScoreDraft ScoreDraft 是一个音乐和歌唱合成系统,它提供了基于Python的乐谱创作(或录入)界面。 目前,它集成了下列几种合成引擎: * 乐器合成 - SimpleInstruments: 基于简单数学函数,如正弦波 - KarplusStrong: 基于纯算法的吉他模拟器 - BasicSamplers: 由单个或多个波形文件采样生成音符 - SoundFont2 * 打击乐合成 - BasicSamples - SoundFont2 (GM 鼓轨) * 语音合成 - VoiceSampler: 采用类PSOLA的算法采样语音样本,提供了名为UtauDraft的前端来兼容UTAU音源 系统框架是开放的,极易扩展。 PCMPlayer 提供了一个简单的音频播放和可视化工具。 Meteor 提供了更高级的可视化功能,可以可视化用来生成音乐的音符和音节输入。 下面这个例子展示了通过ScoreDraft来合成一小段音乐可以多么简单。 ```Python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.Document() seq=[do(),do(),so(),so(),la(),la(),so(5,96)] doc.playNoteSeq(seq, ScoreDraft.Piano()) doc.mixDown('twinkle.wav') ``` 从版本 1.0.3 开始,ScoreDraft 支持一种基于 YAML 的输入格式,例如: ```yaml # test.yaml score: staffs: - relative: c'' instrument: Piano() content: | c4 c g g a a g2 ``` 其中 content 部分使用 LilyPond 的语法。可以使用以下命令把 YAML 文件合成为wav: ``` # scoredraft -wav twinkle.wav test.yaml ``` 另有图形界面的编辑器, 详见:[ScoreDraftEditor](https://github.com/fynv/ScoreDraftEditor) 更详细的使用说明和演示见: [https://fynv.github.io/ScoreDraft/](https://fynv.github.io/ScoreDraft/) ## 安装 ScoreDraft 现在可以由 PyPi 安装,支持64位的 Windows 和 Linux 系统。 ``` # pip install scoredraft ``` 已知问题:Linux方面只在Ubuntu20.04测试通过,已知在Ubuntu18.04上有问题。 ## 编译 编译期依赖: * CMake 3.0+ * Python3 * CUDA(可选): 如果没有CUDA可以去掉 CMake 的 "USE_CUDA" 选项 * FreeType: - 已包含Windows开发库 - Ubuntu: sudo apt install libfreetype-dev * GLFW: - 已包含源代码 - Ubuntu: sudo apt install libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev * PortAudio: - 已包含源代码 - Ubuntu: sudo apt-get install libasound-dev libjack-dev 编译过程: ``` # mkdir build # cd build # cmake .. -DCMAKE_INSTALL_PREFIX=../Test # make # make install ``` 运行期依赖: * Python3 * cffi * 播放器依赖于X.org和ALSA驱动 * MusicXML 和 LilyPond 支持依赖于 xsdata, python_ly * YAML 支持依赖于 pyyaml ## 采样和语音音源 为了避免麻烦,ScoreDraft 目前只包含最低限度的乐器和打击乐采样用来测试。PyPi安装的版本则不提供任何这些文件。 ScoreDraft 基于 Python 脚本的启动位置来搜索特定目录,以此建立乐器样本和语音音源的索引。 * InstrumentSamples 目录:wav 乐器样本 - 可以包含子目录,每个子目录包含多个wav文件,共同来定义一个乐器的不同音高范围。 - 对每个wav文件,可以有一个对应的freq文件来定义采样的音高 * PercussionSamples 目录:wav 打击乐样本 * SF2 目录:SoundFont2 乐器库文件 * UTAUVoice:UTAU 语音音源库,每个库一个子目录 用户需要自行下载和布署这些音源。以下推荐几个作者自己在用的音源。 * wav 乐器采样: - https://freewavesamples.com * SoundFont2 乐器库 - Arachno: http://www.arachnosoft.com/main/download.php?id=soundfont-sf2 - SynthFontViena: http://www.synthfont.com/ - * UTAU - uta(Japanese): default voice-bank that comes with UTAU - TetoEng(English): https://kasaneteto.jp/en/voicebank.html - Ayaka(Chinese): https://bowlroll.net/file/53297 - Ayaka2 (Japanese): https://bowlroll.net/file/69898 - WanEr(Chinese): http://lindayana.lofter.com/waner ## 版权协议 ScoreDraft 目前已正式基于MIT协议授权。 ## 版本历史 ScoreDraft 实际上是我的第一个Python项目,由于一些设计问题,长期以来ScoreDraft无法用常规的Python流程来打包和发布。 直到2021年11月的这次重构,ScoreDraft才有了第一个正式版本。 在2018年曾经做过一次重构尝试,叫做[SingingGadgets](https://pypi.org/project/singinggadgets/),只部分解决了问题。 在2021年11月的重构之后,ScoreDraft已经具有SingingGadgets和早期ScoreDraft的全部优点,因此SingingGadgets项目现已被关闭。 * 2021年12月17日. ScoreDraft 1.0.11 修正连音线处理 * 2021年12月12日. ScoreDraft 1.0.10 YAML输入支持音轨volume * 2021年12月12日. ScoreDraft 1.0.8 & 1.0.9 修正bug * 2021年12月04日. ScoreDraft 1.0.7 修正打击乐可视化bug * 2021年12月01日. ScoreDraft 1.0.6 暴露更多底层函数 * 2021年11月29日. ScoreDraft 1.0.4, 1.0.5 更新YAML功能 * 2021年11月27日. ScoreDraft 1.0.3 增加了一个基于YAML的乐谱输入方案 * 2021年11月24日, ScoreDraft 1.0.2 加入对MusicXML和LilyPond的支持 * 2021年11月19日. ScoreDraft 1.0.0 & 1.0.1 * 2018年06月16日. SingingGadgets 0.0.3 ================================================ FILE: ScoreDraftCore/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(ScoreDraftCore) set(SOURCES api.cpp TrackBuffer.cpp ReadWav.cpp WriteWav.cpp ) set(HEADERS api.h utils.h WavBuffer.h TrackBuffer.h ReadWav.h WriteWav.h ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() add_definitions(${DEFINES}) add_library (ScoreDraftCore SHARED ${SOURCES} ${HEADERS}) if (WIN32) target_compile_definitions(ScoreDraftCore PRIVATE SCOREDRAFTCORE_DLL_EXPORT) endif() if (WIN32) install(TARGETS ScoreDraftCore RUNTIME DESTINATION ScoreDraft) else() install(TARGETS ScoreDraftCore DESTINATION ScoreDraft) endif() ================================================ FILE: ScoreDraftCore/ReadWav.cpp ================================================ #include "ReadWav.h" #include #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif struct WavHeader { unsigned short wFormatTag; unsigned short wChannels; unsigned int dwSamplesPerSec; unsigned int dwAvgBytesPerSec; unsigned short wBlockAlign; unsigned short wBitsPerSample; }; ReadWav::ReadWav() { m_fp = nullptr; } ReadWav::~ReadWav() { if (m_fp) fclose(m_fp); } bool ReadWav::OpenFile(const char* filename) { if (m_fp) fclose(m_fp); m_fp = fopen(filename, "rb"); return (m_fp != nullptr); } void ReadWav::CloseFile() { if (m_fp) fclose(m_fp); m_fp = nullptr; } bool ReadWav::ReadHeader(unsigned& sampleRate, unsigned& numSamples, unsigned& chn) { if (!m_fp) return false; char c_riff[4] = { 'R', 'I', 'F', 'F' }; unsigned& u_riff = *(unsigned*)c_riff; char c_wave[4] = { 'W', 'A', 'V', 'E' }; unsigned& u_wave = *(unsigned*)c_wave; char c_fmt[4] = { 'f', 'm', 't', ' ' }; unsigned& u_fmt = *(unsigned*)c_fmt; char c_data[4] = { 'd', 'a', 't', 'a' }; unsigned& u_data = *(unsigned*)c_data; unsigned buf32; fread(&buf32, 4, 1, m_fp); if (buf32 != u_riff) { fclose(m_fp); return false; } unsigned chunkSize; fread(&chunkSize, 4, 1, m_fp); fread(&buf32, 4, 1, m_fp); if (buf32 != u_wave) { fclose(m_fp); return false; } fread(&buf32, 4, 1, m_fp); if (buf32 != u_fmt) { fclose(m_fp); return false; } unsigned headerSize; unsigned skipSize = 0; unsigned skipBuffer; fread(&headerSize, 4, 1, m_fp); if (headerSize < sizeof(WavHeader)) { fclose(m_fp); return false; } else if (headerSize > sizeof(WavHeader)) { if (headerSize - sizeof(WavHeader) > 4) { fclose(m_fp); return false; } skipSize = headerSize - sizeof(WavHeader); } WavHeader header; fread(&header, sizeof(WavHeader), 1, m_fp); if (skipSize > 0) { fread(&skipBuffer, 1, skipSize, m_fp); } if (header.wFormatTag != 1) { fclose(m_fp); return false; } chn = header.wChannels; if (chn<1 || chn>2) { fclose(m_fp); return false; } sampleRate = header.dwSamplesPerSec; if (header.wBitsPerSample != 16) { fclose(m_fp); return false; } fread(&buf32, 4, 1, m_fp); if (buf32 != u_data) { fclose(m_fp); return false; } unsigned dataSize; fread(&dataSize, 4, 1, m_fp); numSamples = dataSize / chn / 2; m_totalSamples = numSamples; m_num_channels = chn; m_readSamples = 0; return true; } bool ReadWav::ReadSamples(float* samples, unsigned count, float& max_v) { if (!m_fp) return false; count = min(count, m_totalSamples - m_readSamples); if (count > 0) { short* data = new short[count*m_num_channels]; fread(data, sizeof(short), count*m_num_channels, m_fp); max_v = 0.0f; for (unsigned i = 0; i < count*m_num_channels; i++) { float v = (float)data[i] / 32767.0f; samples[i] = v; max_v = max(max_v, fabsf(v)); } delete[] data; m_readSamples += count; } if (m_totalSamples - m_readSamples <= 0) CloseFile(); return true; } ================================================ FILE: ScoreDraftCore/ReadWav.h ================================================ #ifndef _ReadWav_h #define _ReadWav_h #include class ReadWav { public: ReadWav(); ~ReadWav(); bool OpenFile(const char* filename); void CloseFile(); bool ReadHeader(unsigned &sampleRate, unsigned &numSamples, unsigned& chn); bool ReadSamples(float* samples, unsigned count, float& maxv); private: FILE* m_fp; unsigned m_totalSamples; unsigned m_num_channels; unsigned m_readSamples; }; #endif ================================================ FILE: ScoreDraftCore/TrackBuffer.cpp ================================================ #include #include #include #include "TrackBuffer.h" #include "utils.h" static const unsigned s_localBufferSize = 65536; unsigned TrackBuffer::GetLocalBufferSize() { return s_localBufferSize; } TrackBuffer::TrackBuffer(unsigned rate, unsigned chn) : m_rate(rate) { if (chn < 1) { chn = 1; } else if (chn > 2) { chn = 2; } m_chn = chn; m_fp = tmpfile(); m_localBuffer = new float[s_localBufferSize*m_chn]; m_localBufferPos = (unsigned)(-1); m_volume = 1.0f; m_pan = 0.0f; m_cursor = 0.0f; m_length = 0; m_alignPos = (unsigned)(-1); } TrackBuffer::~TrackBuffer() { delete m_localBuffer; fclose(m_fp); } void TrackBuffer::_seek(unsigned upos) { if (upos <= m_length) { fseek(m_fp, (long)(sizeof(float)*upos*m_chn), SEEK_SET); } else { fseek(m_fp, 0, SEEK_END); float *tmp = new float[(upos - m_length)*m_chn]; memset(tmp, 0, (upos - m_length)*m_chn * sizeof(float)); fwrite(tmp, sizeof(float), (upos - m_length)*m_chn, m_fp); delete[] tmp; m_length = upos; } } float TrackBuffer::GetCursor() { return m_cursor; } void TrackBuffer::SetCursor(float fpos) { if (m_alignPos == (unsigned)(-1)) m_alignPos = 0; m_cursor = fpos; if (m_cursor < 0.0f) m_cursor = 0.0f; } void TrackBuffer::MoveCursor(float delta) { SetCursor(m_cursor + delta); } void TrackBuffer::SeekToCursor() { unsigned upos = (unsigned)_ms2sample(m_cursor); _seek(upos); } void TrackBuffer::_writeSamples(unsigned count, const float* samples, unsigned alignPos) { unsigned upos = (unsigned)_ms2sample(m_cursor) + m_alignPos - alignPos; _seek(upos); fwrite(samples, sizeof(float), count*m_chn, m_fp); m_length = max(m_length, upos + count); m_localBufferPos = -1; } void TrackBuffer::WriteBlend(const WavBuffer& wavBuf) { assert(wavBuf.m_sampleRate == m_rate); unsigned count = (unsigned)wavBuf.m_sampleNum; unsigned src_chn = wavBuf.m_channelNum; float* samples = wavBuf.m_data; unsigned note_alignPos = wavBuf.m_alignPos; float volume = wavBuf.m_volume; if (m_alignPos == (unsigned)(-1)) { m_alignPos = note_alignPos; } if ((unsigned)_ms2sample(m_cursor) + m_alignPos < note_alignPos) { unsigned truncate = note_alignPos - (unsigned)_ms2sample(m_cursor) + m_alignPos; count -= truncate; samples += truncate * src_chn; note_alignPos -= truncate; } unsigned upos = (unsigned)_ms2sample(m_cursor) + m_alignPos - note_alignPos; float *tmpSamples = new float[count*m_chn]; for (unsigned i = 0; i < count; i++) { float sample_l; float sample_r; if (src_chn == 1) { sample_l = sample_r = samples[i]; } else if (src_chn == 2) { sample_l = samples[i * 2]; sample_r = samples[i * 2 + 1]; } if (m_chn == 1) { tmpSamples[i] = (sample_l + sample_r)*0.5f * volume; } else if (m_chn == 2) { CalcPan(wavBuf.m_pan, sample_l, sample_r); tmpSamples[i * 2] = sample_l * volume; tmpSamples[i * 2 + 1] = sample_r * volume; } } if (upos < m_length) { unsigned sec = min(count, m_length - upos); float* secbuf = new float[sec * m_chn]; _seek(upos); fread(secbuf, sizeof(float), sec*m_chn, m_fp); for (unsigned i = 0; i < sec*m_chn; i++) tmpSamples[i] += secbuf[i]; delete[] secbuf; } _writeSamples(count, tmpSamples, note_alignPos); delete[] tmpSamples; } void TrackBuffer::Sample(unsigned index, float* sample) { if (index >= m_length) { for (unsigned c = 0; c < m_chn; c++) sample[c] = 0.0f; } if (m_localBufferPos == (unsigned)(-1) || m_localBufferPos > index || m_localBufferPos + s_localBufferSize <= index) { m_localBufferPos = (index / s_localBufferSize)*s_localBufferSize; memset(m_localBuffer, 0, sizeof(float)*s_localBufferSize*m_chn); if (m_localBufferPos < m_length) { fseek(m_fp, m_localBufferPos * sizeof(float)*m_chn, SEEK_SET); fread(m_localBuffer, sizeof(float), min(s_localBufferSize, m_length - m_localBufferPos)*m_chn, m_fp); } } unsigned readPos = index - m_localBufferPos; for (unsigned c = 0; c < m_chn; c++) sample[c] = m_localBuffer[readPos * m_chn + c]; } float TrackBuffer::MaxValue() { unsigned i; float buf[2]; Sample(0, buf); float maxValue; if (m_chn == 1) maxValue = fabsf(buf[0]); else if (m_chn == 2) maxValue = max(fabsf(buf[0]), fabsf(buf[1])); for (i = 1; i < m_length; i++) { Sample(i, buf); float _max; if (m_chn == 1) _max = fabsf(buf[0]); else if (m_chn == 2) _max = max(fabsf(buf[0]), fabsf(buf[1])); maxValue = max(maxValue, _max); } return maxValue; } void TrackBuffer::GetSamples(unsigned startIndex, unsigned length, float* buffer) { while (length > 0) { if (startIndex >= m_length) break; if (m_localBufferPos == (unsigned)(-1) || m_localBufferPos > startIndex || m_localBufferPos + s_localBufferSize <= startIndex) { m_localBufferPos = (startIndex / s_localBufferSize)*s_localBufferSize; memset(m_localBuffer, 0, sizeof(float)*s_localBufferSize*m_chn); if (m_localBufferPos < m_length) { fseek(m_fp, m_localBufferPos * sizeof(float)*m_chn, SEEK_SET); fread(m_localBuffer, sizeof(float), min(s_localBufferSize, m_length - m_localBufferPos)*m_chn, m_fp); } } unsigned readLength = min(length, m_localBufferPos + s_localBufferSize - startIndex); memcpy(buffer, m_localBuffer + (startIndex - m_localBufferPos)*m_chn, sizeof(float)* readLength*m_chn); startIndex += readLength; length -= readLength; buffer += readLength; } } bool TrackBuffer::CombineTracks(unsigned num, TrackBuffer** tracks) { WavBuffer targetBuffer; targetBuffer.Allocate(m_chn, s_localBufferSize); unsigned *lengths = new unsigned[num]; int* sourcePos = new int[num]; float* trackVolumes = new float[num]; float* trackPans = new float[num]; // scan unsigned i; float maxCursor = 0.0f; unsigned maxAlign = 0; for (i = 0; i < num; i++) { if (tracks[i]->Rate() != m_rate) { delete[] trackPans; delete[] trackVolumes; delete[] sourcePos; delete[] lengths; return false; } lengths[i] = tracks[i]->NumberOfSamples(); float cursor = tracks[i]->GetCursor(); if (cursor > maxCursor) maxCursor = cursor; unsigned align = tracks[i]->AlignPos(); if (align != (unsigned)(-1) && align > maxAlign) maxAlign = align; sourcePos[i] = (int)(align); trackVolumes[i] = tracks[i]->AbsoluteVolume(); trackPans[i] = tracks[i]->Pan(); } for (i = 0; i < num; i++) { sourcePos[i] -= (int)maxAlign; } maxCursor += m_cursor; bool finish = false; while (!finish) { finish = true; memset(targetBuffer.m_data, 0, sizeof(float)*s_localBufferSize*m_chn); unsigned maxCount = 0; for (i = 0; i < num; i++) { if ((int)lengths[i] > sourcePos[i]) { int count = min(s_localBufferSize, (int)lengths[i] - sourcePos[i]); maxCount = (unsigned)max(count, (int)maxCount); int j; for (j = 0; j < count; j++) { if ((int)j + sourcePos[i] > 0) { float samples[2]; tracks[i]->Sample((unsigned)((int)j + sourcePos[i]), samples); float sample_l; float sample_r; if (tracks[i]->m_chn == 1) { sample_l = sample_r = samples[0]; } else if (tracks[i]->m_chn == 2) { sample_l = samples[0]; sample_r = samples[1]; } if (m_chn == 1) { targetBuffer.m_data[j] += (sample_l + sample_r)*0.5f* trackVolumes[i]; } else if (m_chn == 2) { CalcPan(trackPans[i], sample_l, sample_r); targetBuffer.m_data[j * 2] += sample_l * trackVolumes[i]; targetBuffer.m_data[j * 2 + 1] += sample_r * trackVolumes[i]; } } } sourcePos[i] += count; if ((int)lengths[i] > sourcePos[i]) finish = false; } } targetBuffer.m_sampleNum = maxCount; targetBuffer.m_alignPos = maxAlign; WriteBlend(targetBuffer); MoveCursor((float)(maxCount - maxAlign) / m_rate * 1000.0f); maxAlign = 0; } SetCursor(maxCursor); delete[] trackPans; delete[] trackVolumes; delete[] sourcePos; delete[] lengths; return true; } ================================================ FILE: ScoreDraftCore/TrackBuffer.h ================================================ #pragma once #include #include #include "WavBuffer.h" class SCOREDRAFTCORE_API TrackBuffer { public: TrackBuffer(unsigned rate = 44100, unsigned chn = 1); ~TrackBuffer(); unsigned Rate() const { return m_rate; } void SetRate(unsigned rate) { m_rate = rate; } unsigned NumberOfChannels() const { return m_chn; } unsigned NumberOfSamples() { return m_length; } unsigned AlignPos() { return m_alignPos; } float Volume() const { return m_volume; } float AbsoluteVolume() { float maxValue = MaxValue(); return maxValue > 0.0f ? m_volume / maxValue : 1.0f; } void SetVolume(float vol) { m_volume = vol; } float Pan() const { return m_pan; } void SetPan(float pan) { m_pan = pan; } float GetCursor(); void SetCursor(float fpos); void MoveCursor(float delta); void SeekToCursor(); void WriteBlend(const WavBuffer& wavBuf); void Sample(unsigned index, float* sample); float MaxValue(); void GetSamples(unsigned startIndex, unsigned length, float* buffer); bool CombineTracks(unsigned num, TrackBuffer** tracks); unsigned GetLocalBufferSize(); private: FILE *m_fp; unsigned m_rate; unsigned m_chn; float m_volume; float m_pan; float *m_localBuffer; unsigned m_localBufferPos; unsigned m_length; unsigned m_alignPos; float m_cursor; inline float _ms2sample(float ms) { return ms * 0.001f*m_rate; } void _writeSamples(unsigned count, const float* samples, unsigned alignPos); void _seek(unsigned upos); }; ================================================ FILE: ScoreDraftCore/WavBuffer.h ================================================ #pragma once #include "api.h" #include class SCOREDRAFTCORE_API WavBuffer { std::vector _data; public: WavBuffer() : p_data(&_data) { } void Allocate(unsigned channelNum, size_t sampleNum) { m_channelNum = channelNum; m_sampleNum = sampleNum; p_data->resize(sampleNum * channelNum); m_data = &(*p_data)[0]; } float m_sampleRate = 44100.0f; unsigned m_channelNum = 1; size_t m_sampleNum = 0; std::vector* p_data; float* m_data = nullptr; unsigned m_alignPos = 0; float m_volume = 1.0f; float m_pan = 0.0f; }; ================================================ FILE: ScoreDraftCore/WriteWav.cpp ================================================ #include "WriteWav.h" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif struct WavHeader { unsigned short wFormatTag; unsigned short wChannels; unsigned int dwSamplesPerSec; unsigned int dwAvgBytesPerSec; unsigned short wBlockAlign; unsigned short wBitsPerSample; }; WriteWav::WriteWav() { m_fp = nullptr; } WriteWav::~WriteWav() { if (m_fp) fclose(m_fp); } bool WriteWav::OpenFile(const char* filename) { if (m_fp) fclose(m_fp); m_fp = fopen(filename, "wb"); return m_fp != nullptr; } void WriteWav::CloseFile() { if (m_fp) fclose(m_fp); m_fp = nullptr; } void WriteWav::WriteHeader(unsigned sampleRate, unsigned numSamples, unsigned chn) { if (!m_fp) return; unsigned dataSize = numSamples * chn * sizeof(short); unsigned int adWord; WavHeader header; fwrite("RIFF", 1, 4, m_fp); adWord = dataSize + 20 + sizeof(WavHeader); fwrite(&adWord, 4, 1, m_fp); fwrite("WAVEfmt ", 1, 8, m_fp); adWord = 0x00000010; fwrite(&adWord, 4, 1, m_fp); header.wFormatTag = 1; header.wChannels = chn; header.dwSamplesPerSec = sampleRate; header.dwAvgBytesPerSec = sampleRate *chn* sizeof(short); header.wBlockAlign = chn* sizeof(short); header.wBitsPerSample = 16; fwrite(&header, sizeof(WavHeader), 1, m_fp); fwrite("data", 1, 4, m_fp); adWord = dataSize; fwrite(&adWord, 4, 1, m_fp); m_totalSamples = numSamples; m_num_channels = chn; m_writenSamples = 0; } inline void CalcPan(float pan, float& l, float& r) { if (pan == 0.0f) return; else if (pan < 0.0f) { pan = -pan; float ll = l; float rl = r*pan; float rr = r*(1.0f - pan); l = ll + rl; r = rr; } else { float ll = l*(1.0f - pan); float lr = l*pan; float rr = r; l = ll; r = lr + rr; } } void WriteWav::WriteSamples(const float* samples, unsigned count, float volume, float pan) { if (!m_fp) return; count = min(count, m_totalSamples - m_writenSamples); if (count > 0) { short* data = new short[count*m_num_channels]; unsigned i; for (i = 0; i < count; i++) { float sample[2]; for (unsigned c = 0; c < m_num_channels; c++) sample[c] = samples[i*m_num_channels+c]; if (m_num_channels == 2) CalcPan(pan, sample[0], sample[1]); for (unsigned c = 0; c < m_num_channels; c++) data[i*m_num_channels + c] = (short)(max(min(sample[c] * volume, 1.0f), -1.0f)*32767.0f); } fwrite(data, sizeof(short), count*m_num_channels, m_fp); delete[] data; m_writenSamples += count; } if (m_totalSamples - m_writenSamples<=0) CloseFile(); } ================================================ FILE: ScoreDraftCore/WriteWav.h ================================================ #ifndef _WriteWav_h #define _WriteWav_h #include class WriteWav { public: WriteWav(); ~WriteWav(); bool OpenFile(const char* filename); void CloseFile(); void WriteHeader(unsigned sampleRate, unsigned numSamples, unsigned chn=1); void WriteSamples(const float* samples, unsigned count, float volume=1.0f, float pan=0.0f); private: FILE* m_fp; unsigned m_totalSamples; unsigned m_num_channels; unsigned m_writenSamples; }; #endif ================================================ FILE: ScoreDraftCore/api.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { // general SCOREDRAFT_API void* PtrArrayCreate(unsigned long long size, const void** ptrs); SCOREDRAFT_API void PtrArrayDestroy(void* ptr_arr); // F32Buf SCOREDRAFT_API void* F32BufCreate(unsigned long long size, float value); SCOREDRAFT_API void F32BufDestroy(void* ptr); SCOREDRAFT_API float* F32BufData(void* ptr); SCOREDRAFT_API int F32BufSize(void* ptr); SCOREDRAFT_API void F32BufToS16(void* ptr, short* dst, float amplitude); SCOREDRAFT_API void F32BufFromS16(void* ptr, const short* data, unsigned long long size); SCOREDRAFT_API float F32BufMaxValue(void* ptr); SCOREDRAFT_API void F32BufMix(void* ptr, void* ptr_lst); // WavBuffer SCOREDRAFT_API void* WavBufferCreate(float sampleRate, unsigned channelNum, void* ptr_data, unsigned alignPos, float volume, float pan); SCOREDRAFT_API void WavBufferDestroy(void *ptr); SCOREDRAFT_API float WavBufferGetSampleRate(void* ptr); SCOREDRAFT_API unsigned WavBufferGetChannelNum(void *ptr); SCOREDRAFT_API unsigned long long WavBufferGetSampleNum(void *ptr); SCOREDRAFT_API unsigned WavBufferGetAlignPos(void* ptr); SCOREDRAFT_API void WavBufferSetAlignPos(void* ptr, unsigned alignPos); SCOREDRAFT_API float WavBufferGetVolume(void* ptr); SCOREDRAFT_API void WavBufferSetVolume(void* ptr, float volume); SCOREDRAFT_API float WavBufferGetPan(void* ptr); SCOREDRAFT_API void WavBufferSetPan(void* ptr, float pan); // TrackBuffer SCOREDRAFT_API void* TrackBufferCreate(unsigned chn); SCOREDRAFT_API void TrackBufferDestroy(void* ptr); SCOREDRAFT_API void TrackBufferSetVolume(void* ptr, float volume); SCOREDRAFT_API float TrackBufferGetVolume(void* ptr); SCOREDRAFT_API void TrackBufferSetPan(void* ptr, float pan); SCOREDRAFT_API float TrackBufferGetPan(void* ptr); SCOREDRAFT_API unsigned TrackBufferGetNumberOfSamples(void* ptr); SCOREDRAFT_API unsigned TrackBufferGetAlignPos(void* ptr); SCOREDRAFT_API float TrackBufferGetCursor(void* ptr); SCOREDRAFT_API void TrackBufferSetCursor(void* ptr, float cursor); SCOREDRAFT_API void TrackBufferMoveCursor(void* ptr, float cursor_delta); SCOREDRAFT_API void MixTrackBufferList(void* ptr, void* ptr_list); SCOREDRAFT_API void WriteTrackBufferToWav(void* ptr, const char* fn); SCOREDRAFT_API void ReadTrackBufferFromWav(void* ptr, const char* fn); SCOREDRAFT_API void TrackBufferWriteBlend(void* ptr, void* ptr_wav_buf); } #include #include #include "utils.h" #include "TrackBuffer.h" // general void* PtrArrayCreate(unsigned long long size, const void** ptrs) { PtrArray* ret = new PtrArray(size); memcpy(ret->data(), ptrs, sizeof(void*)*size); return ret; } void PtrArrayDestroy(void* ptr_arr) { PtrArray* arr = (PtrArray*)ptr_arr; delete arr; } // F32Buf void* F32BufCreate(unsigned long long size, float value) { return new F32Buf(size, value); } void F32BufDestroy(void* ptr) { F32Buf* buf = (F32Buf*)ptr; delete buf; } float* F32BufData(void* ptr) { F32Buf* buf = (F32Buf*)ptr; return buf->data(); } int F32BufSize(void* ptr) { F32Buf* buf = (F32Buf*)ptr; return (int)(buf->size()); } void F32BufToS16(void* ptr, short* dst, float amplitude) { F32Buf* buf = (F32Buf*)ptr; for (size_t i = 0; i < buf->size(); i++) dst[i] = (short)((*buf)[i] * 32767.0f*amplitude + 0.5f); } void F32BufFromS16(void* ptr, const short* data, unsigned long long size) { F32Buf* buf = (F32Buf*)ptr; buf->resize(size); for (size_t i = 0; i < size; i++) { (*buf)[i] = (float)data[i] / 32767.0f; } } float F32BufMaxValue(void* ptr) { F32Buf* buf = (F32Buf*)ptr; float maxV = 0.0f; for (size_t i = 0; i < buf->size(); i++) { float v = fabsf((*buf)[i]); if (v > maxV) maxV = v; } return maxV; } void F32BufMix(void* ptr, void* ptr_lst) { F32Buf* target_buf = (F32Buf*)ptr; PtrArray* list = (PtrArray*)ptr_lst; unsigned numBufs = (unsigned)list->size(); size_t maxLen = 0; for (unsigned i = 0; i < numBufs; i++) { F32Buf* buf = (F32Buf*)(*list)[i]; size_t len = buf->size(); if (maxLen < len) maxLen = (unsigned)len; } target_buf->resize(maxLen); float* f32Out = target_buf->data(); memset(f32Out, 0, maxLen * sizeof(float)); for (unsigned i = 0; i < numBufs; i++) { F32Buf* buf = (F32Buf*)(*list)[i]; size_t len = buf->size(); const float* f32In = buf->data(); for (unsigned j = 0; j < len; j++) f32Out[j] += f32In[j]; } } // WavBuffer void* WavBufferCreate(float sampleRate, unsigned channelNum, void* ptr_data, unsigned alignPos, float volume, float pan) { WavBuffer* buf = new WavBuffer; buf->m_sampleRate = sampleRate; buf->m_channelNum = channelNum; buf->m_sampleNum = ((F32Buf*)ptr_data)->size() / channelNum; buf->p_data = (F32Buf*)ptr_data; buf->m_data = &(*buf->p_data)[0]; buf->m_alignPos = alignPos; buf->m_volume = volume; buf->m_pan = pan; return buf; } void WavBufferDestroy(void *ptr) { delete (WavBuffer*)ptr; } float WavBufferGetSampleRate(void* ptr) { WavBuffer* buf = (WavBuffer*)ptr; return buf->m_sampleRate; } unsigned WavBufferGetChannelNum(void *ptr) { WavBuffer* buf = (WavBuffer*)ptr; return buf->m_channelNum; } unsigned long long WavBufferGetSampleNum(void *ptr) { WavBuffer* buf = (WavBuffer*)ptr; return buf->m_sampleNum; } unsigned WavBufferGetAlignPos(void* ptr) { WavBuffer* buf = (WavBuffer*)ptr; return buf->m_alignPos; } void WavBufferSetAlignPos(void* ptr, unsigned alignPos) { WavBuffer* buf = (WavBuffer*)ptr; buf->m_alignPos = alignPos; } float WavBufferGetVolume(void* ptr) { WavBuffer* buf = (WavBuffer*)ptr; return buf->m_volume; } void WavBufferSetVolume(void* ptr, float volume) { WavBuffer* buf = (WavBuffer*)ptr; buf->m_volume = volume; } float WavBufferGetPan(void* ptr) { WavBuffer* buf = (WavBuffer*)ptr; return buf->m_pan; } void WavBufferSetPan(void* ptr, float pan) { WavBuffer* buf = (WavBuffer*)ptr; buf->m_pan = pan; } // TrackBuffer void* TrackBufferCreate(unsigned chn) { return new TrackBuffer(44100, chn); } void TrackBufferDestroy(void* ptr) { TrackBuffer* buffer = (TrackBuffer*)ptr; delete buffer; } void TrackBufferSetVolume(void* ptr, float volume) { TrackBuffer* buffer = (TrackBuffer*)ptr; buffer->SetVolume(volume); } float TrackBufferGetVolume(void* ptr) { TrackBuffer* buffer = (TrackBuffer*)ptr; return buffer->Volume(); } void TrackBufferSetPan(void* ptr, float pan) { TrackBuffer* buffer = (TrackBuffer*)ptr; buffer->SetPan(pan); } float TrackBufferGetPan(void* ptr) { TrackBuffer* buffer = (TrackBuffer*)ptr; return buffer->Pan(); } unsigned TrackBufferGetNumberOfSamples(void* ptr) { TrackBuffer* buffer = (TrackBuffer*)ptr; return buffer->NumberOfChannels(); } unsigned TrackBufferGetAlignPos(void* ptr) { TrackBuffer* buffer = (TrackBuffer*)ptr; return buffer->AlignPos(); } float TrackBufferGetCursor(void* ptr) { TrackBuffer* buffer = (TrackBuffer*)ptr; return buffer->GetCursor(); } void TrackBufferSetCursor(void* ptr, float cursor) { TrackBuffer* buffer = (TrackBuffer*)ptr; buffer->SetCursor(cursor); } void TrackBufferMoveCursor(void* ptr, float cursor_delta) { TrackBuffer* buffer = (TrackBuffer*)ptr; buffer->MoveCursor(cursor_delta); } void MixTrackBufferList(void* ptr, void* ptr_list) { TrackBuffer* targetBuffer = (TrackBuffer*)ptr; PtrArray* list = (PtrArray*)ptr_list; targetBuffer->CombineTracks((unsigned)list->size(), (TrackBuffer**)list->data()); } void WriteTrackBufferToWav(void* ptr, const char* fn) { TrackBuffer* buffer = (TrackBuffer*)ptr; WriteToWav(*buffer, fn); } void ReadTrackBufferFromWav(void* ptr, const char* fn) { TrackBuffer* buffer = (TrackBuffer*)ptr; ReadFromWav(*buffer, fn); } void TrackBufferWriteBlend(void* ptr, void* ptr_wav_buf) { TrackBuffer* buffer = (TrackBuffer*)ptr; WavBuffer* wavBuf = (WavBuffer*)ptr_wav_buf; buffer->WriteBlend(*wavBuf); } ================================================ FILE: ScoreDraftCore/api.h ================================================ #pragma once #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #pragma warning( disable: 4251 ) #if defined SCOREDRAFTCORE_DLL_EXPORT #define SCOREDRAFTCORE_API __declspec(dllexport) #elif defined SCOREDRAFTCORE_DLL_IMPORT #define SCOREDRAFTCORE_API __declspec(dllimport) #endif #endif #ifndef SCOREDRAFTCORE_API #define SCOREDRAFTCORE_API #endif ================================================ FILE: ScoreDraftCore/utils.h ================================================ #pragma once #include #include #include #include #include inline uint64_t time_micro_sec() { std::chrono::time_point tpSys = std::chrono::system_clock::now(); std::chrono::time_point tpMicro = std::chrono::time_point_cast(tpSys); return tpMicro.time_since_epoch().count(); } inline uint64_t time_milli_sec() { return (time_micro_sec() + 500) / 1000; } inline double time_sec() { return (double)time_micro_sec() / 1000000.0; } #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif typedef std::vector PtrArray; typedef std::vector F32Buf; inline void CalcPan(float pan, float& l, float& r) { if (pan == 0.0f) return; else if (pan < 0.0f) { pan = -pan; float ll = l; float rl = r * pan; float rr = r * (1.0f - pan); l = ll + rl; r = rr; } else { float ll = l * (1.0f - pan); float lr = l * pan; float rr = r; l = ll; r = lr + rr; } } #include "TrackBuffer.h" #include "ReadWav.h" #include "WriteWav.h" inline void WriteToWav(TrackBuffer& track, const char* fileName) { unsigned numSamples = track.NumberOfSamples(); unsigned chn = track.NumberOfChannels(); unsigned sampleRate = track.Rate(); float volume = track.AbsoluteVolume(); float pan = track.Pan(); WriteWav writer; writer.OpenFile(fileName); writer.WriteHeader(sampleRate, numSamples, chn); unsigned localBufferSize = track.GetLocalBufferSize(); float *buffer = new float[localBufferSize*chn]; unsigned pos = 0; while (numSamples > 0) { unsigned writeCount = min(numSamples, localBufferSize); track.GetSamples(pos, writeCount, buffer); writer.WriteSamples(buffer, writeCount, volume, pan); numSamples -= writeCount; pos += writeCount; } delete[] buffer; } inline void ReadFromWav(TrackBuffer& track, const char* fileName) { unsigned numSamples; unsigned chn; unsigned sampleRate; ReadWav reader; reader.OpenFile(fileName); reader.ReadHeader(sampleRate, numSamples, chn); unsigned localBufferSize = track.GetLocalBufferSize(); WavBuffer buf; buf.m_sampleRate = (float)sampleRate; buf.Allocate(chn, localBufferSize); while (numSamples > 0) { unsigned readCount = min(numSamples, localBufferSize); float maxv; reader.ReadSamples(buf.m_data, readCount, maxv); buf.m_sampleNum = readCount; track.WriteBlend(buf); track.MoveCursor((float)readCount / (float)track.Rate()*1000.0f); numSamples -= readCount; } } class Semaphore { public: Semaphore(int count_ = 0) : count(count_) {} inline void notify() { std::unique_lock lock(mtx); count++; cv.notify_one(); } inline void wait() { std::unique_lock lock(mtx); while (count == 0) { cv.wait(lock); } count--; } private: std::mutex mtx; std::condition_variable cv; int count; }; ================================================ FILE: SimpleInstruments/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(SimpleInstruments) set (INCLUDE_DIR ../ScoreDraftCore ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) add_library (SimpleInstruments SHARED SimpleInstruments.cpp) target_link_libraries(SimpleInstruments ScoreDraftCore) if (WIN32) target_compile_definitions(SimpleInstruments PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS SimpleInstruments RUNTIME DESTINATION ScoreDraft) else() install(TARGETS SimpleInstruments DESTINATION ScoreDraft) endif() ================================================ FILE: SimpleInstruments/SimpleInstruments.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API void GeneratePureSin(void* ptr_wavbuf, float freq, float fduration); SCOREDRAFT_API void GenerateSquare(void* ptr_wavbuf, float freq, float fduration); SCOREDRAFT_API void GenerateTriangle(void* ptr_wavbuf, float freq, float fduration); SCOREDRAFT_API void GenerateSawtooth(void* ptr_wavbuf, float freq, float fduration); SCOREDRAFT_API void GenerateNaivePiano(void* ptr_wavbuf, float freq, float fduration); SCOREDRAFT_API void GenerateBottleBlow(void* ptr_wavbuf, float freq, float fduration); } #include #include #define PI 3.14159265359f void GeneratePureSin(void* ptr_wavbuf, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(1, len); float wave = 1.0f; float Dwave = 0.0f; float a = powf(2.0f * PI*sampleFreq, 2.0f); for (size_t j = 0; j < len; j++) { float amplitude = sinf(PI*(float)j / (float)len); wavbuf->m_data[j] = amplitude * wave; float DDwave = -a * wave; Dwave += DDwave; wave += Dwave; } } void GenerateSquare(void* ptr_wavbuf, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(1, len); for (size_t j = 0; j < len; j++) { float x = sampleFreq * j; x = x - floor(x); float wave = x > 0.5f ? -1.0f : 1.0f; wavbuf->m_data[j] = wave; } } void GenerateTriangle(void* ptr_wavbuf, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(1, len); for (size_t j = 0; j < len; j++) { float amplitude = 1.0f - 2.0f*fabsf((float)j / (float)(len - 1) - 0.5f); float x = sampleFreq * j; x = x - floor(x); float wave = x > 0.5f ? (x - 0.75f)*4.0f : (0.25f - x)*4.0f; wavbuf->m_data[j] = wave * amplitude; } } void GenerateSawtooth(void* ptr_wavbuf, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(1, len); for (size_t j = 0; j < len; j++) { float amplitude = 1.0f - ((float)j / (float)(len - 1)); float phase = sampleFreq * j; float wave = 1.0f - 2.0f*(phase - floor(phase)); wavbuf->m_data[j] = amplitude * wave; } } void GenerateNaivePiano(void* ptr_wavbuf, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(1, len); for (size_t j = 0; j < len; j++) { float x = sampleFreq * j; x = x - floor(x); float x2 = (float)j / fNumOfSamples; float amplitude = 1.0f - powf(x2 - 0.5f, 3.0f)*8.0f; float wave = (1.0f + 0.5f*cos(2 * PI*x * 5))*sin(PI*x)* powf(1.0f - 2.0f * x, 3.0f); wavbuf->m_data[j] = amplitude * wave; } } inline float rand01() { float f = (float)rand() / (float)RAND_MAX; if (f < 0.0000001f) f = 0.0000001f; if (f > 0.9999999f) f = 0.9999999f; return f; } void GenerateBottleBlow(void* ptr_wavbuf, float freq, float fduration) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; float sampleRate = wavbuf->m_sampleRate; float fNumOfSamples = fduration * sampleRate*0.001f; size_t len = (size_t)ceilf(fNumOfSamples); float sampleFreq = freq / sampleRate; wavbuf->Allocate(1, len); float out = 0.0f; float Dout = 0.0f; //float FreqCut = 1.0f / 5000.0f; float k = 0.02f; float FreqCut = k * sampleFreq; float a = powf(2 * PI, 2.0f)*sqrtf(powf(FreqCut, 4.0f) + powf(sampleFreq, 4.0f)); //float b = 2 * PI * powf(2.0f*(sqrtf(powf(FreqCut, 4.0f) + powf(sampleFreq, 4.0f)) - powf(sampleFreq, 2.0f)),0.5f); float b = 2 * PI * FreqCut*FreqCut / sampleFreq; float ampfac = powf(FreqCut, 1.5f); for (size_t j = 0; j < len; j++) { float x2 = (float)j / fNumOfSamples; float amplitude = 1.0f - powf(x2 - 0.5f, 3.0f)*8.0f; wavbuf->m_data[j] = amplitude * out*ampfac; //float e = randGauss(); float e = rand01() - 0.5f; float DDout = e - b * Dout - a * out; Dout += DDout; out += Dout; } } ================================================ FILE: SoundFont2/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(SoundFont2) set(SOURCES api.cpp SF2.cpp Presets.cpp Synth.cpp SF2Synth.cpp ) set(HEADERS SF2.h Presets.h Synth.h SF2Synth.h ) set (INCLUDE_DIR ../ScoreDraftCore ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) add_library (SoundFont2 SHARED ${SOURCES} ${HEADERS}) target_link_libraries(SoundFont2 ScoreDraftCore) if (WIN32) target_compile_definitions(SoundFont2 PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS SoundFont2 RUNTIME DESTINATION ScoreDraft) else() install(TARGETS SoundFont2 DESTINATION ScoreDraft) endif() ================================================ FILE: SoundFont2/Presets.cpp ================================================ #include "Presets.h" #if !defined(TSF_POW) || !defined(TSF_POWF) || !defined(TSF_EXPF) || !defined(TSF_LOG) || !defined(TSF_TAN) || !defined(TSF_LOG10) || !defined(TSF_SQRT) # include # if !defined(__cplusplus) && !defined(NAN) && !defined(powf) && !defined(expf) && !defined(sqrtf) # define powf (float)pow // deal with old math.h # define expf (float)exp // files that come without # define sqrtf (float)sqrt // powf, expf and sqrtf # endif # define TSF_POW pow # define TSF_POWF powf # define TSF_EXPF expf # define TSF_LOG log # define TSF_TAN tan # define TSF_LOG10 log10 # define TSF_SQRTF sqrtf #endif static void tsf_region_clear(struct tsf_region* i, TSF_BOOL for_relative) { TSF_MEMSET(i, 0, sizeof(struct tsf_region)); i->hikey = i->hivel = 127; i->pitch_keycenter = 60; // C4 if (for_relative) return; i->pitch_keytrack = 100; i->pitch_keycenter = -1; // SF2 defaults in timecents. i->ampenv.delay = i->ampenv.attack = i->ampenv.hold = i->ampenv.decay = i->ampenv.release = -12000.0f; i->modenv.delay = i->modenv.attack = i->modenv.hold = i->modenv.decay = i->modenv.release = -12000.0f; i->initialFilterFc = 13500; i->delayModLFO = -12000.0f; i->delayVibLFO = -12000.0f; } static float tsf_timecents2Secsf(float timecents) { return TSF_POWF(2.0f, timecents / 1200.0f); } static float tsf_decibelsToGain(float db) { return (db > -100.f ? TSF_POWF(10.0f, db * 0.05f) : 0); } static void tsf_region_envtosecs(struct tsf_envelope* p, TSF_BOOL sustainIsGain) { // EG times need to be converted from timecents to seconds. // Pin very short EG segments. Timecents don't get to zero, and our EG is // happier with zero values. p->delay = (p->delay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->delay)); p->attack = (p->attack < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->attack)); p->release = (p->release < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->release)); // If we have dynamic hold or decay times depending on key number we need // to keep the values in timecents so we can calculate it during startNote if (!p->keynumToHold) p->hold = (p->hold < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->hold)); if (!p->keynumToDecay) p->decay = (p->decay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->decay)); if (p->sustain < 0.0f) p->sustain = 0.0f; else if (sustainIsGain) p->sustain = tsf_decibelsToGain(-p->sustain / 10.0f); else p->sustain = 1.0f - (p->sustain / 1000.0f); } static void tsf_region_operator(struct tsf_region* region, tsf_u16 genOper, union tsf_hydra_genamount* amount) { enum { StartAddrsOffset, EndAddrsOffset, StartloopAddrsOffset, EndloopAddrsOffset, StartAddrsCoarseOffset, ModLfoToPitch, VibLfoToPitch, ModEnvToPitch, InitialFilterFc, InitialFilterQ, ModLfoToFilterFc, ModEnvToFilterFc, EndAddrsCoarseOffset, ModLfoToVolume, Unused1, ChorusEffectsSend, ReverbEffectsSend, Pan, Unused2, Unused3, Unused4, DelayModLFO, FreqModLFO, DelayVibLFO, FreqVibLFO, DelayModEnv, AttackModEnv, HoldModEnv, DecayModEnv, SustainModEnv, ReleaseModEnv, KeynumToModEnvHold, KeynumToModEnvDecay, DelayVolEnv, AttackVolEnv, HoldVolEnv, DecayVolEnv, SustainVolEnv, ReleaseVolEnv, KeynumToVolEnvHold, KeynumToVolEnvDecay, Instrument, Reserved1, KeyRange, VelRange, StartloopAddrsCoarseOffset, Keynum, Velocity, InitialAttenuation, Reserved2, EndloopAddrsCoarseOffset, CoarseTune, FineTune, SampleID, SampleModes, Reserved3, ScaleTuning, ExclusiveClass, OverridingRootKey, Unused5, EndOper }; switch (genOper) { case StartAddrsOffset: region->offset += amount->shortAmount; break; case EndAddrsOffset: region->end += amount->shortAmount; break; case StartloopAddrsOffset: region->loop_start += amount->shortAmount; break; case EndloopAddrsOffset: region->loop_end += amount->shortAmount; break; case StartAddrsCoarseOffset: region->offset += amount->shortAmount * 32768; break; case ModLfoToPitch: region->modLfoToPitch = amount->shortAmount; break; case VibLfoToPitch: region->vibLfoToPitch = amount->shortAmount; break; case ModEnvToPitch: region->modEnvToPitch = amount->shortAmount; break; case InitialFilterFc: region->initialFilterFc = amount->shortAmount; break; case InitialFilterQ: region->initialFilterQ = amount->shortAmount; break; case ModLfoToFilterFc: region->modLfoToFilterFc = amount->shortAmount; break; case ModEnvToFilterFc: region->modEnvToFilterFc = amount->shortAmount; break; case EndAddrsCoarseOffset: region->end += amount->shortAmount * 32768; break; case ModLfoToVolume: region->modLfoToVolume = amount->shortAmount; break; case Pan: region->pan = amount->shortAmount / 1000.0f; break; case DelayModLFO: region->delayModLFO = amount->shortAmount; break; case FreqModLFO: region->freqModLFO = amount->shortAmount; break; case DelayVibLFO: region->delayVibLFO = amount->shortAmount; break; case FreqVibLFO: region->freqVibLFO = amount->shortAmount; break; case DelayModEnv: region->modenv.delay = amount->shortAmount; break; case AttackModEnv: region->modenv.attack = amount->shortAmount; break; case HoldModEnv: region->modenv.hold = amount->shortAmount; break; case DecayModEnv: region->modenv.decay = amount->shortAmount; break; case SustainModEnv: region->modenv.sustain = amount->shortAmount; break; case ReleaseModEnv: region->modenv.release = amount->shortAmount; break; case KeynumToModEnvHold: region->modenv.keynumToHold = amount->shortAmount; break; case KeynumToModEnvDecay: region->modenv.keynumToDecay = amount->shortAmount; break; case DelayVolEnv: region->ampenv.delay = amount->shortAmount; break; case AttackVolEnv: region->ampenv.attack = amount->shortAmount; break; case HoldVolEnv: region->ampenv.hold = amount->shortAmount; break; case DecayVolEnv: region->ampenv.decay = amount->shortAmount; break; case SustainVolEnv: region->ampenv.sustain = amount->shortAmount; break; case ReleaseVolEnv: region->ampenv.release = amount->shortAmount; break; case KeynumToVolEnvHold: region->ampenv.keynumToHold = amount->shortAmount; break; case KeynumToVolEnvDecay: region->ampenv.keynumToDecay = amount->shortAmount; break; case KeyRange: region->lokey = amount->range.lo; region->hikey = amount->range.hi; break; case VelRange: region->lovel = amount->range.lo; region->hivel = amount->range.hi; break; case StartloopAddrsCoarseOffset: region->loop_start += amount->shortAmount * 32768; break; case InitialAttenuation: region->attenuation += amount->shortAmount * 0.1f; break; case EndloopAddrsCoarseOffset: region->loop_end += amount->shortAmount * 32768; break; case CoarseTune: region->transpose += amount->shortAmount; break; case FineTune: region->tune += amount->shortAmount; break; case SampleModes: region->loop_mode = ((amount->wordAmount & 3) == 3 ? TSF_LOOPMODE_SUSTAIN : ((amount->wordAmount & 3) == 1 ? TSF_LOOPMODE_CONTINUOUS : TSF_LOOPMODE_NONE)); break; case ScaleTuning: region->pitch_keytrack = amount->shortAmount; break; case ExclusiveClass: region->group = amount->wordAmount; break; case OverridingRootKey: region->pitch_keycenter = amount->shortAmount; break; //case gen_endOper: break; // Ignore. //default: addUnsupportedOpcode(generator_name); } } void LoadPresets(SF2& sf2, Presets& presets) { Hydra* hydra = &sf2.hydra; unsigned fontSampleCount = (unsigned) sf2.fontSamples->size(); unsigned presetNum = (unsigned)sf2.hydra.phdrs.size() - 1; presets.resize(presetNum); enum { GenInstrument = 41, GenKeyRange = 43, GenVelRange = 44, GenSampleID = 53 }; // Read each preset. std::vector::iterator pphdr, pphdrMax; for (pphdr = hydra->phdrs.begin(), pphdrMax = pphdr + presetNum; pphdr != pphdrMax; pphdr++) { int sortedIndex = 0, region_index = 0; std::vector::iterator otherphdr; tsf_preset* preset; std::vector::iterator ppbag, ppbagEnd; tsf_region globalRegion; for (otherphdr = hydra->phdrs.begin(); otherphdr != pphdrMax; otherphdr++) { if (otherphdr == pphdr || otherphdr->bank > pphdr->bank) continue; else if (otherphdr->bank < pphdr->bank) sortedIndex++; else if (otherphdr->preset > pphdr->preset) continue; else if (otherphdr->preset < pphdr->preset) sortedIndex++; else if (otherphdr < pphdr) sortedIndex++; } preset = &presets[sortedIndex]; TSF_MEMCPY(preset->presetName, pphdr->presetName, sizeof(preset->presetName)); preset->presetName[sizeof(preset->presetName) - 1] = '\0'; //should be zero terminated in source file but make sure preset->bank = pphdr->bank; preset->preset = pphdr->preset; unsigned regionNum = 0; //count regions covered by this preset for (ppbag = hydra->pbags.begin() + pphdr->presetBagNdx, ppbagEnd = hydra->pbags.begin() + pphdr[1].presetBagNdx; ppbag != ppbagEnd; ppbag++) { unsigned char plokey = 0, phikey = 127, plovel = 0, phivel = 127; std::vector::iterator ppgen, ppgenEnd; std::vector::iterator pinst; std::vector::iterator pibag, pibagEnd; std::vector::iterator pigen, pigenEnd; for (ppgen = hydra->pgens.begin() + ppbag->genNdx, ppgenEnd = hydra->pgens.begin() + ppbag[1].genNdx; ppgen != ppgenEnd; ppgen++) { if (ppgen->genOper == GenKeyRange) { plokey = ppgen->genAmount.range.lo; phikey = ppgen->genAmount.range.hi; continue; } if (ppgen->genOper == GenVelRange) { plovel = ppgen->genAmount.range.lo; phivel = ppgen->genAmount.range.hi; continue; } if (ppgen->genOper != GenInstrument) continue; if (ppgen->genAmount.wordAmount >= hydra->insts.size()) continue; pinst = hydra->insts.begin() + ppgen->genAmount.wordAmount; for (pibag = hydra->ibags.begin() + pinst->instBagNdx, pibagEnd = hydra->ibags.begin() + pinst[1].instBagNdx; pibag != pibagEnd; pibag++) { unsigned char ilokey = 0, ihikey = 127, ilovel = 0, ihivel = 127; for (pigen = hydra->igens.begin() + pibag->instGenNdx, pigenEnd = hydra->igens.begin() + pibag[1].instGenNdx; pigen != pigenEnd; pigen++) { if (pigen->genOper == GenKeyRange) { ilokey = pigen->genAmount.range.lo; ihikey = pigen->genAmount.range.hi; continue; } if (pigen->genOper == GenVelRange) { ilovel = pigen->genAmount.range.lo; ihivel = pigen->genAmount.range.hi; continue; } if (pigen->genOper == GenSampleID && ihikey >= plokey && ilokey <= phikey && ihivel >= plovel && ilovel <= phivel) regionNum++; } } } } preset->regions.resize(regionNum); tsf_region_clear(&globalRegion, TSF_TRUE); // Zones. for (ppbag = hydra->pbags.begin() + pphdr->presetBagNdx, ppbagEnd = hydra->pbags.begin() + pphdr[1].presetBagNdx; ppbag != ppbagEnd; ppbag++) { std::vector::iterator ppgen, ppgenEnd; std::vector::iterator pinst; std::vector::iterator pibag, pibagEnd; std::vector::iterator pigen, pigenEnd; struct tsf_region presetRegion = globalRegion; int hadGenInstrument = 0; // Generators. for (ppgen = hydra->pgens.begin() + ppbag->genNdx, ppgenEnd = hydra->pgens.begin() + ppbag[1].genNdx; ppgen != ppgenEnd; ppgen++) { // Instrument. if (ppgen->genOper == GenInstrument) { struct tsf_region instRegion; tsf_u16 whichInst = ppgen->genAmount.wordAmount; if (whichInst >= hydra->insts.size()) continue; tsf_region_clear(&instRegion, TSF_FALSE); pinst = hydra->insts.begin()+whichInst; for (pibag = hydra->ibags.begin() + pinst->instBagNdx, pibagEnd = hydra->ibags.begin() + pinst[1].instBagNdx; pibag != pibagEnd; pibag++) { // Generators. struct tsf_region zoneRegion = instRegion; int hadSampleID = 0; for (pigen = hydra->igens.begin() + pibag->instGenNdx, pigenEnd = hydra->igens.begin() + pibag[1].instGenNdx; pigen != pigenEnd; pigen++) { if (pigen->genOper == GenSampleID) { struct tsf_hydra_shdr* pshdr; //preset region key and vel ranges are a filter for the zone regions if (zoneRegion.hikey < presetRegion.lokey || zoneRegion.lokey > presetRegion.hikey) continue; if (zoneRegion.hivel < presetRegion.lovel || zoneRegion.lovel > presetRegion.hivel) continue; if (presetRegion.lokey > zoneRegion.lokey) zoneRegion.lokey = presetRegion.lokey; if (presetRegion.hikey < zoneRegion.hikey) zoneRegion.hikey = presetRegion.hikey; if (presetRegion.lovel > zoneRegion.lovel) zoneRegion.lovel = presetRegion.lovel; if (presetRegion.hivel < zoneRegion.hivel) zoneRegion.hivel = presetRegion.hivel; //sum regions zoneRegion.offset += presetRegion.offset; zoneRegion.end += presetRegion.end; zoneRegion.loop_start += presetRegion.loop_start; zoneRegion.loop_end += presetRegion.loop_end; zoneRegion.transpose += presetRegion.transpose; zoneRegion.tune += presetRegion.tune; zoneRegion.pitch_keytrack += presetRegion.pitch_keytrack; zoneRegion.attenuation += presetRegion.attenuation; zoneRegion.pan += presetRegion.pan; zoneRegion.ampenv.delay += presetRegion.ampenv.delay; zoneRegion.ampenv.attack += presetRegion.ampenv.attack; zoneRegion.ampenv.hold += presetRegion.ampenv.hold; zoneRegion.ampenv.decay += presetRegion.ampenv.decay; zoneRegion.ampenv.sustain += presetRegion.ampenv.sustain; zoneRegion.ampenv.release += presetRegion.ampenv.release; zoneRegion.modenv.delay += presetRegion.modenv.delay; zoneRegion.modenv.attack += presetRegion.modenv.attack; zoneRegion.modenv.hold += presetRegion.modenv.hold; zoneRegion.modenv.decay += presetRegion.modenv.decay; zoneRegion.modenv.sustain += presetRegion.modenv.sustain; zoneRegion.modenv.release += presetRegion.modenv.release; zoneRegion.initialFilterQ += presetRegion.initialFilterQ; zoneRegion.initialFilterFc += presetRegion.initialFilterFc; zoneRegion.modEnvToPitch += presetRegion.modEnvToPitch; zoneRegion.modEnvToFilterFc += presetRegion.modEnvToFilterFc; zoneRegion.delayModLFO += presetRegion.delayModLFO; zoneRegion.freqModLFO += presetRegion.freqModLFO; zoneRegion.modLfoToPitch += presetRegion.modLfoToPitch; zoneRegion.modLfoToFilterFc += presetRegion.modLfoToFilterFc; zoneRegion.modLfoToVolume += presetRegion.modLfoToVolume; zoneRegion.delayVibLFO += presetRegion.delayVibLFO; zoneRegion.freqVibLFO += presetRegion.freqVibLFO; zoneRegion.vibLfoToPitch += presetRegion.vibLfoToPitch; // EG times need to be converted from timecents to seconds. tsf_region_envtosecs(&zoneRegion.ampenv, TSF_TRUE); tsf_region_envtosecs(&zoneRegion.modenv, TSF_FALSE); // LFO times need to be converted from timecents to seconds. zoneRegion.delayModLFO = (zoneRegion.delayModLFO < -11950.0f ? 0.0f : tsf_timecents2Secsf(zoneRegion.delayModLFO)); zoneRegion.delayVibLFO = (zoneRegion.delayVibLFO < -11950.0f ? 0.0f : tsf_timecents2Secsf(zoneRegion.delayVibLFO)); // Pin values to their ranges. if (zoneRegion.pan < -0.5f) zoneRegion.pan = -0.5f; else if (zoneRegion.pan > 0.5f) zoneRegion.pan = 0.5f; if (zoneRegion.initialFilterQ < 1500 || zoneRegion.initialFilterQ > 13500) zoneRegion.initialFilterQ = 0; pshdr = &hydra->shdrs[pigen->genAmount.wordAmount]; zoneRegion.offset += pshdr->start; zoneRegion.end += pshdr->end; zoneRegion.loop_start += pshdr->startLoop; zoneRegion.loop_end += pshdr->endLoop; if (pshdr->endLoop > 0) zoneRegion.loop_end -= 1; if (zoneRegion.pitch_keycenter == -1) zoneRegion.pitch_keycenter = pshdr->originalPitch; zoneRegion.tune += pshdr->pitchCorrection; zoneRegion.sample_rate = pshdr->sampleRate; if (zoneRegion.end && zoneRegion.end < fontSampleCount) zoneRegion.end++; else zoneRegion.end = fontSampleCount; preset->regions[region_index] = zoneRegion; region_index++; hadSampleID = 1; } else tsf_region_operator(&zoneRegion, pigen->genOper, &pigen->genAmount); } // Handle instrument's global zone. if (pibag == hydra->ibags.begin() + pinst->instBagNdx && !hadSampleID) instRegion = zoneRegion; // Modulators (TODO) //if (ibag->instModNdx < ibag[1].instModNdx) addUnsupportedOpcode("any modulator"); } hadGenInstrument = 1; } else tsf_region_operator(&presetRegion, ppgen->genOper, &ppgen->genAmount); } // Modulators (TODO) //if (pbag->modNdx < pbag[1].modNdx) addUnsupportedOpcode("any modulator"); // Handle preset's global zone. if (ppbag == hydra->pbags.begin() + pphdr->presetBagNdx && !hadGenInstrument) globalRegion = presetRegion; } } } ================================================ FILE: SoundFont2/Presets.h ================================================ #ifndef _Presets_h #define _Presets_h #include "SF2.h" #include enum { TSF_LOOPMODE_NONE, TSF_LOOPMODE_CONTINUOUS, TSF_LOOPMODE_SUSTAIN }; struct tsf_envelope { float delay, attack, hold, decay, sustain, release, keynumToHold, keynumToDecay; void print(FILE* fp, const char* prefix) const { fprintf(fp, "%s - delay: %f\n", prefix, delay); fprintf(fp, "%s - attack: %f\n", prefix, attack); fprintf(fp, "%s - hold: %f\n", prefix, hold); fprintf(fp, "%s - decay: %f\n", prefix, decay); fprintf(fp, "%s - sustain: %f\n", prefix, sustain); fprintf(fp, "%s - release: %f\n", prefix, release); fprintf(fp, "%s - keynumToHold: %f\n", prefix, keynumToHold); fprintf(fp, "%s - keynumToDecay: %f\n", prefix, keynumToDecay); } }; struct tsf_region { int loop_mode; unsigned int sample_rate; unsigned char lokey, hikey, lovel, hivel; unsigned int group, offset, end, loop_start, loop_end; int transpose, tune, pitch_keycenter, pitch_keytrack; float attenuation, pan; tsf_envelope ampenv, modenv; int initialFilterQ, initialFilterFc; int modEnvToPitch, modEnvToFilterFc, modLfoToFilterFc, modLfoToVolume; float delayModLFO; int freqModLFO, modLfoToPitch; float delayVibLFO; int freqVibLFO, vibLfoToPitch; void print(FILE* fp) const { fprintf(fp, "loop_mode: %d\n", loop_mode); fprintf(fp, "sample_rate: %u\n", sample_rate); fprintf(fp, "offset: %u\n", offset); fprintf(fp, "end: %u\n", end); fprintf(fp, "loop_start: %u\n", loop_start); fprintf(fp, "loop_end: %u\n", loop_end); fprintf(fp, "transpose: %d\n", transpose); fprintf(fp, "tune: %d\n", tune); fprintf(fp, "pitch_keycenter: %d\n", pitch_keycenter); fprintf(fp, "pitch_keytrack: %d\n", pitch_keytrack); fprintf(fp, "attenuation: %f\n", attenuation); fprintf(fp, "pan: %f\n", pan); ampenv.print(fp, "ampenv"); modenv.print(fp, "modenv"); fprintf(fp, "initialFilterQ: %d\n", initialFilterQ); fprintf(fp, "initialFilterFc: %d\n", initialFilterFc); fprintf(fp, "modEnvToPitch: %d\n", modEnvToPitch); fprintf(fp, "modEnvToFilterFc: %d\n", modEnvToFilterFc); fprintf(fp, "modLfoToFilterFc: %d\n", modLfoToFilterFc); fprintf(fp, "modLfoToVolume: %d\n", modLfoToVolume); fprintf(fp, "delayModLFO: %f\n", delayModLFO); fprintf(fp, "freqModLFO: %d\n", freqModLFO); fprintf(fp, "modLfoToPitch: %d\n", modLfoToPitch); fprintf(fp, "delayVibLFO: %f\n", delayVibLFO); fprintf(fp, "freqVibLFO: %d\n", freqVibLFO); fprintf(fp, "vibLfoToPitch: %d\n", vibLfoToPitch); } }; struct tsf_preset { tsf_char20 presetName; tsf_u16 preset, bank; std::vector regions; }; typedef std::vector Presets; void LoadPresets(SF2& sf2, Presets& presets); #endif ================================================ FILE: SoundFont2/SF2.cpp ================================================ #include "SF2.h" struct tsf_riffchunk { tsf_fourcc id; tsf_u32 size; }; #define TSF_FourCCEquals(value1, value2) (value1[0] == value2[0] && value1[1] == value2[1] && value1[2] == value2[2] && value1[3] == value2[3]) static TSF_BOOL tsf_riffchunk_read(struct tsf_riffchunk* parent, struct tsf_riffchunk* chunk, struct tsf_stream* stream) { TSF_BOOL IsRiff, IsList; if (parent && sizeof(tsf_fourcc) + sizeof(tsf_u32) > parent->size) return TSF_FALSE; if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE; if (!stream->read(stream->data, &chunk->size, sizeof(tsf_u32))) return TSF_FALSE; if (parent && sizeof(tsf_fourcc) + sizeof(tsf_u32) + chunk->size > parent->size) return TSF_FALSE; if (parent) parent->size -= sizeof(tsf_fourcc) + sizeof(tsf_u32) + chunk->size; IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST"); if (IsRiff && parent) return TSF_FALSE; //not allowed if (!IsRiff && !IsList) return TSF_TRUE; //custom type without sub type if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE; chunk->size -= sizeof(tsf_fourcc); return TSF_TRUE; } #define TSFR(FIELD) stream->read(stream->data, &i->FIELD, sizeof(i->FIELD)); inline void tsf_hydra_read_phdr(struct tsf_hydra_phdr* i, struct tsf_stream* stream) { TSFR(presetName) TSFR(preset) TSFR(bank) TSFR(presetBagNdx) TSFR(library) TSFR(genre) TSFR(morphology) } inline void tsf_hydra_read_pbag(struct tsf_hydra_pbag* i, struct tsf_stream* stream) { TSFR(genNdx) TSFR(modNdx) } inline void tsf_hydra_read_pmod(struct tsf_hydra_pmod* i, struct tsf_stream* stream) { TSFR(modSrcOper) TSFR(modDestOper) TSFR(modAmount) TSFR(modAmtSrcOper) TSFR(modTransOper) } inline void tsf_hydra_read_pgen(struct tsf_hydra_pgen* i, struct tsf_stream* stream) { TSFR(genOper) TSFR(genAmount) } inline void tsf_hydra_read_inst(struct tsf_hydra_inst* i, struct tsf_stream* stream) { TSFR(instName) TSFR(instBagNdx) } inline void tsf_hydra_read_ibag(struct tsf_hydra_ibag* i, struct tsf_stream* stream) { TSFR(instGenNdx) TSFR(instModNdx) } inline void tsf_hydra_read_imod(struct tsf_hydra_imod* i, struct tsf_stream* stream) { TSFR(modSrcOper) TSFR(modDestOper) TSFR(modAmount) TSFR(modAmtSrcOper) TSFR(modTransOper) } inline void tsf_hydra_read_igen(struct tsf_hydra_igen* i, struct tsf_stream* stream) { TSFR(genOper) TSFR(genAmount) } inline void tsf_hydra_read_shdr(struct tsf_hydra_shdr* i, struct tsf_stream* stream) { TSFR(sampleName) TSFR(start) TSFR(end) TSFR(startLoop) TSFR(endLoop) TSFR(sampleRate) TSFR(originalPitch) TSFR(pitchCorrection) TSFR(sampleLink) TSFR(sampleType) } #undef TSFR static void tsf_load_samples(F32Samples* samples, struct tsf_riffchunk *chunkSmpl, struct tsf_stream* stream) { // Read sample data into float format buffer. float* out; unsigned int samplesTotal, samplesLeft, samplesToRead, samplesToConvert; samplesTotal = chunkSmpl->size / sizeof(short); samplesLeft = samplesTotal; samples->resize(samplesTotal); out = samples->data(); for (; samplesLeft; samplesLeft -= samplesToRead) { short sampleBuffer[1024], *in = sampleBuffer;; samplesToRead = (samplesLeft > 1024 ? 1024 : samplesLeft); stream->read(stream->data, sampleBuffer, samplesToRead * sizeof(short)); // Convert from signed 16-bit to float. for (samplesToConvert = samplesToRead; samplesToConvert > 0; --samplesToConvert) // If we ever need to compile for big-endian platforms, we'll need to byte-swap here. *out++ = (float)(*in++ / 32767.0); } } void LoadSF2(struct tsf_stream* stream, SF2& sf2) { struct tsf_riffchunk chunkHead; struct tsf_riffchunk chunkList; Hydra& hydra = sf2.hydra; if (!tsf_riffchunk_read(TSF_NULL, &chunkHead, stream) || !TSF_FourCCEquals(chunkHead.id, "sfbk")) { //if (e) *e = TSF_INVALID_NOSF2HEADER; return; } // Read hydra and locate sample data. while (tsf_riffchunk_read(&chunkHead, &chunkList, stream)) { struct tsf_riffchunk chunk; if (TSF_FourCCEquals(chunkList.id, "pdta")) { while (tsf_riffchunk_read(&chunkList, &chunk, stream)) { #define HandleChunk(chunkName) (TSF_FourCCEquals(chunk.id, #chunkName) && !(chunk.size % chunkName##SizeInFile)) \ { \ int num = chunk.size / chunkName##SizeInFile, i; \ hydra.chunkName##s.resize(num);\ for (i = 0; i < num; ++i) tsf_hydra_read_##chunkName(&hydra.chunkName##s[i], stream); \ } enum { phdrSizeInFile = 38, pbagSizeInFile = 4, pmodSizeInFile = 10, pgenSizeInFile = 4, instSizeInFile = 22, ibagSizeInFile = 4, imodSizeInFile = 10, igenSizeInFile = 4, shdrSizeInFile = 46 }; if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod) else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag) else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr) else stream->skip(stream->data, chunk.size); #undef HandleChunk } } else if (TSF_FourCCEquals(chunkList.id, "sdta")) { while (tsf_riffchunk_read(&chunkList, &chunk, stream)) { if (TSF_FourCCEquals(chunk.id, "smpl")) { sf2.fontSamples = std::shared_ptr(new F32Samples); tsf_load_samples(sf2.fontSamples.get(), &chunk, stream); } else stream->skip(stream->data, chunk.size); } } else stream->skip(stream->data, chunkList.size); } } ================================================ FILE: SoundFont2/SF2.h ================================================ #ifndef __SF2_h #define __SF2_h #include #include #if !defined(TSF_MALLOC) || !defined(TSF_FREE) || !defined(TSF_REALLOC) # include # define TSF_MALLOC malloc # define TSF_FREE free # define TSF_REALLOC realloc #endif #if !defined(TSF_MEMCPY) || !defined(TSF_MEMSET) # include # define TSF_MEMCPY memcpy # define TSF_MEMSET memset #endif #ifndef TSF_NO_STDIO # include #endif #define TSF_TRUE 1 #define TSF_FALSE 0 #define TSF_BOOL char #define TSF_PI 3.14159265358979323846264338327950288 #define TSF_NULL 0 typedef char tsf_fourcc[4]; typedef signed char tsf_s8; typedef unsigned char tsf_u8; typedef unsigned short tsf_u16; typedef signed short tsf_s16; typedef unsigned int tsf_u32; typedef char tsf_char20[20]; union tsf_hydra_genamount { struct { tsf_u8 lo, hi; } range; tsf_s16 shortAmount; tsf_u16 wordAmount; }; struct tsf_hydra_phdr { tsf_char20 presetName; tsf_u16 preset, bank, presetBagNdx; tsf_u32 library, genre, morphology; }; struct tsf_hydra_pbag { tsf_u16 genNdx, modNdx; }; struct tsf_hydra_pmod { tsf_u16 modSrcOper, modDestOper; tsf_s16 modAmount; tsf_u16 modAmtSrcOper, modTransOper; }; struct tsf_hydra_pgen { tsf_u16 genOper; union tsf_hydra_genamount genAmount; }; struct tsf_hydra_inst { tsf_char20 instName; tsf_u16 instBagNdx; }; struct tsf_hydra_ibag { tsf_u16 instGenNdx, instModNdx; }; struct tsf_hydra_imod { tsf_u16 modSrcOper, modDestOper; tsf_s16 modAmount; tsf_u16 modAmtSrcOper, modTransOper; }; struct tsf_hydra_igen { tsf_u16 genOper; union tsf_hydra_genamount genAmount; }; struct tsf_hydra_shdr { tsf_char20 sampleName; tsf_u32 start, end, startLoop, endLoop, sampleRate; tsf_u8 originalPitch; tsf_s8 pitchCorrection; tsf_u16 sampleLink, sampleType; }; // Stream structure for the generic loading struct tsf_stream { // Custom data given to the functions as the first parameter void* data; // Function pointer will be called to read 'size' bytes into ptr (returns number of read bytes) int(*read)(void* data, void* ptr, unsigned int size); // Function pointer will be called to skip ahead over 'count' bytes (returns 1 on success, 0 on error) int(*skip)(void* data, unsigned int count); }; struct Hydra { std::vector phdrs; std::vector pbags; std::vector pmods; std::vector pgens; std::vector insts; std::vector ibags; std::vector imods; std::vector igens; std::vector shdrs; }; typedef std::vector F32Samples; struct SF2 { Hydra hydra; std::shared_ptr fontSamples; }; void LoadSF2(struct tsf_stream* stream, SF2& sf2); #ifndef TSF_NO_STDIO inline int tsf_stream_stdio_read(FILE* f, void* ptr, unsigned int size) { return (int)fread(ptr, 1, size, f); } inline int tsf_stream_stdio_skip(FILE* f, unsigned int count) { return !fseek(f, count, SEEK_CUR); } inline void LoadSF2Filename(const char* filename, SF2& sf2) { struct tsf_stream stream = { TSF_NULL, (int(*)(void*, void*, unsigned int))&tsf_stream_stdio_read, (int(*)(void*, unsigned int))&tsf_stream_stdio_skip }; #if __STDC_WANT_SECURE_LIB__ FILE* f = TSF_NULL; fopen_s(&f, filename, "rb"); #else FILE* f = fopen(filename, "rb"); #endif if (!f) { //if (e) *e = TSF_FILENOTFOUND; return; } stream.data = f; LoadSF2(&stream, sf2); fclose(f); } #endif struct tsf_stream_memory { const char* buffer; unsigned int total, pos; }; inline int tsf_stream_memory_read(struct tsf_stream_memory* m, void* ptr, unsigned int size) { if (size > m->total - m->pos) size = m->total - m->pos; TSF_MEMCPY(ptr, m->buffer + m->pos, size); m->pos += size; return size; } inline int tsf_stream_memory_skip(struct tsf_stream_memory* m, unsigned int count) { if (m->pos + count > m->total) return 0; m->pos += count; return 1; } inline void LoadSF2Memory(const void* buffer, int size, SF2& sf2) { struct tsf_stream stream = { TSF_NULL, (int(*)(void*, void*, unsigned int))&tsf_stream_memory_read, (int(*)(void*, unsigned int))&tsf_stream_memory_skip }; struct tsf_stream_memory f = { 0, 0, 0 }; f.buffer = (const char*)buffer; f.total = size; stream.data = &f; return LoadSF2(&stream, sf2); } #endif ================================================ FILE: SoundFont2/SF2Synth.cpp ================================================ #include "SF2Synth.h" #include struct LowPass { char active; double QInv; double a0, a1, b1, b2; }; struct tsf_voice_envelope { float level, slope; int samplesUntilNextSegment; short segment, midiVelocity; struct tsf_envelope parameters; TSF_BOOL segmentIsExponential, isAmpEnv; }; struct tsf_voice_lfo { int samplesUntil; float level, delta; }; #if !defined(TSF_POW) || !defined(TSF_POWF) || !defined(TSF_EXPF) || !defined(TSF_LOG) || !defined(TSF_TAN) || !defined(TSF_LOG10) || !defined(TSF_SQRT) # include # if !defined(__cplusplus) && !defined(NAN) && !defined(powf) && !defined(expf) && !defined(sqrtf) # define powf (float)pow // deal with old math.h # define expf (float)exp // files that come without # define sqrtf (float)sqrt // powf, expf and sqrtf # endif # define TSF_POW pow # define TSF_POWF powf # define TSF_EXPF expf # define TSF_LOG log # define TSF_TAN tan # define TSF_LOG10 log10 # define TSF_SQRTF sqrtf #endif static float tsf_gainToDecibels(float gain) { return (gain <= .00001f ? -100.f : (float)(20.0 * TSF_LOG10(gain))); } static double tsf_timecents2Secsd(double timecents) { return TSF_POW(2.0, timecents / 1200.0); } static float tsf_timecents2Secsf(float timecents) { return TSF_POWF(2.0f, timecents / 1200.0f); } static float tsf_cents2Hertz(float cents) { return 8.176f * TSF_POWF(2.0f, cents / 1200.0f); } static float tsf_decibelsToGain(float db) { return (db > -100.f ? TSF_POWF(10.0f, db * 0.05f) : 0); } enum { TSF_SEGMENT_NONE, TSF_SEGMENT_DELAY, TSF_SEGMENT_ATTACK, TSF_SEGMENT_HOLD, TSF_SEGMENT_DECAY, TSF_SEGMENT_SUSTAIN, TSF_SEGMENT_RELEASE, TSF_SEGMENT_DONE }; #define TSF_FASTRELEASETIME 0.01f static void tsf_voice_envelope_nextsegment(struct tsf_voice_envelope* e, short active_segment, float outSampleRate) { switch (active_segment) { case TSF_SEGMENT_NONE: e->samplesUntilNextSegment = (int)(e->parameters.delay * outSampleRate); if (e->samplesUntilNextSegment > 0) { e->segment = TSF_SEGMENT_DELAY; e->segmentIsExponential = TSF_FALSE; e->level = 0.0; e->slope = 0.0; return; } case TSF_SEGMENT_DELAY: e->samplesUntilNextSegment = (int)(e->parameters.attack * outSampleRate); if (e->samplesUntilNextSegment > 0) { if (!e->isAmpEnv) { //mod env attack duration scales with velocity (velocity of 1 is full duration, max velocity is 0.125 times duration) e->samplesUntilNextSegment = (int)(e->parameters.attack * ((145 - e->midiVelocity) / 144.0f) * outSampleRate); } e->segment = TSF_SEGMENT_ATTACK; e->segmentIsExponential = TSF_FALSE; e->level = 0.0f; e->slope = 1.0f / e->samplesUntilNextSegment; return; } case TSF_SEGMENT_ATTACK: e->samplesUntilNextSegment = (int)(e->parameters.hold * outSampleRate); if (e->samplesUntilNextSegment > 0) { e->segment = TSF_SEGMENT_HOLD; e->segmentIsExponential = TSF_FALSE; e->level = 1.0f; e->slope = 0.0f; return; } case TSF_SEGMENT_HOLD: e->samplesUntilNextSegment = (int)(e->parameters.decay * outSampleRate); if (e->samplesUntilNextSegment > 0) { e->segment = TSF_SEGMENT_DECAY; e->level = 1.0f; if (e->isAmpEnv) { // I don't truly understand this; just following what LinuxSampler does. float mysterySlope = -9.226f / e->samplesUntilNextSegment; e->slope = TSF_EXPF(mysterySlope); e->segmentIsExponential = TSF_TRUE; if (e->parameters.sustain > 0.0f) { // Again, this is following LinuxSampler's example, which is similar to // SF2-style decay, where "decay" specifies the time it would take to // get to zero, not to the sustain level. The SFZ spec is not that // specific about what "decay" means, so perhaps it's really supposed // to specify the time to reach the sustain level. e->samplesUntilNextSegment = (int)(TSF_LOG(e->parameters.sustain) / mysterySlope); } } else { e->slope = -1.0f / e->samplesUntilNextSegment; e->samplesUntilNextSegment = (int)(e->parameters.decay * (1.0f - e->parameters.sustain) * outSampleRate); e->segmentIsExponential = TSF_FALSE; } return; } case TSF_SEGMENT_DECAY: e->segment = TSF_SEGMENT_SUSTAIN; e->level = e->parameters.sustain; e->slope = 0.0f; e->samplesUntilNextSegment = 0x7FFFFFFF; e->segmentIsExponential = TSF_FALSE; return; case TSF_SEGMENT_SUSTAIN: e->segment = TSF_SEGMENT_RELEASE; e->samplesUntilNextSegment = (int)((e->parameters.release <= 0 ? TSF_FASTRELEASETIME : e->parameters.release) * outSampleRate); if (e->isAmpEnv) { // I don't truly understand this; just following what LinuxSampler does. float mysterySlope = -9.226f / e->samplesUntilNextSegment; e->slope = TSF_EXPF(mysterySlope); e->segmentIsExponential = TSF_TRUE; } else { e->slope = -e->level / e->samplesUntilNextSegment; e->segmentIsExponential = TSF_FALSE; } return; case TSF_SEGMENT_RELEASE: default: e->segment = TSF_SEGMENT_DONE; e->segmentIsExponential = TSF_FALSE; e->level = e->slope = 0.0f; e->samplesUntilNextSegment = 0x7FFFFFF; } } static void tsf_voice_envelope_setup(struct tsf_voice_envelope* e, const struct tsf_envelope* new_parameters, float midiNoteNumber, short midiVelocity, TSF_BOOL isAmpEnv, float outSampleRate) { e->parameters = *new_parameters; if (e->parameters.keynumToHold!=0.0f) { e->parameters.hold += e->parameters.keynumToHold * (60.0f - midiNoteNumber); e->parameters.hold = (e->parameters.hold < -10000.0f ? 0.0f : tsf_timecents2Secsf(e->parameters.hold)); } if (e->parameters.keynumToDecay != 0.0f) { e->parameters.decay += e->parameters.keynumToDecay * (60.0f - midiNoteNumber); e->parameters.decay = (e->parameters.decay < -10000.0f ? 0.0f : tsf_timecents2Secsf(e->parameters.decay)); } e->midiVelocity = midiVelocity; e->isAmpEnv = isAmpEnv; tsf_voice_envelope_nextsegment(e, TSF_SEGMENT_NONE, outSampleRate); } static void tsf_voice_lowpass_setup(LowPass* e, float Fc) { // Lowpass filter from http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/ double K = TSF_TAN(TSF_PI * Fc), KK = K * K; double norm = 1 / (1 + K * e->QInv + KK); e->a0 = KK * norm; e->a1 = 2 * e->a0; e->b1 = 2 * (KK - 1) * norm; e->b2 = (1 - K * e->QInv + KK) * norm; } static void tsf_voice_lfo_setup(struct tsf_voice_lfo* e, float delay, int freqCents, float outSampleRate) { e->samplesUntil = (int)(delay * outSampleRate); e->delta = (4.0f * tsf_cents2Hertz((float)freqCents) / outSampleRate); e->level = 0; } static void tsf_voice_envelope_process(struct tsf_voice_envelope* e, int numSamples, float outSampleRate) { if (e->slope) { if (e->segmentIsExponential) e->level *= TSF_POWF(e->slope, (float)numSamples); else e->level += (e->slope * numSamples); } if ((e->samplesUntilNextSegment -= numSamples) <= 0) tsf_voice_envelope_nextsegment(e, e->segment, outSampleRate); } static void tsf_voice_lfo_process(struct tsf_voice_lfo* e, int blockSamples) { if (e->samplesUntil > blockSamples) { e->samplesUntil -= blockSamples; return; } e->level += e->delta * blockSamples; if (e->level > 1.0f) { e->delta = -e->delta; e->level = 2.0f - e->level; } else if (e->level < -1.0f) { e->delta = -e->delta; e->level = -2.0f - e->level; } } // The lower this block size is the more accurate the effects are. // Increasing the value significantly lowers the CPU usage of the voice rendering. // If LFO affects the low-pass filter it can be hearable even as low as 8. #ifndef TSF_RENDER_EFFECTSAMPLEBLOCK #define TSF_RENDER_EFFECTSAMPLEBLOCK 64 #endif void SynthRegion(F32Samples& output, F32Samples& input, const tsf_region& region, float key, float vel, unsigned& numSamples, OutputMode outputmode, float samplerate, float global_gain_db) { /*FILE *fp = fopen("dump.txt", "a"); region.print(fp); fclose(fp);*/ int midiVelocity = (int)(vel * 127); float noteGainDB =global_gain_db - region.attenuation - tsf_gainToDecibels(1.0f / vel); double note = (double)key + (double)region.transpose + (double)region.tune / 100.0; double adjustedPitch = (double)region.pitch_keycenter + (note - (double)region.pitch_keycenter)* ((double)region.pitch_keytrack / 100.0); double pitchInputTimecents = adjustedPitch * 100.0; double pitchOutputFactor = (double)region.sample_rate / (tsf_timecents2Secsd((double)region.pitch_keycenter * 100.0) * (double)samplerate); // The SFZ spec is silent about the pan curve, but a 3dB pan law seems common. This sqrt() curve matches what Dimension LE does; Alchemy Free seems closer to sin(adjustedPan * pi/2). float panFactorLeft = TSF_SQRTF(0.5f - region.pan); float panFactorRight = TSF_SQRTF(0.5f + region.pan); // Offset/end. NoteState ns; ns.sourceSamplePosition = region.offset; bool doLoop = (region.loop_mode != TSF_LOOPMODE_NONE && region.loop_start < region.loop_end); // Loop. unsigned loopStart = (doLoop ? region.loop_start : 0); unsigned loopEnd = (doLoop ? region.loop_end : 0); // Setup envelopes. tsf_voice_envelope ampenv, modenv; tsf_voice_envelope_setup(&env, ®ion.ampenv, key, midiVelocity, TSF_TRUE, samplerate); tsf_voice_envelope_setup(&modenv, ®ion.modenv, key, midiVelocity, TSF_FALSE, samplerate); // Setup lowpass filter. float filterQDB = region.initialFilterQ / 10.0f; LowPass lowpass; lowpass.QInv = 1.0f / TSF_POW(10.0f, (filterQDB / 20.0f)); ns.lowPass.z1 = 0.0; ns.lowPass.z2 = 0.0; lowpass.active = (region.initialFilterFc <= 13500); if (lowpass.active) tsf_voice_lowpass_setup(&lowpass, tsf_cents2Hertz((float)region.initialFilterFc) / samplerate); // Setup LFO filters. tsf_voice_lfo modlfo, viblfo; tsf_voice_lfo_setup(&modlfo, region.delayModLFO, region.freqModLFO, samplerate); tsf_voice_lfo_setup(&viblfo, region.delayVibLFO, region.freqVibLFO, samplerate); TSF_BOOL updateModEnv = (region.modEnvToPitch != 0 || region.modEnvToFilterFc != 0); TSF_BOOL updateModLFO = (modlfo.delta != 0.0f && (region.modLfoToPitch != 0 || region.modLfoToFilterFc != 0 || region.modLfoToVolume != 0)); TSF_BOOL updateVibLFO = (viblfo.delta != 0.0f && (region.vibLfoToPitch != 0)); TSF_BOOL isLooping = (loopStart < loopEnd); double tmpSampleEndDbl = (double)region.end; double tmpLoopEndDbl = (double)loopEnd + 1.0f; double tmpSourceSamplePosition = ns.sourceSamplePosition; TSF_BOOL dynamicLowpass = (region.modLfoToFilterFc != 0 || region.modEnvToFilterFc != 0); float tmpSampleRate, tmpInitialFilterFc, tmpModLfoToFilterFc, tmpModEnvToFilterFc; TSF_BOOL dynamicPitchRatio = (region.modLfoToPitch != 0 || region.modEnvToPitch != 0 || region.vibLfoToPitch != 0); double pitchRatio; float tmpModLfoToPitch, tmpVibLfoToPitch, tmpModEnvToPitch; TSF_BOOL dynamicGain = (region.modLfoToVolume != 0); float noteGain = 0, tmpModLfoToVolume; if (dynamicLowpass) tmpSampleRate = samplerate, tmpInitialFilterFc = (float)region.initialFilterFc, tmpModLfoToFilterFc = (float)region.modLfoToFilterFc, tmpModEnvToFilterFc = (float)region.modEnvToFilterFc; else tmpSampleRate = 0, tmpInitialFilterFc = 0, tmpModLfoToFilterFc = 0, tmpModEnvToFilterFc = 0; if (dynamicPitchRatio) pitchRatio = 0, tmpModLfoToPitch = (float)region.modLfoToPitch, tmpVibLfoToPitch = (float)region.vibLfoToPitch, tmpModEnvToPitch = (float)region.modEnvToPitch; else pitchRatio = tsf_timecents2Secsd(pitchInputTimecents) * pitchOutputFactor, tmpModLfoToPitch = 0, tmpVibLfoToPitch = 0, tmpModEnvToPitch = 0; if (dynamicGain) tmpModLfoToVolume = (float)region.modLfoToVolume * 0.1f; else noteGain = tsf_decibelsToGain(noteGainDB), tmpModLfoToVolume = 0; SynthCtrl control; control.outputmode = outputmode; control.loopStart = loopStart; control.loopEnd = loopEnd; control.end = region.end; control.panFactorLeft = panFactorLeft; control.panFactorRight = panFactorRight; control.effect_sample_block = TSF_RENDER_EFFECTSAMPLEBLOCK; unsigned countSamples = 0; while (true) { float gainMono; int blockSamples = TSF_RENDER_EFFECTSAMPLEBLOCK; countSamples += blockSamples; if (countSamples >= numSamples && ampenv.segment= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (loopEnd - loopStart + 1.0f); if (tmpSourceSamplePosition >= tmpSampleEndDbl || ampenv.segment == TSF_SEGMENT_DONE) break; } numSamples = countSamples; unsigned chn = outputmode == MONO ? 1 : 2; output.resize(countSamples*chn); memset(output.data(), 0, sizeof(float)* countSamples*chn); Synth(input.data(), output.data(), countSamples, ns, control); } void SF2Synth(F32Samples& output, F32Samples& input, tsf_preset& preset, float key, float vel, unsigned& numSamples, OutputMode outputmode, float samplerate, float global_gain_db) { int midiVelocity = (int)(vel * 127); int iKey = (int)(key + 0.5f); std::vector::iterator region, regionEnd; std::vector> results; unsigned max_numSamples = 0; for (region = preset.regions.begin(), regionEnd = region + preset.regions.size(); region != regionEnd; region++) { if (iKey < region->lokey || iKey > region->hikey || midiVelocity < region->lovel || midiVelocity > region->hivel) continue; unsigned region_numSamples = numSamples; std::shared_ptr result = std::shared_ptr(new F32Samples); SynthRegion(*result, input, *region, key, vel, region_numSamples, outputmode, samplerate, global_gain_db); results.push_back(result); if (region_numSamples > max_numSamples) max_numSamples = region_numSamples; } numSamples = max_numSamples; if (results.size() < 1) return; unsigned chn = outputmode == MONO ? 1 : 2; output.resize(max_numSamples*chn); memset(output.data(), 0, sizeof(float)*output.size()); for (unsigned i = 0; i < results.size(); i++) { std::shared_ptr result = results[i]; for (unsigned j = 0; j < result->size(); j++) output[j] += (*result)[j]; } } ================================================ FILE: SoundFont2/SF2Synth.h ================================================ #ifndef _SF2Synth_h #define _SF2Synth_h #include "SF2.h" #include "Presets.h" #include "Synth.h" #include void SF2Synth(F32Samples& output, F32Samples& input, tsf_preset& preset, float key, float vel, unsigned& numSamples, OutputMode outputmode = STEREO_INTERLEAVED, float samplerate = 44100.0f, float global_gain_db = 0.0f); #endif ================================================ FILE: SoundFont2/Synth.cpp ================================================ #include "Synth.h" #include void Synth(const float* input, float* outputBuffer, unsigned numSamples, NoteState& noteState, const SynthCtrl& control) { float* outL = outputBuffer; float* outR = (control.outputmode == STEREO_UNWEAVED ? outL + numSamples : nullptr); unsigned tmpLoopStart = control.loopStart; unsigned tmpLoopEnd = control.loopEnd; unsigned tmpEnd = control.end; double tmpSourceSamplePosition = noteState.sourceSamplePosition; double tmpSampleEndDbl = (double)tmpEnd; double tmpLoopEndDbl = (double)tmpLoopEnd + 1.0; unsigned i_ctrl = 0; SynthCtrlPnt ctrlPnt; LowPassState lowPassState = noteState.lowPass; while (numSamples) { float gainLeft, gainRight; int blockSamples = (numSamples > control.effect_sample_block ? control.effect_sample_block : numSamples); numSamples -= blockSamples; if (i_ctrl (int)tmpLoopEnd && ctrlPnt.looping) { ipos2 = tmpLoopStart; ipos3 = tmpLoopStart + 1; } if (ipos2 >= (int)tmpEnd) ipos2 = tmpEnd - 1; if (ipos3 >= (int)tmpEnd) ipos3 = tmpEnd - 1; if (ipos0 < 0) ipos0 = 0; float p0 = input[ipos0]; float p1 = input[ipos1]; float p2 = input[ipos2]; float p3 = input[ipos3]; val = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceil(tmpSourceSamplePosition - 0.5* pitchRatio); int ipos2 = (int)floor(tmpSourceSamplePosition + 0.5* pitchRatio); int count = ipos2 - ipos1 + 1; for (int ipos = ipos1; ipos <= ipos2; ipos++) { int _ipos = ipos; if (_ipos < 0) _ipos = 0; if (_ipos > (int)tmpLoopEnd && ctrlPnt.looping) { _ipos += (int)tmpLoopStart - (int)tmpLoopEnd -1; } if (_ipos >= (int)tmpEnd) { _ipos = tmpEnd - 1; } val += input[_ipos]; } val /= (float)count; } if (lowPassCtrlPnt.active) { double In = val; val = (float)(In * lowPassCtrlPnt.a0 + lowPassState.z1); lowPassState.z1 = In * lowPassCtrlPnt.a1 + lowPassState.z2 - lowPassCtrlPnt.b1 * val; lowPassState.z2 = In * lowPassCtrlPnt.a0 - lowPassCtrlPnt.b2 * val; } switch (control.outputmode) { case STEREO_INTERLEAVED: *outL++ += val * gainLeft; *outL++ += val * gainRight; break; case STEREO_UNWEAVED: *outL++ += val * gainLeft; *outR++ += val * gainRight; break; case MONO: *outL++ += val * gainMono; break; } // Next sample. tmpSourceSamplePosition += pitchRatio; if (tmpSourceSamplePosition >= tmpLoopEndDbl && ctrlPnt.looping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0f); } if (tmpSourceSamplePosition >= tmpSampleEndDbl) break; i_ctrl++; } noteState.sourceSamplePosition= tmpSourceSamplePosition; noteState.lowPass = lowPassState; } ================================================ FILE: SoundFont2/Synth.h ================================================ #ifndef _Synth_h #define _Synth_h #include struct LowPassState { double z1, z2; }; struct NoteState { double sourceSamplePosition; LowPassState lowPass; }; struct LowPassCtrlPnt { char active; double a0, a1, b1, b2; }; struct SynthCtrlPnt { char looping; float gainMono; double pitchRatio; LowPassCtrlPnt lowPass; }; enum OutputMode { // Two channels with single left/right samples one after another STEREO_INTERLEAVED, // Two channels with all samples for the left channel first then right STEREO_UNWEAVED, // A single channel (stereo instruments are mixed into center) MONO, }; struct SynthCtrl { OutputMode outputmode; unsigned loopStart, loopEnd; unsigned end; float panFactorLeft, panFactorRight; unsigned effect_sample_block; std::vector controlPnts; }; void Synth(const float* input, float* outputBuffer, unsigned numSamples, NoteState& noteState, const SynthCtrl& control); #endif ================================================ FILE: SoundFont2/api.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { // SF2Bank SCOREDRAFT_API void* SF2BankCreate(const char* filename); SCOREDRAFT_API void SF2BankDestroy(void* ptr); SCOREDRAFT_API unsigned long long SF2BankGetNumberPresets(void* ptr); SCOREDRAFT_API const char* SF2BankGetPresetName(void* ptr, int i); SCOREDRAFT_API int SF2BankGetPresetBankNum(void* ptr, int i); SCOREDRAFT_API int SF2BankGetPresetNumber(void* ptr, int i); // SF2Tone SCOREDRAFT_API void* SF2ToneCreate(void* ptr_bank, unsigned preset_index); SCOREDRAFT_API void SF2ToneDestroy(void* ptr); // SF2Synth SCOREDRAFT_API void SF2SynthNote(void* ptr_wavbuf, void* ptr_tone, float key, float vel, unsigned numSamples, unsigned outputmode, float global_gain_db); } #include "SF2Synth.h" #include // SF2Bank struct SF2Bank { std::shared_ptr font_samples; Presets presets; }; void* SF2BankCreate(const char* filename) { SF2Bank* bank = new SF2Bank; SF2 sf2; LoadSF2Filename(filename, sf2); bank->font_samples = sf2.fontSamples; LoadPresets(sf2, bank->presets); return bank; } void SF2BankDestroy(void* ptr) { SF2Bank* bank = (SF2Bank*)ptr; delete bank; } unsigned long long SF2BankGetNumberPresets(void* ptr) { SF2Bank* bank = (SF2Bank*)ptr; return bank->presets.size(); } const char* SF2BankGetPresetName(void* ptr, int i) { SF2Bank* bank = (SF2Bank*)ptr; return bank->presets[i].presetName; } int SF2BankGetPresetBankNum(void* ptr, int i) { SF2Bank* bank = (SF2Bank*)ptr; return bank->presets[i].bank; } int SF2BankGetPresetNumber(void* ptr, int i) { SF2Bank* bank = (SF2Bank*)ptr; return bank->presets[i].preset; } // SF2Tone struct SF2Tone { F32Samples* input; tsf_preset* preset; }; void* SF2ToneCreate(void* ptr_bank, unsigned preset_index) { SF2Bank* bank = (SF2Bank*)ptr_bank; SF2Tone* tone = new SF2Tone; tone->input = bank->font_samples.get(); tone->preset = &bank->presets[preset_index]; return tone; } void SF2ToneDestroy(void* ptr) { SF2Tone* tone = (SF2Tone*)ptr; delete tone; } // SF2Synth void SF2SynthNote(void* ptr_wavbuf, void* ptr_tone, float key, float vel, unsigned numSamples, unsigned outputmode, float global_gain_db) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; wavbuf->m_channelNum = outputmode < 2 ? 2 : 1; SF2Tone* tone = (SF2Tone*)ptr_tone; float samplerate = wavbuf->m_sampleRate; SF2Synth(*wavbuf->p_data, *tone->input, *tone->preset, key, vel, numSamples, (OutputMode)outputmode, samplerate, global_gain_db); wavbuf->m_sampleNum = wavbuf->p_data->size()/ wavbuf->m_channelNum; wavbuf->m_data = wavbuf->p_data->data(); } ================================================ FILE: Test/FlyMeToTheMoon.py ================================================ #!/usr/bin/python3 import os import ScoreDraft from ScoreDraft.Notes import * def soS(octave=5, duration=48): return note(octave,Freqs[8],duration) def set_soS(freq): Freqs[8]=freq doc=ScoreDraft.Document() doc.setReferenceFrequency(264.0 *1.25) doc.setTempo(120) set_re(10.0/9.0) set_mi(5.0/4.0) set_fa(4.0/3.0) set_so(3.0/2.0) set_la(5.0/3.0) set_ti(15.0/8.0) set_soS(25.0/16.0) seq1 = [do(6,72), ti(5,24), la(5,24), so(5,72)] seq2 = [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [fa(5,96), BL(24), so(5,24), la(5,24), do(6,24)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48),fa(4,48)] set_re(9.0/8.0) set_fa(21.0/16.0) seq1 = seq1 + [ti(5,72), la(5,24), so(5,24), fa(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] set_fa(4.0/3.0) seq1 = seq1 + [mi(5,144), BL(48)] seq2 = seq2 + [do(3,192), BK(144), so(3,48), do(4,48), mi(4,48)] set_re(10.0/9.0) seq1 = seq1 + [la(5,72), so(5,24), fa(5,24), mi(5,72)] seq2 = seq2 + [fa(3,192), BK(144), do(4,48), mi(4,48), la(4,48)] seq1 = seq1 + [re(5,72), mi(5,24), fa(5,24), la(5,72)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] set_re(35.0/32.0) seq1 = seq1 + [soS(5,72), fa(5,24), mi(5,24), re(5,72)] seq2 = seq2 + [mi(3,192), BK(144), ti(3,48), re(4,48), soS(4,48)] set_re(10.0/9.0) seq1 = seq1 + [do(5,144), BL(48)] seq2 = seq2 + [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [re(5,24), la(5,72), la(5,96)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] set_re(9.0/8.0) set_fa(21.0/16.0) seq1 = seq1 + [BL(96), do(6,24), ti(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] set_fa(4.0/3.0) seq1 = seq1 + [so(5,144), BL(48)] seq2 = seq2 + [mi(3,192), BK(144), ti(3,48), re(4,48), so(4,48)] set_re(10.0/9.0) seq1 = seq1 + [la(4,24), fa(5,72), fa(5,96)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] set_re(9.0/8.0) set_fa(21.0/16.0) set_la(27.0/16.0) seq1 = seq1 + [BL(96), la(5,72), so(5,24)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [fa(5,24), mi(5,120), BL(48)] seq2 = seq2 + [do(3,192), BK(144), so(3,48), do(4,48), mi(4,48)] set_re(10.0/9.0) set_fa(4.0/3.0) set_la(5.0/3.0) seq1 = seq1 + [do(6,72), ti(5,24), la(5,24), so(5,72)] seq2 = seq2 + [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [fa(5,96), BL(24), so(5,24), la(5,24), do(6,24)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48),fa(4,48)] set_re(9.0/8.0) set_fa(21.0/16.0) seq1 = seq1 + [ti(5,72), la(5,24), so(5,24), fa(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] set_fa(4.0/3.0) seq1 = seq1 + [mi(5,144), BL(48)] seq2 = seq2 + [do(3,192), BK(144), so(3,48), do(4,48), mi(4,48)] set_re(10.0/9.0) seq1 = seq1 + [la(5,72), so(5,24), fa(5,24), mi(5,72)] seq2 = seq2 + [fa(3,192), BK(144), do(4,48), mi(4,48), la(4,48)] seq1 = seq1 + [re(5,72), mi(5,24), fa(5,24), la(5,72)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] set_re(35.0/32.0) seq1 = seq1 + [soS(5,72), la(5,24), ti(5,24), ti(5,72)] seq2 = seq2 + [mi(3,192), BK(144), ti(3,48), re(4,48), soS(4,48)] set_re(10.0/9.0) seq1 = seq1 + [do(6,24), ti(5,24), la(5,96), BL(48)] seq2 = seq2 + [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [la(5,24), so(5,72), la(5,24), so(5,24), fa(5,48)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] set_re(9.0/8.0) set_fa(21.0/16.0) seq1 = seq1 + [BL(96), do(6,24), ti(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] set_re(10.0/9.0) set_fa(4.0/3.0) seq1 = seq1 + [mi(6,144), BL(48)] seq2 = seq2 + [fa(3,192), BK(144), do(4,48), mi(4,48), la(4,48)] seq1 = seq1 + [mi(6,24), do(6,72), do(6,96)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] set_re(9.0/8.0) set_fa(21.0/16.0) seq1 = seq1 + [BL(96), ti(5,24), re(6,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [do(6,192)] seq2 = seq2 + [do(3,192), BK(180), so(3,180), BK(168), do(4,168), BK(156), mi(4,156), BK(144), so(4,144), BK(132), do(5,132) ] # instrument=ScoreDraft.Piano() instrument = ScoreDraft.SF2Instrument('florestan-subset.sf2', 0) doc.playNoteSeq(seq1, instrument) doc.playNoteSeq(seq2, instrument) doc.mixDown('FlyMeToTheMoon_just.wav') #targetBuf=ScoreDraft.TrackBuffer() #doc.mix(targetBuf) #ScoreDraft.PlayTrackBuffer(targetBuf) #import time #while (ScoreDraft.PlayGetRemainingTime()>0.0): #time.sleep(1.0) ================================================ FILE: Test/FlyMeToTheMoon_eq.py ================================================ #!/usr/bin/python3 import ScoreDraft from ScoreDraft.Notes import * def soS(octave=5, duration=48): return note(octave,Freqs[8],duration) doc=ScoreDraft.Document() doc.setReferenceFrequency(264.0 *1.25) doc.setTempo(120) seq1 = [do(6,72), ti(5,24), la(5,24), so(5,72)] seq2 = [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [fa(5,96), BL(24), so(5,24), la(5,24), do(6,24)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48),fa(4,48)] seq1 = seq1 + [ti(5,72), la(5,24), so(5,24), fa(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [mi(5,144), BL(48)] seq2 = seq2 + [do(3,192), BK(144), so(3,48), do(4,48), mi(4,48)] seq1 = seq1 + [la(5,72), so(5,24), fa(5,24), mi(5,72)] seq2 = seq2 + [fa(3,192), BK(144), do(4,48), mi(4,48), la(4,48)] seq1 = seq1 + [re(5,72), mi(5,24), fa(5,24), la(5,72)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] seq1 = seq1 + [soS(5,72), fa(5,24), mi(5,24), re(5,72)] seq2 = seq2 + [mi(3,192), BK(144), ti(3,48), re(4,48), soS(4,48)] seq1 = seq1 + [do(5,144), BL(48)] seq2 = seq2 + [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [re(5,24), la(5,72), la(5,96)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] seq1 = seq1 + [BL(96), do(6,24), ti(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [so(5,144), BL(48)] seq2 = seq2 + [mi(3,192), BK(144), ti(3,48), re(4,48), so(4,48)] seq1 = seq1 + [la(4,24), fa(5,72), fa(5,96)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] seq1 = seq1 + [BL(96), la(5,72), so(5,24)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [fa(5,24), mi(5,120), BL(48)] seq2 = seq2 + [do(3,192), BK(144), so(3,48), do(4,48), mi(4,48)] seq1 = seq1 + [do(6,72), ti(5,24), la(5,24), so(5,72)] seq2 = seq2 + [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [fa(5,96), BL(24), so(5,24), la(5,24), do(6,24)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48),fa(4,48)] seq1 = seq1 + [ti(5,72), la(5,24), so(5,24), fa(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [mi(5,144), BL(48)] seq2 = seq2 + [do(3,192), BK(144), so(3,48), do(4,48), mi(4,48)] seq1 = seq1 + [la(5,72), so(5,24), fa(5,24), mi(5,72)] seq2 = seq2 + [fa(3,192), BK(144), do(4,48), mi(4,48), la(4,48)] seq1 = seq1 + [re(5,72), mi(5,24), fa(5,24), la(5,72)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] seq1 = seq1 + [soS(5,72), la(5,24), ti(5,24), ti(5,72)] seq2 = seq2 + [mi(3,192), BK(144), ti(3,48), re(4,48), soS(4,48)] seq1 = seq1 + [do(6,24), ti(5,24), la(5,96), BL(48)] seq2 = seq2 + [la(3,192), BK(144), mi(4,48), so(4,48), do(5,48)] seq1 = seq1 + [la(5,24), so(5,72), la(5,24), so(5,24), fa(5,48)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] seq1 = seq1 + [BL(96), do(6,24), ti(5,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [mi(6,144), BL(48)] seq2 = seq2 + [fa(3,192), BK(144), do(4,48), mi(4,48), la(4,48)] seq1 = seq1 + [mi(6,24), do(6,72), do(6,96)] seq2 = seq2 + [re(3,192), BK(144), la(3,48), do(4,48), fa(4,48)] seq1 = seq1 + [BL(96), ti(5,24), re(6,72)] seq2 = seq2 + [so(3,192), BK(144), re(4,48), fa(4,48), ti(4,48)] seq1 = seq1 + [do(6,192)] seq2 = seq2 + [do(3,192), BK(180), so(3,180), BK(168), do(4,168), BK(156), mi(4,156), BK(144), so(4,144), BK(132), do(5,132) ] # instrument=ScoreDraft.Piano() instrument = ScoreDraft.SF2Instrument('florestan-subset.sf2', 0) doc.playNoteSeq(seq1, instrument) doc.playNoteSeq(seq2, instrument) doc.mixDown('FlyMeToTheMoon_eq.wav') ScoreDraft.WriteNoteSequencesToMidi([seq1, seq2], 120, 264.0 *1.25, "FlyMeToTheMoon.mid") ================================================ FILE: Test/Hello.py ================================================ #!/usr/bin/python3 import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.Document() seq=[do(),do(),so(),so(),la(),la(),so(5,96)] doc.playNoteSeq(seq, ScoreDraft.KarplusStrongInstrument()) #doc.mixDown('Hello.wav') targetBuf=ScoreDraft.TrackBuffer(-1) doc.mix(targetBuf) ScoreDraft.PlayTrackBuffer(targetBuf) ================================================ FILE: Test/HelloMeteor.py ================================================ #!/usr/bin/python3 import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.MeteorDocument() seq=[do(),do(),so(),so(),la(),la(),so(5,96)] doc.playNoteSeq(seq, ScoreDraft.NaivePiano()) doc.meteor() doc.mixDown('HelloMeteor.wav') ================================================ FILE: Test/InstrumentSamples/Ah.freq ================================================ 261.055817 ================================================ FILE: Test/InstrumentSamples/Cello.freq ================================================ 65.430267 ================================================ FILE: Test/InstrumentSamples/CleanGuitar.freq ================================================ 263.026093 ================================================ FILE: Test/InstrumentSamples/Lah.freq ================================================ 260.946747 ================================================ FILE: Test/InstrumentSamples/Piano/Alesis-Fusion-Bright-Acoustic-Piano-C2.freq ================================================ 66.116943 ================================================ FILE: Test/InstrumentSamples/Piano/Alesis-Fusion-Bright-Acoustic-Piano-C4.freq ================================================ 264.071869 ================================================ FILE: Test/InstrumentSamples/Piano/Alesis-Fusion-Bright-Acoustic-Piano-C6.freq ================================================ 1050.000000 ================================================ FILE: Test/InstrumentSamples/String.freq ================================================ 262.500000 ================================================ FILE: Test/InstrumentSamples/Violin.freq ================================================ 525.000000 ================================================ FILE: Test/PrintCatalog.py ================================================ #!/usr/bin/python3 import ScoreDraft ScoreDraft.PrintCatalog() ================================================ FILE: Test/ZhenDeAiNi.ly ================================================ \version "2.18.2" \header { title = "真的爱你" composer = "黄家驹" } \score { << \new Staff \relative c'' { \time 2/4 r8 g8 c d e e16 e e d c8 d4 r8 d16 e d c c c b8 c a4 r8 c16 d e e e e d8 c d16 d d d c8 b c2 r8 g c d e e16 e e d c8 d4 r8 d16 e d c c c b8 c a4 r8 c16 d e e e e d8 c d16 d d d c8 b c2 r4 e8 d c16 c c c c8 d d4 e8 d c16 c c c e8 f d2 r4 e16 f8. g16 g g g g f e g g4 r8 g16 g a8 e8 e16 d16 c16 d16 e4 r8 e16 d16 c4. c8 d4 e16 d c8 c2 r4 e16 f8. g16 g g g g f e g g4 r8 g16 g a8 e8 e16 d16 c16 d16 e4 r8 e16 d16 c4. c8 d4 e16 d c8 c2 } \new Staff \relative c { \clef "bass" c8 g' g c, g' g g, d' d a e' e f, c' c c g' g g, d' d c g' g g g c, g' g g, d' d a e' e f, c' c c g' g g, d' d c g' g g g f, c' c g d' d f, c' c g d' d d d c g' g g, d' d a e' e e, b' b f c' c g d' d c g' g g g c, g' g g, d' d a e' e e, b' b f c' c g d' d c g' g 2 } \drums { bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh } >> \layout {} \midi { \tempo 4 = 72 } } ================================================ FILE: Test/ZhenDeAiNi.xml ================================================ python-ly 0.9.7 2021-11-24 8 G 2 4 1 eighth G 4 4 1 eighth C 5 4 1 eighth D 5 4 1 eighth 16 E 5 4 1 eighth E 5 2 1 16th E 5 2 1 16th E 5 2 1 16th D 5 2 1 16th C 5 4 1 eighth D 5 8 1 quarter 4 1 eighth D 5 2 1 16th E 5 2 1 16th D 5 2 1 16th C 5 2 1 16th C 5 2 1 16th C 5 2 1 16th B 4 4 1 eighth C 5 4 1 eighth A 4 8 1 quarter 4 1 eighth C 5 2 1 16th D 5 2 1 16th E 5 2 1 16th E 5 2 1 16th E 5 2 1 16th E 5 2 1 16th D 5 4 1 eighth C 5 4 1 eighth D 5 2 1 16th D 5 2 1 16th D 5 2 1 16th D 5 2 1 16th C 5 4 1 eighth B 4 4 1 eighth C 5 16 1 half 4 1 eighth G 4 4 1 eighth C 5 4 1 eighth D 5 4 1 eighth E 5 4 1 eighth E 5 2 1 16th E 5 2 1 16th E 5 2 1 16th D 5 2 1 16th C 5 4 1 eighth D 5 8 1 quarter 4 1 eighth D 5 2 1 16th E 5 2 1 16th D 5 2 1 16th C 5 2 1 16th C 5 2 1 16th C 5 2 1 16th B 4 4 1 eighth C 5 4 1 eighth A 4 8 1 quarter 4 1 eighth C 5 2 1 16th D 5 2 1 16th E 5 2 1 16th E 5 2 1 16th E 5 2 1 16th E 5 2 1 16th D 5 4 1 eighth C 5 4 1 eighth D 5 2 1 16th D 5 2 1 16th D 5 2 1 16th D 5 2 1 16th C 5 4 1 eighth B 4 4 1 eighth C 5 16 1 half 8 1 quarter E 5 4 1 eighth D 5 4 1 eighth C 5 2 1 16th C 5 2 1 16th C 5 2 1 16th C 5 2 1 16th C 5 4 1 eighth D 5 4 1 eighth D 5 8 1 quarter E 5 4 1 eighth D 5 4 1 eighth C 5 2 1 16th C 5 2 1 16th C 5 2 1 16th C 5 2 1 16th E 5 4 1 eighth F 5 4 1 eighth D 5 16 1 half 8 1 quarter E 5 2 1 16th F 5 6 1 eighth G 5 2 1 16th G 5 2 1 16th G 5 2 1 16th G 5 2 1 16th G 5 2 1 16th F 5 2 1 16th E 5 2 1 16th G 5 2 1 16th G 5 8 1 quarter 4 1 eighth G 5 2 1 16th G 5 2 1 16th A 5 4 1 eighth E 5 4 1 eighth E 5 2 1 16th D 5 2 1 16th C 5 2 1 16th D 5 2 1 16th E 5 8 1 quarter 4 1 eighth E 5 2 1 16th D 5 2 1 16th C 5 12 1 quarter C 5 4 1 eighth D 5 8 1 quarter E 5 2 1 16th D 5 2 1 16th C 5 4 1 eighth C 5 16 1 half 8 1 quarter E 5 2 1 16th F 5 6 1 eighth G 5 2 1 16th G 5 2 1 16th G 5 2 1 16th G 5 2 1 16th G 5 2 1 16th F 5 2 1 16th E 5 2 1 16th G 5 2 1 16th G 5 8 1 quarter 4 1 eighth G 5 2 1 16th G 5 2 1 16th A 5 4 1 eighth E 5 4 1 eighth E 5 2 1 16th D 5 2 1 16th C 5 2 1 16th D 5 2 1 16th E 5 8 1 quarter 4 1 eighth E 5 2 1 16th D 5 2 1 16th C 5 12 1 quarter C 5 4 1 eighth D 5 8 1 quarter E 5 2 1 16th D 5 2 1 16th C 5 4 1 eighth C 5 16 1 half 4 1 eighth G 4 4 1 eighth C 5 4 1 eighth D 5 4 1 eighth 8 F 4 C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 3 4 1 eighth 20 20 G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth A 2 4 1 eighth E 3 4 1 eighth A 3 4 1 eighth C 4 4 1 eighth E 3 4 1 eighth F 2 4 1 eighth C 3 4 1 eighth F 3 4 1 eighth A 3 4 1 eighth C 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth A 2 4 1 eighth E 3 4 1 eighth A 3 4 1 eighth C 4 4 1 eighth E 3 4 1 eighth F 2 4 1 eighth C 3 4 1 eighth F 3 4 1 eighth A 3 4 1 eighth C 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth F 2 4 1 eighth C 3 4 1 eighth F 3 4 1 eighth A 3 4 1 eighth C 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth F 2 4 1 eighth C 3 4 1 eighth F 3 4 1 eighth A 3 4 1 eighth C 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth A 2 4 1 eighth E 3 4 1 eighth A 3 4 1 eighth C 4 4 1 eighth E 3 4 1 eighth E 2 4 1 eighth B 2 4 1 eighth E 3 4 1 eighth G 3 4 1 eighth B 2 4 1 eighth F 2 4 1 eighth C 3 4 1 eighth F 3 4 1 eighth A 3 4 1 eighth C 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth A 2 4 1 eighth E 3 4 1 eighth A 3 4 1 eighth C 4 4 1 eighth E 3 4 1 eighth E 2 4 1 eighth B 2 4 1 eighth E 3 4 1 eighth G 3 4 1 eighth B 2 4 1 eighth F 2 4 1 eighth C 3 4 1 eighth F 3 4 1 eighth A 3 4 1 eighth C 3 4 1 eighth G 2 4 1 eighth D 3 4 1 eighth G 3 4 1 eighth B 3 4 1 eighth D 3 4 1 eighth C 3 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth C 4 4 1 eighth E 4 4 1 eighth G 3 4 1 eighth quarter 72 ================================================ FILE: Test/ZhenDeAiNi.yaml ================================================ score: title: 真的爱你 composer: 黄家驹 tempo: 72 staffs: - is_drum: false relative: c'' instrument: Arachno(40) content: | \time 2/4 r8 g8 c d e e16 e e d c8 d4 r8 d16 e d c c c b8 c a4 r8 c16 d e e e e d8 c d16 d d d c8 b c2 r8 g c d e e16 e e d c8 d4 r8 d16 e d c c c b8 c a4 r8 c16 d e e e e d8 c d16 d d d c8 b c2 r4 e8 d c16 c c c c8 d d4 e8 d c16 c c c e8 f d2 r4 e16 f8. g16 g g g g f e g g4 r8 g16 g a8 e8 e16 d16 c16 d16 e4 r8 e16 d16 c4. c8 d4 e16 d c8 c2 r4 e16 f8. g16 g g g g f e g g4 r8 g16 g a8 e8 e16 d16 c16 d16 e4 r8 e16 d16 c4. c8 d4 e16 d c8 c2 - is_drum: false relative: c instrument: Arachno(0) content: | \clef "bass" c8 g' g c, g' g g, d' d a e' e f, c' c c g' g g, d' d c g' g g g c, g' g g, d' d a e' e f, c' c c g' g g, d' d c g' g g g f, c' c g d' d f, c' c g d' d d d c g' g g, d' d a e' e e, b' b f c' c g d' d c g' g g g c, g' g g, d' d a e' e e, b' b f c' c g d' d c g' g 2 - is_drum: true instrument: Arachno(128) content: | bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh bd8 hh16 hh hh hh hh hh ================================================ FILE: Test/percussion_test.py ================================================ #!/usr/bin/python3 import ScoreDraft BassDrum=ScoreDraft.BassDrum() Snare=ScoreDraft.Snare() perc_list= [BassDrum, Snare] def dong(duration=48): return (0,duration) def ca(duration=48): return (1,duration) def Bl(duration=48): return (-1, duration) def Bk(duration=48): return (-1, -duration) doc=ScoreDraft.Document() doc.setTempo(120) seq = [dong(), ca(24), dong(24), dong(), ca(), dong(), ca(24), dong(24), dong(), ca()] doc.playBeatSeq(seq, perc_list) doc.mixDown('test_perc.wav') ================================================ FILE: Test/piano_test.py ================================================ #!/usr/bin/python3 import ScoreDraft from ScoreDraft.Notes import * Piano = ScoreDraft.Piano() doc=ScoreDraft.Document() doc.setReferenceFrequency(318.0) doc.setTempo(80) seq1 = [la(4,48), do(5,48), re(5,36), do(5,36), re(5,24)] seq2 = [la(3,96), BK(96), do(4,96), BK(96), mi(4,96), re(4,96), BK(96), fa(4,96), BK(96), la(4,96)] seq1 = seq1+[re(5,48), so(5,24), fa(5,24), mi(5,12), re(5,24), mi(5,56)] seq2 = seq2+[so(3,96), BK(96), ti(3,96), BK(96), re(4,96), do(4,96), BK(96), mi(4,96), BK(96), so(4,96)] seq1 = seq1+[mi(5,48), so(5,48), la(5,36), re(5,36), do(5,24)] seq2 = seq2+[la(3,96), BK(96), do(4,96), BK(96), mi(4,96), re(4,96), BK(96), fa(4,96), BK(96), la(4,96)] seq1 = seq1+[so(5,48), mi(5,24), so(5,24), so(5,36), BK(36), mi(5,36), la(5,56), BK(56), fa(5,56)] seq2 = seq2+[mi(4,96), BK(96), so(4,96), BK(96), ti(4,96), fa(4,96), BK(96), la(4,96), BK(96), do(5,96)]; doc.playNoteSeq(seq1, Piano) doc.playNoteSeq(seq2, Piano) doc.mixDown('piano_test.wav') ================================================ FILE: Test/sunshine.yaml ================================================ score: tempo: 150 title: You Are My Sunshine composer: Jimmie Davis staffs: - relative: c' is_vocal: true singer: TetoEng_UTAU() converter: TTEnglishConverter content: | r4 g c d e2 e2 r4 e dis e d4 (c) c2 r4 c d e f2 g4 (a) r4 a g f e2. r4 utau: | ju Ar maI s@n SaIn. maI oU nli s@n SaIn. ju meIk mi h{p i. wEn skaIz Ar greI. - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 pedal: | bd1 bd1 bd1 bd1 bd1 bd1 bd1 bd1 # - # relative: c # instrument: Arachno(24) # sweep: 0.1 # content: | # \clef "bass" # c4 e 2 # c,4 e 2 # c,4 e 2 # f,4 a 2 # f,4 a 2 # g,4 b 2 # g,4 b 2 # c4 e 2 - is_drum: true instrument: Arachno(128) content: | bd4 hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh ================================================ FILE: Test/test.yaml ================================================ score: title: My song composer: Me tempo: 120 staffs: - relative: c' instrument: KarplusStrongInstrument() content: | r8 e e e c2 ================================================ FILE: Test/test_xml.py ================================================ import ScoreDraft as sd # doc = sd.from_music_xml("ZhenDeAiNi.xml") doc = sd.from_lilypond("ZhenDeAiNi.ly") instrument = sd.SF2Instrument('florestan-subset.sf2', 0) # instrument = sd.Sawtooth() doc.playXML([instrument]) # doc.mixDown('ZhenDeAiNi.wav') doc.meteor() ================================================ FILE: Test/test_yaml.py ================================================ import ScoreDraft as sd sd.run_yaml() ================================================ FILE: VoiceSampler/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) project(VoiceSampler) set(USE_CUDA true CACHE BOOL "Voice Sampler Use CUDA") if (USE_CUDA) find_package(CUDA REQUIRED) endif () set(SOURCES ../DSPUtil/complex.cpp ../DSPUtil/fft.cpp api.cpp FrequencyDetection.cpp SentenceGeneratorGeneral.cpp SentenceGeneratorCPU.cpp ) set(HEADERS ../DSPUtil/complex.h ../DSPUtil/fft.h FrequencyDetection.h VoiceUtil.h SentenceDescriptor.h SentenceGeneratorGeneral.h SentenceGeneratorCPU.h ) set (INCLUDE_DIR . ../ScoreDraftCore ../DSPUtil ) if (WIN32) set (DEFINES ${DEFINES} -D"_CRT_SECURE_NO_DEPRECATE" -D"_SCL_SECURE_NO_DEPRECATE" ) else() add_definitions(-std=c++0x) add_compile_options(-fPIC) endif() if (USE_CUDA) set(SOURCES ${SOURCES} HNM.cu SentenceGeneratorCUDA.cpp ) set(HEADERS ${HEADERS} helper_math.h VoiceUtil.cuh fft.cuh DVVector.hpp SentenceGeneratorCUDA.h ) set (DEFINES ${DEFINES} -D"HAVE_CUDA") endif () include_directories(${INCLUDE_DIR}) add_definitions(${DEFINES}) if (USE_CUDA) cuda_add_library (VoiceSampler SHARED ${SOURCES} ${HEADERS}) else() add_library (VoiceSampler SHARED ${SOURCES} ${HEADERS}) endif() target_link_libraries(VoiceSampler ScoreDraftCore) if (WIN32) target_compile_definitions(VoiceSampler PUBLIC SCOREDRAFTCORE_DLL_IMPORT) endif() if (WIN32) install(TARGETS VoiceSampler RUNTIME DESTINATION ScoreDraft) else() install(TARGETS VoiceSampler DESTINATION ScoreDraft) endif() ================================================ FILE: VoiceSampler/DVVector.hpp ================================================ #include template struct VectorView { unsigned count; T* d_data; }; template class DVVector { public: typedef VectorView ViewType; DVVector() { m_count = 0; m_data = nullptr; } virtual ~DVVector() { Free(); } ViewType view() { return{ m_count, m_data }; } unsigned Count() const { return m_count; } T* Pointer() { return m_data; } const T* ConstPointer() const { return m_data; } operator T*() { return m_data; } operator const T*() { return m_data; } void Free() { if (m_data != nullptr) { cudaFree(m_data); m_data = nullptr; } m_count = 0; } void Allocate(unsigned count) { Free(); m_count = count; if (m_count>0) cudaMalloc(&m_data, sizeof(T)*count); } const DVVector& operator = (const std::vector& cpuVec) { Free(); Allocate((unsigned)cpuVec.size()); if (m_count > 0) { cudaMemcpy(m_data, cpuVec.data(), sizeof(T)*m_count, cudaMemcpyHostToDevice); } return *this; } void ToCPU(std::vector& cpuVec) const { cpuVec.resize(m_count); cudaMemcpy(cpuVec.data(), m_data, sizeof(T)*m_count, cudaMemcpyDeviceToHost); } void Update(const std::vector& cpuVec) { if (cpuVec.size() != m_count) *this = cpuVec; else if (m_count > 0) cudaMemcpy(m_data, cpuVec.data(), sizeof(T)*m_count, cudaMemcpyHostToDevice); } protected: unsigned m_count; T* m_data; }; template class DVImagedVector : public DVVector { public: void Allocate(const std::vector& counts) { unsigned count = (unsigned)counts.size(); m_vecs.resize(count); std::vector tmp(count); for (size_t i = 0; i < count; i++) { m_vecs[i].Allocate(counts[i]); tmp[i] = m_vecs[i].view(); } DVVector::operator = (tmp); } const DVImagedVector& operator = (const std::vector& cpuVecs) { unsigned count = (unsigned)cpuVecs.size(); m_vecs.resize(count); std::vector tmp(count); for (unsigned i = 0; i < count; i++) { m_vecs[i] = cpuVecs[i]; tmp[i] = m_vecs[i].view(); } DVVector::operator = (tmp); return *this; } void ToCPU(std::vector& cpuVecs) const { unsigned count = (unsigned)m_vecs.size(); cpuVecs.resize(count); for (unsigned i = 0; i < count; i++) m_vecs[i].ToCPU(cpuVecs[i]); } void Update(const std::vector& cpuVecs) { if (cpuVecs.size() != m_vecs.size()) *this = cpuVecs; else { size_t count = m_vecs.size(); std::vector tmp(count); for (size_t i = 0; i < count; i++) { m_vecs[i].Update(cpuVecs[i]); tmp[i] = m_vecs[i].view(); } DVVector::Update(tmp); } } private: std::vector m_vecs; }; template using DVLevel2Vector = DVImagedVector , std::vector>; ================================================ FILE: VoiceSampler/FrequencyDetection.cpp ================================================ #include "FrequencyDetection.h" #include "fft.h" #include #include #include #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif void fetchFrequency(unsigned length, float *samples, unsigned sampleRate, float& freq, float& dyn) { unsigned len = 1; unsigned l = 0; while (len < length*2) { l++; len <<= 1; } DComp* fftData = new DComp[len]; memset(fftData, 0, sizeof(DComp)*len); for (unsigned i = 0; i 0.01) { unsigned maxi = (unsigned)(-1); double lastV = fftData[0].Re; double maxV = 0.0f; bool ascending = false; for (unsigned i = sampleRate / 600; i < min(sampleRate / 55, len / 2); i++) { double v = fftData[i].Re; if (!ascending) { if (v > lastV) ascending = true; } else { if (v < lastV) { if (fftData[i - 1].Re>maxV) { maxV = fftData[i - 1].Re; maxi = i - 1; } ascending = false; } } lastV = v; } if (maxi != (unsigned)(-1) && maxV > 0.3f* fftData[0].Re) { freq = (float)sampleRate / (float)maxi; } } delete[] fftData; } ================================================ FILE: VoiceSampler/FrequencyDetection.h ================================================ #ifndef _FrequencyDetection_h #define _FrequencyDetection_h void fetchFrequency(unsigned length, float *samples, unsigned sampleRate, float& freq, float& dyn); #endif ================================================ FILE: VoiceSampler/HNM.cu ================================================ #include #include #include #include unsigned calcGroupSize(unsigned workPerGroup) { unsigned s = 1; while (s < workPerGroup && s<256) s <<= 1; return s; } #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif template struct VectorView { unsigned count; T* d_data; }; struct SrcSampleInfo { unsigned srcPos; float srcSampleFreq; float dstPos; int isVowel; }; struct Job { unsigned pieceId; unsigned jobOfPiece; }; struct DstPieceInfo { float minSampleFreq; unsigned uSumLen; float tempLen; unsigned uTempLen; float fTmpWinCenter0; }; struct SynthJobInfo { unsigned pieceId; unsigned jobOfPiece; unsigned srcPieceId0; unsigned srcPieceId1; float k_srcPiece; unsigned paramId00; unsigned paramId10; float k0; float k1; float destHalfWinLen; }; struct CUDATempBuffer { unsigned count; float *d_data; }; extern __shared__ unsigned char sbuf[]; __global__ void g_GetMaxVoiced(VectorView> cuSrcBufs, VectorView> pieceInfoList, VectorView> cuMaxVoicedLists, VectorView jobMap, unsigned BufSize) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; const Job& job = jobMap.d_data[blockIdx.x]; unsigned pieceId = job.pieceId; const VectorView& pieceInfo = pieceInfoList.d_data[pieceId]; unsigned paramId = job.jobOfPiece; SrcSampleInfo& posInfo = pieceInfo.d_data[paramId]; float fhalfWinlen = 3.0f / posInfo.srcSampleFreq; unsigned u_halfWidth = (unsigned)ceilf(fhalfWinlen); unsigned uSpecLen = (unsigned)ceilf(fhalfWinlen*0.5f); unsigned fftLen = 1; while (fftLen < u_halfWidth) { fftLen <<= 1; } bool skip = u_halfWidth * 2 + fftLen * 2> BufSize; float *s_buf1 = (float*)sbuf; float *s_buf2 = (float*)sbuf + u_halfWidth * 2; if (!skip) { const VectorView& srcBuf = cuSrcBufs.d_data[pieceId]; d_captureFromBuf(srcBuf.count, srcBuf.d_data, posInfo.srcPos, fhalfWinlen, u_halfWidth, s_buf1); d_CreateAmpSpectrumFromWindow(fhalfWinlen, u_halfWidth, s_buf1, s_buf2, uSpecLen); } unsigned& maxVoiced = *((unsigned*)sbuf + BufSize - 1); if (workerId == 0) maxVoiced = 0; __syncthreads(); if (!skip) { for (unsigned i = 6 + 3 * workerId; i + 4 < uSpecLen; i += 3 * numWorker) { unsigned count = 0; for (int j = -3; j <= 3; j += 3) { float absv0 = s_buf2[(int)i + j]; float absv1 = s_buf2[(int)i + j - 1]; float absv2 = s_buf2[(int)i + j + 1]; float rate = absv0 / (absv0 + absv1 + absv2); if (rate > 0.7f) { count++; } } if (count > 1) { atomicMax(&maxVoiced, i / 3 + 1); } } __syncthreads(); } VectorView& d_maxVoicedList = cuMaxVoicedLists.d_data[pieceId]; if (workerId==0) d_maxVoicedList.d_data[job.jobOfPiece] = maxVoiced; } void h_GetMaxVoiced(VectorView> cuSrcBufs, VectorView> pieceInfoList, VectorView> cuMaxVoicedLists, VectorView jobMap, unsigned BufSize) { if (BufSize > 12000) BufSize = 12000; unsigned groupSize = calcGroupSize(BufSize/4); unsigned sharedBufSize = (unsigned)sizeof(float)* BufSize; g_GetMaxVoiced << < jobMap.count, groupSize, sharedBufSize >> > (cuSrcBufs, pieceInfoList, cuMaxVoicedLists, jobMap, BufSize); } __global__ void g_AnalyzeInput(VectorView> cuSrcBufs, VectorView> pieceInfoList, unsigned halfWinLen, unsigned specLen, VectorView> cuHarmWindows, VectorView> cuNoiseSpecs, VectorView> cuMaxVoicedLists, VectorView jobMap, unsigned BufSize) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; const Job& job = jobMap.d_data[blockIdx.x]; unsigned pieceId = job.pieceId; const VectorView& pieceInfo = pieceInfoList.d_data[pieceId]; unsigned paramId = job.jobOfPiece; SrcSampleInfo& posInfo = pieceInfo.d_data[paramId]; unsigned *d_maxVoiced = cuMaxVoicedLists.d_data[pieceId].d_data; float* d_HarmWindows = cuHarmWindows.d_data[pieceId].d_data; float* d_NoiseSpecs = cuNoiseSpecs.d_data[pieceId].d_data; unsigned maxVoiced = (unsigned)(-1); if (posInfo.isVowel<2) maxVoiced = d_maxVoiced[paramId]; float srcHalfWinWidth = 1.0f / posInfo.srcSampleFreq; unsigned u_srchalfWidth = (unsigned)ceilf(srcHalfWinWidth); unsigned uSpecLen = (unsigned)ceilf(srcHalfWinWidth*0.5f); float *s_buf1 = (float*)sbuf; // capture float *s_buf2 = (float*)sbuf + u_srchalfWidth * 2; // Amplitude spectrum const VectorView& srcBuf = cuSrcBufs.d_data[pieceId]; d_captureFromBuf(srcBuf.count, srcBuf.d_data, posInfo.srcPos, srcHalfWinWidth, u_srchalfWidth, s_buf1); d_CreateAmpSpectrumFromWindow(srcHalfWinWidth, u_srchalfWidth, s_buf1, s_buf2, uSpecLen); for (unsigned i = workerId; i < specLen; i += numWorker) { float amplitude = 0.0f; if (posInfo.isVowel<2 && i>maxVoiced && i < uSpecLen) { amplitude = s_buf2[i]; s_buf2[i] = 0.0f; } d_NoiseSpecs[i + paramId*specLen] = amplitude; } __syncthreads(); d_CreateSymmetricWindowFromAmpSpec(s_buf2, uSpecLen, srcHalfWinWidth, u_srchalfWidth, s_buf2); for (unsigned i = workerId; i < halfWinLen; i += numWorker) { float v = 0.0f; if (i < u_srchalfWidth) { v = s_buf2[i]; } d_HarmWindows[i + paramId*halfWinLen] = v; } } void h_AnalyzeInput(VectorView> cuSrcBufs, VectorView> pieceInfoList, unsigned halfWinLen, unsigned specLen, VectorView> cuHarmWindows, VectorView> cuNoiseSpecs, VectorView> cuMaxVoicedLists, VectorView jobMap, unsigned BufSize) { unsigned groupSize = calcGroupSize(BufSize / 4); unsigned sharedBufSize = (unsigned)sizeof(float)* BufSize; g_AnalyzeInput << < jobMap.count, groupSize, sharedBufSize >> > (cuSrcBufs, pieceInfoList, halfWinLen, specLen, cuHarmWindows, cuNoiseSpecs, cuMaxVoicedLists, jobMap, BufSize); } __global__ void g_Synthesis(VectorView> cuSrcPieceInfos, unsigned halfWinLen, unsigned specLen, VectorView> cuHarmWindows, VectorView> cuNoiseSpecs, VectorView cuDstPieceInfos, VectorView cuTmpBufs1, VectorView cuTmpBufs2, VectorView cuRandPhase, VectorView cuSynthJobs) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; const SynthJobInfo& job = cuSynthJobs.d_data[blockIdx.x]; unsigned dstPieceId = job.pieceId; unsigned srcPieceId0 = job.srcPieceId0; unsigned srcPieceId1 = job.srcPieceId1; unsigned dstParamId = job.jobOfPiece; const VectorView& srcPieceInfo0 = cuSrcPieceInfos.d_data[srcPieceId0]; const VectorView& srcPieceInfo1 = cuSrcPieceInfos.d_data[srcPieceId1]; const DstPieceInfo& dstPieceInfo = cuDstPieceInfos.d_data[dstPieceId]; CUDATempBuffer& cuTmpBuf = dstParamId % 2 == 0 ? cuTmpBufs1.d_data[dstPieceId] : cuTmpBufs2.d_data[dstPieceId]; float tempHalfWinLen = 1.0f / dstPieceInfo.minSampleFreq; unsigned u_tempHalfWinLen = (unsigned)ceilf(tempHalfWinLen); float fTmpWinCenter = dstPieceInfo.fTmpWinCenter0 + dstParamId* tempHalfWinLen; float destHalfWinLen = job.destHalfWinLen; unsigned u_destHalfWinLen = (unsigned)ceilf(destHalfWinLen); unsigned uSpecLen = (unsigned)ceilf(destHalfWinLen*0.5f); unsigned uRandPhaseInterval = (unsigned)ceilf(tempHalfWinLen*0.5f); unsigned paramId00, paramId01, paramId10, paramId11; float srcHalfWinWidth00, srcHalfWinWidth01, srcHalfWinWidth10, srcHalfWinWidth11; float* noiseBuf = (float*)sbuf; // max(2 * fftLen, 2 * u_tempHalfWinLen) +2*fftlen for (unsigned i = workerId; i < u_tempHalfWinLen; i += numWorker) noiseBuf[i] = 0.0f; __syncthreads(); bool haveNoise = false; if (job.k_srcPiece < 1.0f) { paramId00 = job.paramId00; paramId01 = paramId00 + 1; if (paramId01 >= srcPieceInfo0.count) paramId01 = paramId00; SrcSampleInfo& posInfo0 = srcPieceInfo0.d_data[paramId00]; SrcSampleInfo& posInfo1 = srcPieceInfo0.d_data[paramId01]; srcHalfWinWidth00 = 1.0f / posInfo0.srcSampleFreq; srcHalfWinWidth01 = 1.0f / posInfo1.srcSampleFreq; float* d_NoiseSpecs = cuNoiseSpecs.d_data[srcPieceId0].d_data; float k = job.k0; if (k < 1.0f && posInfo0.isVowel<2) { haveNoise = true; AmpSpec_Scale(srcHalfWinWidth00, d_NoiseSpecs + specLen*paramId00, destHalfWinLen, noiseBuf, (1.0f - k)*(1.0f - job.k_srcPiece)); } if (k > 0.0f && posInfo1.isVowel<2) { haveNoise = true; AmpSpec_Scale(srcHalfWinWidth01, d_NoiseSpecs + specLen*paramId01, destHalfWinLen, noiseBuf, k*(1.0f - job.k_srcPiece)); } } if (job.k_srcPiece > 0.0f) { paramId10= job.paramId10; paramId11 = paramId10 + 1; if (paramId11 >= srcPieceInfo1.count) paramId11 = paramId10; SrcSampleInfo& posInfo0 = srcPieceInfo1.d_data[paramId10]; SrcSampleInfo& posInfo1 = srcPieceInfo1.d_data[paramId11]; srcHalfWinWidth10 = 1.0f / posInfo0.srcSampleFreq; srcHalfWinWidth11 = 1.0f / posInfo1.srcSampleFreq; float* d_NoiseSpecs = cuNoiseSpecs.d_data[srcPieceId1].d_data; float k = job.k1; if (k < 1.0f && posInfo0.isVowel<2) { haveNoise = true; AmpSpec_Scale(srcHalfWinWidth10, d_NoiseSpecs + specLen*paramId10, destHalfWinLen, noiseBuf, (1.0f - k)*job.k_srcPiece); } if (k > 0.0f && posInfo1.isVowel<2) { haveNoise = true; AmpSpec_Scale(srcHalfWinWidth11, d_NoiseSpecs + specLen*paramId11, destHalfWinLen, noiseBuf, k*job.k_srcPiece); } } if (haveNoise) { // apply random phases float* d_p_rand = cuRandPhase.d_data + dstParamId*uRandPhaseInterval; d_CreateNoiseWindowFromAmpSpec(noiseBuf, d_p_rand, uSpecLen, destHalfWinLen, u_destHalfWinLen, noiseBuf, tempHalfWinLen); Win_WriteToBuf(cuTmpBuf.count, cuTmpBuf.d_data, fTmpWinCenter, tempHalfWinLen, noiseBuf); } float* harmBuf = (float*)sbuf; for (unsigned i = workerId; i < tempHalfWinLen; i += numWorker) harmBuf[i] = 0.0f; __syncthreads(); if (job.k_srcPiece < 1.0f) { float *d_HarmWindows = cuHarmWindows.d_data[srcPieceId0].d_data; float k = job.k0; if (k < 1.0f) SymWin_Repitch_FormantPreserved(srcHalfWinWidth00, d_HarmWindows + halfWinLen*paramId00, destHalfWinLen, harmBuf, (1.0f - k)*(1.0f - job.k_srcPiece)); if (k > 0.0f) SymWin_Repitch_FormantPreserved(srcHalfWinWidth01, d_HarmWindows + halfWinLen*paramId01, destHalfWinLen, harmBuf, k*(1.0f - job.k_srcPiece)); } if (job.k_srcPiece > 0.0f) { float *d_HarmWindows = cuHarmWindows.d_data[srcPieceId1].d_data; float k = job.k1; if (k < 1.0f) SymWin_Repitch_FormantPreserved(srcHalfWinWidth10, d_HarmWindows + halfWinLen*paramId10, destHalfWinLen, harmBuf, (1.0f - k)*job.k_srcPiece); if (k > 0.0f) SymWin_Repitch_FormantPreserved(srcHalfWinWidth11, d_HarmWindows + halfWinLen*paramId11, destHalfWinLen, harmBuf, k*job.k_srcPiece); } float* scaled_harmBuf = (float*)sbuf + u_destHalfWinLen; d_ScaleSymWindow(destHalfWinLen, u_destHalfWinLen, harmBuf, scaled_harmBuf, tempHalfWinLen); SymWin_WriteToBuf(cuTmpBuf.count, cuTmpBuf.d_data, fTmpWinCenter, tempHalfWinLen, scaled_harmBuf); } void h_Synthesis(VectorView> cuSrcPieceInfos, unsigned halfWinLen, unsigned specLen, VectorView> cuHarmWindows, VectorView> cuNoiseSpecs, VectorView cuDstPieceInfos, VectorView cuTmpBufs1, VectorView cuTmpBufs2, VectorView cuRandPhase, VectorView cuSynthJobs, unsigned BufSize) { unsigned groupSize = calcGroupSize(BufSize / 4); unsigned sharedBufSize = (unsigned)sizeof(float)* BufSize; g_Synthesis << < cuSynthJobs.count, groupSize, sharedBufSize >> > (cuSrcPieceInfos, halfWinLen, specLen, cuHarmWindows, cuNoiseSpecs, cuDstPieceInfos, cuTmpBufs1, cuTmpBufs2, cuRandPhase, cuSynthJobs); } __global__ void g_Merge2Bufs(unsigned uSumLen, float *d_destBuf1, float *d_destBuf2) { unsigned pos = threadIdx.x + blockIdx.x*blockDim.x; if (pos < uSumLen) d_destBuf1[pos] += d_destBuf2[pos]; } void h_Merge2Bufs(unsigned uSumLen, float *d_destBuf1, float *d_destBuf2) { static const unsigned groupSize = 256; g_Merge2Bufs << < (uSumLen - 1) / groupSize + 1, groupSize >> >(uSumLen, d_destBuf1, d_destBuf2); } ================================================ FILE: VoiceSampler/SentenceDescriptor.h ================================================ #ifndef __SentenceDescriptor_h #define __SentenceDescriptor_h #include struct Wav { float *buf; unsigned len; }; struct FrqDataPoint { double freq; double dyn; }; struct FrqData { int interval; double key; std::vector data; }; struct Source { Wav wav; FrqData frq; }; struct SourceMapCtrlPnt { float srcPos; float dstPos; int isVowel; // 0: notVowel, 1: preVowel, 2: isVowel }; struct Piece { Source src; std::vector srcMap; }; struct GeneralCtrlPnt { float value; float dstPos; }; struct SentenceDescriptor { std::vector pieces; std::vector piece_map; std::vector freq_map; std::vector volume_map; }; #endif ================================================ FILE: VoiceSampler/SentenceGeneratorCPU.cpp ================================================ #include "SentenceDescriptor.h" #include "SentenceGeneratorGeneral.h" #include "SentenceGeneratorCPU.h" #include "fft.h" #include "VoiceUtil.h" using namespace VoiceUtil; static float rate = 44100.0f; inline void Clamp01(float& v) { if (v < 0.0f) v = 0.0f; else if (v > 1.0f) v = 1.0f; } void GenerateSentenceCPU(const SentenceDescriptor* desc, float* outBuf, unsigned outBufLen) { class ParameterSet { public: SymmetricWindow HarmWindow; AmpSpectrum NoiseSpectrum; virtual ~ParameterSet(){} void Scale(const ParameterSet& src, float targetHalfWidth) { HarmWindow.Repitch_FormantPreserved(src.HarmWindow, targetHalfWidth); NoiseSpectrum.Scale(src.NoiseSpectrum, targetHalfWidth); } void Interpolate(const ParameterSet& param0, const ParameterSet& param1, float k) { HarmWindow.Interpolate(param0.HarmWindow, param1.HarmWindow, k, param0.HarmWindow.m_halfWidth); NoiseSpectrum.Interpolate(param0.NoiseSpectrum, param1.NoiseSpectrum, k, param0.NoiseSpectrum.m_halfWidth); } }; class ParameterSetWithPos : public ParameterSet { public: float m_pos; }; typedef std::vector ParameterVec; std::vector ParameterVecs; const std::vector& pieces = desc->pieces; ParameterVecs.resize(pieces.size()); for (size_t i = 0; i < pieces.size(); i++) { const Piece& piece = pieces[i]; ParameterVec& parameters = ParameterVecs[i]; int srcStart = (int)(piece.srcMap[0].srcPos*0.001f*rate); int srcEnd = (int)ceilf(piece.srcMap[piece.srcMap.size() - 1].srcPos*0.001f*rate); int bound = piece.src.frq.data.size() * piece.src.frq.interval; if (srcStart < 0) { srcStart = 0; } if (srcEnd > bound) { srcEnd = bound; } float fPeriodCount = 0.0f; unsigned i_srcMap = 0; unsigned lastmaxVoiced = 0; Buffer SrcBuffer; SrcBuffer.m_sampleRate = (unsigned)rate; RegulateSource(piece.src.wav.buf, piece.src.wav.len, SrcBuffer,srcStart,srcEnd); for (int srcPos = srcStart; srcPos < srcEnd; srcPos++) { float fsrcPos = (float)srcPos / rate*1000.0f; while (i_srcMap + 1 < piece.srcMap.size() && fsrcPos >= piece.srcMap[i_srcMap + 1].srcPos) i_srcMap++; int isVowel = piece.srcMap[i_srcMap].isVowel; float k_srcMap = (fsrcPos - piece.srcMap[i_srcMap].srcPos) / (piece.srcMap[i_srcMap + 1].srcPos - piece.srcMap[i_srcMap].srcPos); Clamp01(k_srcMap); float fdstPos = piece.srcMap[i_srcMap].dstPos*(1.0f - k_srcMap) + piece.srcMap[i_srcMap + 1].dstPos*k_srcMap; float dstPos = fdstPos*0.001f*rate; float srcSampleFreq; float srcFreqPos = (float)srcPos / (float)piece.src.frq.interval; unsigned uSrcFreqPos = (unsigned)srcFreqPos; float fracSrcFreqPos = srcFreqPos - (float)uSrcFreqPos; float freq1 = (float)piece.src.frq.data[uSrcFreqPos].freq; if (freq1 <= 55.0f) freq1 = (float)piece.src.frq.key; float freq2 = (float)piece.src.frq.data[uSrcFreqPos + 1].freq; if (freq2 <= 55.0f) freq2 = (float)piece.src.frq.key; float sampleFreq1 = freq1 / rate; float sampleFreq2 = freq2 / rate; srcSampleFreq = sampleFreq1*(1.0f - fracSrcFreqPos) + sampleFreq2*fracSrcFreqPos; unsigned paramId = (unsigned)fPeriodCount; if (paramId >= parameters.size()) { unsigned maxVoiced = 0; if (isVowel < 2) { float halfWinlen = 3.0f / srcSampleFreq; Window capture; capture.CreateFromBuffer(SrcBuffer, (float)(srcPos - srcStart), halfWinlen); AmpSpectrum capSpec; capSpec.CreateFromWindow(capture); unsigned char voiced_cache[3] = { 0, 0, 0 }; unsigned char cache_pos = 0; for (unsigned i = 3; i + 1 < capSpec.m_data.size(); i += 3) { double absv0 = capSpec.m_data[i]; double absv1 = capSpec.m_data[i - 1]; double absv2 = capSpec.m_data[i + 1]; double rate = absv0 / (absv0 + absv1 + absv2); if (rate > 0.7) { voiced_cache[cache_pos] = 1; } else { voiced_cache[cache_pos] = 0; } cache_pos = (cache_pos + 1) % 3; if (voiced_cache[0] + voiced_cache[1] + voiced_cache[2] > 1) { maxVoiced = i / 3; } } } if (isVowel > 0 && maxVoiced < lastmaxVoiced) maxVoiced = lastmaxVoiced; lastmaxVoiced = maxVoiced; ParameterSetWithPos paramSet; float srcHalfWinWidth = 1.0f / srcSampleFreq; Window srcWin; srcWin.CreateFromBuffer(SrcBuffer, (float)(srcPos - srcStart), srcHalfWinWidth); AmpSpectrum harmSpec; harmSpec.CreateFromWindow(srcWin); paramSet.NoiseSpectrum.Allocate(srcWin.m_halfWidth); if (isVowel < 2) { for (unsigned i = maxVoiced + 1; i < (unsigned)harmSpec.m_data.size(); i++) { float amplitude = harmSpec.m_data[i]; harmSpec.m_data[i] = 0.0f; if (i < (unsigned)paramSet.NoiseSpectrum.m_data.size()) { paramSet.NoiseSpectrum.m_data[i] = amplitude; } } } paramSet.HarmWindow.CreateFromAmpSpec(harmSpec); paramSet.m_pos = dstPos; parameters.push_back(paramSet); } fPeriodCount += srcSampleFreq; } } float* freqMap = new float[outBufLen]; std::vector bounds; PreprocessFreqMap(desc, outBufLen, freqMap, bounds); float phase = 0.0f; unsigned i_pieceMap = 0; unsigned i_volumeMap = 0; const std::vector& piece_map = desc->piece_map; const std::vector& volume_map = desc->volume_map; for (unsigned i = 0; i < (unsigned)bounds.size()-1; i++) { float* pFreqMap = freqMap + bounds[i]; unsigned uSumLen = bounds[i + 1] - bounds[i]; float minSampleFreq = FLT_MAX; for (unsigned pos = 0; pos < uSumLen; pos++) { float sampleFreq = pFreqMap[pos]; if (sampleFreq < minSampleFreq) minSampleFreq = sampleFreq; } float* stretchingMap; stretchingMap = new float[uSumLen]; float pos_tmpBuf = 0.0f; for (unsigned pos = 0; pos < uSumLen; pos++) { float sampleFreq; sampleFreq = pFreqMap[pos]; float speed = sampleFreq / minSampleFreq; pos_tmpBuf += speed; stretchingMap[pos] = pos_tmpBuf; } float tempLen = stretchingMap[uSumLen - 1]; unsigned uTempLen = (unsigned)ceilf(tempLen); Buffer tempBuf; tempBuf.m_sampleRate = (unsigned)rate; tempBuf.Allocate(uTempLen); float tempHalfWinLen = 1.0f / minSampleFreq; unsigned pos_local = 0; while (phase > -1.0f) phase -= 1.0f; float fTmpWinCenter; for (fTmpWinCenter = phase*tempHalfWinLen; fTmpWinCenter - tempHalfWinLen <= tempLen; fTmpWinCenter += tempHalfWinLen) { while (fTmpWinCenter > stretchingMap[pos_local] && pos_local < uSumLen - 1) pos_local++; unsigned pos_global = pos_local + bounds[i]; float f_pos_global = (float)pos_global / rate*1000.0f; while (i_pieceMap + 1 < piece_map.size() && f_pos_global >= piece_map[i_pieceMap + 1].dstPos) i_pieceMap++; float k_piece = (f_pos_global - piece_map[i_pieceMap].dstPos) / (piece_map[i_pieceMap + 1].dstPos - piece_map[i_pieceMap].dstPos); Clamp01(k_piece); float fPieceId = piece_map[i_pieceMap].value* (1.0f - k_piece) + piece_map[i_pieceMap + 1].value*k_piece; unsigned pieceId0 = (unsigned)fPieceId; float pieceId_frac = fPieceId - (float)pieceId0; unsigned pieceId1 = (unsigned)fPieceId +1; if (pieceId0 >= (unsigned)pieces.size()) pieceId0 = (unsigned)pieces.size() - 1; if (pieceId_frac == 0.0f || pieceId1 >= (unsigned)pieces.size()) { pieceId1 = pieceId0; pieceId_frac = 0.0f; } ParameterVec& parameters0 = ParameterVecs[pieceId0]; ParameterVec& parameters1 = ParameterVecs[pieceId1]; unsigned paramId00 = 0; unsigned paramId01 = 1; unsigned paramId10 = 0; unsigned paramId11 = 1; while (paramId01 pieceId0) { while (paramId11= param01.m_pos) k0 = 1.0f; else if ((float)pos_global <= param00.m_pos) k0 = 0.0f; else { k0 = ((float)pos_global - param00.m_pos) / (param01.m_pos - param00.m_pos); } float destSampleFreq = pFreqMap[pos_local]; float destHalfWinLen = 1.0f / destSampleFreq; ParameterSet scaledParam00; ParameterSet scaledParam01; ParameterSet l_param0; ParameterSet* destParam0 = &l_param0; scaledParam00.Scale(param00, destHalfWinLen); if (paramId00 == paramId01) { destParam0 = &scaledParam00; } else { scaledParam01.Scale(param01, destHalfWinLen); l_param0.Interpolate(scaledParam00, scaledParam01, k0); } ParameterSet* finalDestParam = destParam0; ParameterSet l_paramTransit; if (pieceId1 > pieceId0) { ParameterSetWithPos& param10 = parameters1[paramId10]; ParameterSetWithPos& param11 = parameters1[paramId11]; float k1; if ((float)pos_global >= param11.m_pos) k1 = 1.0f; else if ((float)pos_global <= param10.m_pos) k1 = 0.0f; else { k1 = ((float)pos_global - param10.m_pos) / (param11.m_pos - param10.m_pos); } ParameterSet scaledParam10; ParameterSet scaledParam11; ParameterSet l_param1; ParameterSet* destParam1 = &l_param1; scaledParam10.Scale(param10, destHalfWinLen); if (paramId10 == paramId11) { destParam1 = &scaledParam10; } else { scaledParam11.Scale(param11, destHalfWinLen); l_param1.Interpolate(scaledParam10, scaledParam11, k1); } finalDestParam = &l_paramTransit; l_paramTransit.Interpolate(*destParam0, *destParam1, pieceId_frac); } if (finalDestParam->HarmWindow.NonZero()) { SymmetricWindow l_destWin; SymmetricWindow *destWin = &l_destWin; if (finalDestParam->HarmWindow.m_halfWidth == tempHalfWinLen) destWin = &finalDestParam->HarmWindow; else l_destWin.Scale(finalDestParam->HarmWindow, tempHalfWinLen); destWin->MergeToBuffer(tempBuf, fTmpWinCenter); } if (finalDestParam->NoiseSpectrum.NonZero()) { Window destWin; destWin.CreateFromAmpSpec_noise(finalDestParam->NoiseSpectrum, tempHalfWinLen); destWin.MergeToBuffer(tempBuf, fTmpWinCenter); } } phase = (fTmpWinCenter - tempLen) / tempHalfWinLen; for (unsigned pos = 0; pos < uSumLen; pos++) { unsigned pos_global = pos + bounds[i]; float f_pos_global = (float)pos_global / rate*1000.0f; while (i_volumeMap + 1 < volume_map.size() && f_pos_global >= volume_map[i_volumeMap + 1].dstPos) i_volumeMap++; float k_volume = (f_pos_global - volume_map[i_volumeMap].dstPos) / (volume_map[i_volumeMap + 1].dstPos - volume_map[i_volumeMap].dstPos); Clamp01(k_volume); float volume = volume_map[i_volumeMap].value* (1.0f - k_volume) + volume_map[i_volumeMap + 1].value*k_volume; float pos_tmpBuf = stretchingMap[pos]; float sampleFreq; sampleFreq = pFreqMap[pos]; float speed = sampleFreq / minSampleFreq; int ipos1 = (int)ceilf(pos_tmpBuf - speed*0.5f); int ipos2 = (int)floorf(pos_tmpBuf + speed*0.5f); if (ipos1 >= (int)uTempLen) ipos1 = (int)uTempLen - 1; if (ipos2 >= (int)uTempLen) ipos2 = (int)uTempLen - 1; float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += tempBuf.GetSample(ipos); } float value = sum / (float)(ipos2 - ipos1 + 1); outBuf[pos + bounds[i]] = value*volume; } delete[] stretchingMap; } delete[] freqMap; } ================================================ FILE: VoiceSampler/SentenceGeneratorCPU.h ================================================ #ifndef __SentenceGeneratorCPU_h #define __SentenceGeneratorCPU_h struct SentenceDescriptor; void GenerateSentenceCPU(const SentenceDescriptor* desc, float* outBuf, unsigned outBufLen); #endif ================================================ FILE: VoiceSampler/SentenceGeneratorCUDA.cpp ================================================ #include #include #include "SentenceDescriptor.h" #include "SentenceGeneratorGeneral.h" #include "SentenceGeneratorCUDA.h" #include #include "fft.h" #include "VoiceUtil.h" using namespace VoiceUtil; #include "DVVector.hpp" static float rate = 44100.0f; inline void Clamp01(float& v) { if (v < 0.0f) v = 0.0f; else if (v > 1.0f) v = 1.0f; } class DVSrcBuf : public DVVector { public: const DVSrcBuf& operator = (const Buffer& cpuVec) { DVVector::operator=(cpuVec.m_data); return *this; } void ToCPU(Buffer& cpuVec) const { DVVector::ToCPU(cpuVec.m_data); } void Update(const Buffer& cpuVec) { DVVector::Update(cpuVec.m_data); } }; typedef DVImagedVector DVSrcBufList; struct SrcSampleInfo { unsigned srcPos; float srcSampleFreq; float dstPos; int isVowel; }; typedef std::vector SrcPieceInfo; typedef DVVector DVSrcPieceInfo; typedef DVLevel2Vector DVSrcPieceInfoList; struct Job { unsigned pieceId; unsigned jobOfPiece; }; struct DstPieceInfo { float minSampleFreq; unsigned uSumLen; float tempLen; unsigned uTempLen; float fTmpWinCenter0; }; struct SynthJobInfo { unsigned pieceId; unsigned jobOfPiece; unsigned srcPieceId0; unsigned srcPieceId1; float k_srcPiece; unsigned paramId00; unsigned paramId10; float k0; float k1; float destHalfWinLen; }; struct CUDATempBuffer { unsigned count; float *d_data; }; void h_GetMaxVoiced(VectorView> cuSrcBufs, VectorView> pieceInfoList, VectorView> cuMaxVoicedLists, VectorView jobMap, unsigned BufSize); void h_AnalyzeInput(VectorView> cuSrcBufs, VectorView> pieceInfoList, unsigned halfWinLen, unsigned specLen, VectorView> cuHarmWindows, VectorView> cuNoiseSpecs, VectorView> cuMaxVoicedLists, VectorView jobMap, unsigned BufSize); void h_Synthesis(VectorView> cuSrcPieceInfos, unsigned halfWinLen, unsigned specLen, VectorView> cuHarmWindows, VectorView> cuNoiseSpecs, VectorView cuDstPieceInfos, VectorView cuTmpBufs1, VectorView cuTmpBufs2, VectorView cuRandPhase, VectorView cuSynthJobs, unsigned BufSize); void h_Merge2Bufs(unsigned uSumLen, float *d_destBuf1, float *d_destBuf2); void GenerateSentenceCUDA(const SentenceDescriptor* desc, float* outBuf, unsigned outBufLen) { std::vector SrcBuffers; const std::vector& pieces = desc->pieces; unsigned numSrcPieces = (unsigned)pieces.size(); SrcBuffers.resize(numSrcPieces); for (size_t i = 0; i < numSrcPieces; i++) { const Piece& piece = pieces[i]; int srcStart = (int)(piece.srcMap[0].srcPos*0.001f*rate); int srcEnd = (int)ceilf(piece.srcMap[piece.srcMap.size() - 1].srcPos*0.001f*rate); int bound = piece.src.frq.data.size() * piece.src.frq.interval; if (srcStart < 0) { srcStart = 0; } if (srcEnd > bound) { srcEnd = bound; } SrcBuffers[i].m_sampleRate = (unsigned)rate; RegulateSource(piece.src.wav.buf, piece.src.wav.len, SrcBuffers[i], srcStart, srcEnd); } DVSrcBufList cuSourceBufs; cuSourceBufs = SrcBuffers; std::vector SrcPieceInfos; SrcPieceInfos.resize(numSrcPieces); float max_srcHalfWinWidth = 0.0f; float max_freqDetectHalfWinWidth = 0.0f; std::vector jobMap; std::vector countMaxVoiceds; countMaxVoiceds.resize(numSrcPieces); for (size_t i = 0; i < numSrcPieces; i++) { const Piece& piece = pieces[i]; SrcPieceInfo& srcPieceInfo = SrcPieceInfos[i]; int srcStart = (int)(piece.srcMap[0].srcPos*0.001f*rate); int srcEnd = (int)ceilf(piece.srcMap[piece.srcMap.size() - 1].srcPos*0.001f*rate); int bound = piece.src.frq.data.size() * piece.src.frq.interval; if (srcStart < 0) { srcStart = 0; } if (srcEnd > bound) { srcEnd = bound; } float fPeriodCount = 0.0f; unsigned i_srcMap = 0; unsigned lastmaxVoiced = 0; for (int srcPos = srcStart; srcPos < srcEnd; srcPos++) { float fsrcPos = (float)srcPos / rate*1000.0f; while (i_srcMap + 1 < piece.srcMap.size() && fsrcPos >= piece.srcMap[i_srcMap + 1].srcPos) i_srcMap++; int isVowel = piece.srcMap[i_srcMap].isVowel; float k_srcMap = (fsrcPos - piece.srcMap[i_srcMap].srcPos) / (piece.srcMap[i_srcMap + 1].srcPos - piece.srcMap[i_srcMap].srcPos); Clamp01(k_srcMap); float fdstPos = piece.srcMap[i_srcMap].dstPos*(1.0f - k_srcMap) + piece.srcMap[i_srcMap + 1].dstPos*k_srcMap; float dstPos = fdstPos*0.001f*rate; float srcSampleFreq; float srcFreqPos = (float)srcPos / (float)piece.src.frq.interval; unsigned uSrcFreqPos = (unsigned)srcFreqPos; float fracSrcFreqPos = srcFreqPos - (float)uSrcFreqPos; float freq1 = (float)piece.src.frq.data[uSrcFreqPos].freq; if (freq1 <= 55.0f) freq1 = (float)piece.src.frq.key; float freq2 = (float)piece.src.frq.data[uSrcFreqPos + 1].freq; if (freq2 <= 55.0f) freq2 = (float)piece.src.frq.key; float sampleFreq1 = freq1 / rate; float sampleFreq2 = freq2 / rate; srcSampleFreq = sampleFreq1*(1.0f - fracSrcFreqPos) + sampleFreq2*fracSrcFreqPos; unsigned paramId = (unsigned)fPeriodCount; if (paramId >= srcPieceInfo.size()) { SrcSampleInfo sl; sl.srcSampleFreq = srcSampleFreq; sl.srcPos = srcPos - srcStart; sl.isVowel = isVowel; sl.dstPos = dstPos; srcPieceInfo.push_back(sl); float srcHalfWinWidth = 1.0f / srcSampleFreq; if (max_srcHalfWinWidth < srcHalfWinWidth) max_srcHalfWinWidth = srcHalfWinWidth; if (isVowel<2) { float halfWinlen = 3.0f / srcSampleFreq; if (halfWinlen > max_freqDetectHalfWinWidth) max_freqDetectHalfWinWidth = halfWinlen; Job job; job.pieceId = (unsigned)i; job.jobOfPiece = (unsigned)srcPieceInfo.size() - 1; jobMap.push_back(job); } } fPeriodCount += srcSampleFreq; } countMaxVoiceds[i] = (unsigned)srcPieceInfo.size(); } DVSrcPieceInfoList cuSrcPieceInfos; cuSrcPieceInfos = SrcPieceInfos; DVVector cuJobMap; cuJobMap = jobMap; DVLevel2Vector cuMaxVoicedLists; cuMaxVoicedLists.Allocate(countMaxVoiceds); unsigned cuHalfWinLen = (unsigned)ceilf(max_srcHalfWinWidth); unsigned cuSpecLen = (unsigned)ceilf(max_srcHalfWinWidth*0.5f); unsigned fftLen = 1; while ((float)fftLen < max_freqDetectHalfWinWidth) fftLen <<= 1; unsigned BufSize = (unsigned)ceilf(max_freqDetectHalfWinWidth) * 2 + fftLen * 2; h_GetMaxVoiced(cuSourceBufs.view(), cuSrcPieceInfos.view(), cuMaxVoicedLists.view(), cuJobMap.view(), BufSize); std::vector> h_maxVoicedLists; cuMaxVoicedLists.ToCPU(h_maxVoicedLists); for (unsigned i = 0; i < h_maxVoicedLists.size(); i++) { std::vector& sublist = h_maxVoicedLists[i]; SrcPieceInfo& srcPieceInfo = SrcPieceInfos[i]; unsigned lastmaxVoiced = 0; for (unsigned j = 0; j < srcPieceInfo.size(); j++) { if (srcPieceInfo[j].isVowel < 2) { if (srcPieceInfo[j].isVowel > 0 && sublist[j] < lastmaxVoiced) { sublist[j] = lastmaxVoiced; } lastmaxVoiced = sublist[j]; } } } cuMaxVoicedLists.Update(h_maxVoicedLists); std::vector cuTotalHalfWinLen; cuTotalHalfWinLen.resize(numSrcPieces); std::vector cuTotalSpecLen; cuTotalSpecLen.resize(numSrcPieces); for (unsigned i = 0; i < numSrcPieces; i++) { cuTotalHalfWinLen[i] = cuHalfWinLen*(unsigned)SrcPieceInfos[i].size(); cuTotalSpecLen[i] = cuSpecLen*(unsigned)SrcPieceInfos[i].size(); } DVLevel2Vector cuHarmWindows; cuHarmWindows.Allocate(cuTotalHalfWinLen); DVLevel2Vector cuNoiseSpecs; cuNoiseSpecs.Allocate(cuTotalSpecLen); fftLen = 1; while (fftLen < cuHalfWinLen) fftLen <<= 1; BufSize = cuHalfWinLen * 2 + fftLen * 2; jobMap.clear(); for (unsigned i = 0; i < numSrcPieces; i++) { for (unsigned j = 0; j < (unsigned)SrcPieceInfos[i].size(); j++) { Job job; job.pieceId = i; job.jobOfPiece = j; jobMap.push_back(job); } } cuJobMap = jobMap; h_AnalyzeInput(cuSourceBufs.view(), cuSrcPieceInfos.view(), cuHalfWinLen, cuSpecLen, cuHarmWindows.view(), cuNoiseSpecs.view(), cuMaxVoicedLists.view(), cuJobMap.view(), BufSize); float* freqMap = new float[outBufLen]; std::vector bounds; PreprocessFreqMap(desc, outBufLen, freqMap, bounds); unsigned numDstPieces = (unsigned)bounds.size() -1; std::vector freqMaps; freqMaps.resize(numDstPieces); std::vector> stretchingMaps; stretchingMaps.resize(numDstPieces); std::vector DstPieceInfos; DstPieceInfos.resize(numDstPieces); unsigned sumTmpBufLen = 0; for (unsigned i = 0; i < numDstPieces; i++) { DstPieceInfo& dstPieceInfo = DstPieceInfos[i]; dstPieceInfo.uSumLen = bounds[i + 1] - bounds[i]; freqMaps[i] = freqMap + bounds[i]; dstPieceInfo.minSampleFreq = FLT_MAX; for (unsigned pos = 0; pos < dstPieceInfo.uSumLen; pos++) { float sampleFreq = freqMaps[i][pos]; if (sampleFreq < dstPieceInfo.minSampleFreq) dstPieceInfo.minSampleFreq = sampleFreq; } stretchingMaps[i].resize(dstPieceInfo.uSumLen); float pos_tmpBuf = 0.0f; for (unsigned pos = 0; pos < dstPieceInfo.uSumLen; pos++) { float sampleFreq; sampleFreq = freqMaps[i][pos]; float speed = sampleFreq / dstPieceInfo.minSampleFreq; pos_tmpBuf += speed; stretchingMaps[i][pos] = pos_tmpBuf; } dstPieceInfo.tempLen = stretchingMaps[i][dstPieceInfo.uSumLen - 1]; dstPieceInfo.uTempLen = (unsigned)ceilf(dstPieceInfo.tempLen); sumTmpBufLen += dstPieceInfo.uTempLen; } std::vector SynthJobs; float phase = 0.0f; unsigned i_pieceMap = 0; const std::vector& piece_map = desc->piece_map; const std::vector& volume_map = desc->volume_map; unsigned maxRandPhaseLen = 0; float maxtempHalfWinLen = 0.0f; for (unsigned i = 0; i < numDstPieces; i++) { DstPieceInfo& dstPieceInfo = DstPieceInfos[i]; float tempHalfWinLen = 1.0f / dstPieceInfo.minSampleFreq; if (tempHalfWinLen > maxtempHalfWinLen) maxtempHalfWinLen = tempHalfWinLen; unsigned pos_local = 0; while (phase > -1.0f) phase -= 1.0f; float tempLen = dstPieceInfo.tempLen; unsigned uSumLen = dstPieceInfo.uSumLen; const float* pFreqMap = freqMaps[i]; std::vector& stretchingMap = stretchingMaps[i]; float fTmpWinCenter = phase*tempHalfWinLen; dstPieceInfo.fTmpWinCenter0 = fTmpWinCenter; unsigned jobOfPiece = 0; while (fTmpWinCenter - tempHalfWinLen <= tempLen) { SynthJobInfo synthJob; synthJob.pieceId = i; synthJob.jobOfPiece = jobOfPiece; while (fTmpWinCenter > stretchingMap[pos_local] && pos_local < uSumLen - 1) pos_local++; unsigned pos_global = pos_local + bounds[i]; float f_pos_global = (float)pos_global / rate*1000.0f; float destSampleFreq; destSampleFreq = pFreqMap[pos_local]; float destHalfWinLen = 1.0f / destSampleFreq; synthJob.destHalfWinLen = destHalfWinLen; while (i_pieceMap + 1 < piece_map.size() && f_pos_global >= piece_map[i_pieceMap + 1].dstPos) i_pieceMap++; float k_piece = (f_pos_global - piece_map[i_pieceMap].dstPos) / (piece_map[i_pieceMap + 1].dstPos - piece_map[i_pieceMap].dstPos); Clamp01(k_piece); float fPieceId = piece_map[i_pieceMap].value* (1.0f - k_piece) + piece_map[i_pieceMap + 1].value*k_piece; unsigned pieceId0 = (unsigned)fPieceId; float pieceId_frac = fPieceId - (float)pieceId0; unsigned pieceId1 = (unsigned)fPieceId + 1; if (pieceId0 >= (unsigned)pieces.size()) pieceId0 = (unsigned)pieces.size() - 1; if (pieceId_frac == 0.0f || pieceId1 >= (unsigned)pieces.size()) { pieceId1 = pieceId0; pieceId_frac = 0.0f; } synthJob.srcPieceId0 = pieceId0; synthJob.srcPieceId1 = pieceId1; synthJob.k_srcPiece = pieceId_frac; std::vector& SampleLocations0 = SrcPieceInfos[pieceId0]; std::vector& SampleLocations1 = SrcPieceInfos[pieceId1]; unsigned paramId00 = 0; unsigned paramId01 = 1; unsigned paramId10 = 0; unsigned paramId11 = 1; while (paramId01 pieceId0) { while (paramId11= sl01.dstPos) k0 = 1.0f; else if ((float)pos_global <= sl00.dstPos) k0 = 0.0f; else { k0 = ((float)pos_global - sl00.dstPos) / (sl01.dstPos - sl00.dstPos); } synthJob.k0 = k0; synthJob.k1 = 0.0f; if (pieceId1 > pieceId0) { SrcSampleInfo& sl10 = SampleLocations1[paramId10]; SrcSampleInfo& sl11 = SampleLocations1[paramId11]; float k1; if ((float)pos_global >= sl11.dstPos) k1 = 1.0f; else if ((float)pos_global <= sl10.dstPos) k1 = 0.0f; else { k1 = ((float)pos_global - sl10.dstPos) / (sl11.dstPos - sl10.dstPos); } synthJob.k1 = k1; } SynthJobs.push_back(synthJob); jobOfPiece++; fTmpWinCenter += tempHalfWinLen; } unsigned uSpecLen = (unsigned)ceilf(tempHalfWinLen*0.5f); unsigned randPhaseLen = uSpecLen*jobOfPiece; if (randPhaseLen > maxRandPhaseLen) maxRandPhaseLen = randPhaseLen; phase = (fTmpWinCenter - tempLen) / tempHalfWinLen; } DVVector cuDstPieceInfos; cuDstPieceInfos = DstPieceInfos; DVVector cuSynthJobs; cuSynthJobs = SynthJobs; DVVector cuSumTmpBuf1; DVVector cuSumTmpBuf2; cuSumTmpBuf1.Allocate(sumTmpBufLen); cuSumTmpBuf2.Allocate(sumTmpBufLen); cudaMemset(cuSumTmpBuf1, 0, sizeof(float)*sumTmpBufLen); cudaMemset(cuSumTmpBuf2, 0, sizeof(float)*sumTmpBufLen); std::vector tmpBufs1; tmpBufs1.resize(numDstPieces); std::vector tmpBufs2; tmpBufs2.resize(numDstPieces); float *pTmpBuf1 = cuSumTmpBuf1.Pointer(); float *pTmpBuf2 = cuSumTmpBuf2.Pointer(); for (unsigned i = 0; i < numDstPieces; i++) { unsigned count = DstPieceInfos[i].uTempLen; tmpBufs1[i].count = count; tmpBufs1[i].d_data = pTmpBuf1; tmpBufs2[i].count = count; tmpBufs2[i].d_data = pTmpBuf2; pTmpBuf1 += count; pTmpBuf2 += count; } DVVector cuTmpBufs1; cuTmpBufs1 = tmpBufs1; DVVector cuTmpBufs2; cuTmpBufs2 = tmpBufs2; std::vector randPhase; randPhase.resize(maxRandPhaseLen); for (unsigned i = 0; i < maxRandPhaseLen; i++) randPhase[i] = rand01(); DVVector cuRandPhase; cuRandPhase = randPhase; fftLen = 1; while ((float)fftLen < maxtempHalfWinLen) fftLen <<= 1; BufSize = fftLen * 4; h_Synthesis(cuSrcPieceInfos.view(), cuHalfWinLen, cuSpecLen, cuHarmWindows.view(), cuNoiseSpecs.view(), cuDstPieceInfos.view(), cuTmpBufs1.view(), cuTmpBufs2.view(), cuRandPhase.view(), cuSynthJobs.view(), BufSize); h_Merge2Bufs(sumTmpBufLen, cuSumTmpBuf1, cuSumTmpBuf2); std::vector sumTmpBuf; cuSumTmpBuf1.ToCPU(sumTmpBuf); float* pTmpBuf = &sumTmpBuf[0]; float* pDstBuf = outBuf; unsigned i_volumeMap = 0; for (unsigned i = 0; i < numDstPieces; i++) { unsigned uSumLen = DstPieceInfos[i].uSumLen; float *stretchingMap = &stretchingMaps[i][0]; const float *pFreqMap = freqMaps[i]; float minSampleFreq = DstPieceInfos[i].minSampleFreq; unsigned uTempLen = DstPieceInfos[i].uTempLen; for (unsigned pos = 0; pos < uSumLen; pos++) { unsigned pos_global = pos + bounds[i]; float f_pos_global = (float)pos_global / rate*1000.0f; while (i_volumeMap + 1 < volume_map.size() && f_pos_global >= volume_map[i_volumeMap + 1].dstPos) i_volumeMap++; float k_volume = (f_pos_global - volume_map[i_volumeMap].dstPos) / (volume_map[i_volumeMap + 1].dstPos - volume_map[i_volumeMap].dstPos); Clamp01(k_volume); float volume = volume_map[i_volumeMap].value* (1.0f - k_volume) + volume_map[i_volumeMap + 1].value*k_volume; float pos_tmpBuf = stretchingMap[pos]; float sampleFreq; sampleFreq = pFreqMap[pos]; float speed = sampleFreq / minSampleFreq; int ipos1 = (int)ceilf(pos_tmpBuf - speed*0.5f); int ipos2 = (int)floorf(pos_tmpBuf + speed*0.5f); if (ipos1 >= (int)uTempLen) ipos1 = (int)uTempLen - 1; if (ipos2 >= (int)uTempLen) ipos2 = (int)uTempLen - 1; float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { if (ipos >= 0) sum += pTmpBuf[ipos]; } float value = sum / (float)(ipos2 - ipos1 + 1); pDstBuf[pos] = value*volume; } pTmpBuf += uTempLen; pDstBuf += uSumLen; } delete[] freqMap; } ================================================ FILE: VoiceSampler/SentenceGeneratorCUDA.h ================================================ #ifndef __SentenceGeneratorCUDA_h #define __SentenceGeneratorCUDA_h struct SentenceDescriptor; void GenerateSentenceCUDA(const SentenceDescriptor* desc, float* outBuf, unsigned outBufLen); #endif ================================================ FILE: VoiceSampler/SentenceGeneratorGeneral.cpp ================================================ #include "SentenceDescriptor.h" #include "SentenceGeneratorGeneral.h" static float rate = 44100.0f; inline void Clamp01(float& v) { if (v < 0.0f) v = 0.0f; else if (v > 1.0f) v = 1.0f; } void RegulateSource(const float* srcData, unsigned len, Buffer& dstBuf, int srcStart, int srcEnd) { unsigned uLen = (unsigned)(srcEnd - srcStart); dstBuf.Allocate(uLen); float acc = 0.0f; float count = 0.0f; for (unsigned i = 0; i < len; i++) { acc += srcData[i] * srcData[i]; if (srcData[i] != 0.0f) { count += 1.0f; } } acc = sqrtf(count / acc)*0.3f; for (unsigned i = 0; i < uLen; i++) { int j = (int)i + srcStart; float v = 0.0f; if (j>=0 && j= (int)size) v = buf[size - 1]; else v = buf[bufPos]; float x = (float)j / (float)halfWinSize*(float)PI; float w = (cosf(x) + 1.0f)*0.5f; sum += v*w; } float ave = sum / (float)halfWinSize; for (int j = -(int)halfWinSize; j < (int)halfWinSize; j++) { int bufPos = (int)i + j; if (bufPos < 0 || bufPos >= (int)size) continue; float x = (float)j / (float)halfWinSize*(float)PI; float w = (cosf(x) + 1.0f)*0.5f; buf2[bufPos] += w*ave; } } memcpy(buf, buf2, sizeof(float)*size); delete[] buf2; } void PreprocessFreqMap(const SentenceDescriptor* desc, unsigned outBufLen, float* freqMap, std::vector& bounds) { unsigned i_piece = 0; unsigned i_freq = 0; bounds.clear(); bounds.push_back(0); const std::vector& piece_map = desc->piece_map; const std::vector& freq_map = desc->freq_map; float lastPiece = piece_map[0].value; for (unsigned i = 0; i < outBufLen; i++) { float fpos = (float)i / rate*1000.0f; while (i_piece + 1= piece_map[i_piece + 1].dstPos) i_piece++; float k_piece = (fpos - piece_map[i_piece].dstPos) / (piece_map[i_piece + 1].dstPos - piece_map[i_piece].dstPos); Clamp01(k_piece); float piece = piece_map[i_piece].value*(1.0f - k_piece) + piece_map[i_piece + 1].value*k_piece; if (i_freq + 1= freq_map[i_freq + 1].dstPos) { if (piece - lastPiece >= 1.0f) { bounds.push_back(i); lastPiece = piece; } i_freq++; } while (i_freq + 1 < freq_map.size() && fpos >= freq_map[i_freq + 1].dstPos) i_freq++; float k_freq = (fpos - freq_map[i_freq].dstPos) / (freq_map[i_freq + 1].dstPos - freq_map[i_freq].dstPos); Clamp01(k_freq); float freq = freq_map[i_freq].value*(1.0f - k_freq) + freq_map[i_freq + 1].value*k_freq; freqMap[i] = freq / rate; } bounds.push_back(outBufLen); _floatBufSmooth(freqMap, outBufLen); } ================================================ FILE: VoiceSampler/SentenceGeneratorGeneral.h ================================================ #ifndef __SentenceGeneratorGeneral_h #define __SentenceGeneratorGeneral_h #include "VoiceUtil.h" using namespace VoiceUtil; void RegulateSource(const float* srcData, unsigned len, Buffer& dstBuf, int srcStart, int srcEnd); void PreprocessFreqMap(const SentenceDescriptor* desc, unsigned outBufLen, float* freqMap, std::vector& bounds); #endif ================================================ FILE: VoiceSampler/VoiceUtil.cuh ================================================ #include "fft.cuh" #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif inline __device__ float d_WndGetSample(const float* s_Wnd, unsigned u_halfWidth, int i) { if (i< -(int)(u_halfWidth - 1) || i>(int)(u_halfWidth - 1)) return 0.0f; int idst = i >= 0 ? i : ((int)u_halfWidth * 2 + i); return s_Wnd[idst]; } inline __device__ void d_WndSetSample(float* s_Wnd, unsigned u_halfWidth, int i, float v) { if (i< -(int)(u_halfWidth - 1) || i>(int)(u_halfWidth - 1)) return; int idst = i >= 0 ? i : ((int)u_halfWidth * 2 + i); s_Wnd[idst] = v; } __device__ void d_captureFromBuf(unsigned srcLen, float* d_srcBuf, unsigned srcPos, float halfWinlen, unsigned u_halfWidth, float* s_captureWnd) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (int i = (int)workerId - (int)(u_halfWidth - 1); i <= (int)(u_halfWidth -1); i += (int)numWorker) { int isrc = (int)srcPos + i; float v = 0.0f; if (isrc >= 0 && isrc < srcLen) v = d_srcBuf[isrc]; v *= (cosf((float)i * PI / halfWinlen) + 1.0f)*0.5f; d_WndSetSample(s_captureWnd, u_halfWidth, i, v); } if (workerId==0) s_captureWnd[u_halfWidth] = 0.0f; __syncthreads(); } __device__ void d_ScaleWindow(float srcHalfWinlen, unsigned u_SrcHalfWidth, const float* s_Wnd, float* s_dstWnd, float targetHalfWidth) { unsigned u_TargetHalfWidth = (unsigned)ceilf(targetHalfWidth); float rate = srcHalfWinlen / targetHalfWidth; bool interpolation = rate < 1.0f; unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (int i = (int)workerId - (int)(u_TargetHalfWidth - 1); i <= (int)(u_TargetHalfWidth - 1); i += (int)numWorker) { float destValue; float srcPos = (float)i*rate; if (interpolation) { int ipos1 = (int)floorf(srcPos); float frac = srcPos - (float)ipos1; int ipos2 = ipos1 + 1; int ipos0 = ipos1 - 1; int ipos3 = ipos1 + 2; float p0 = d_WndGetSample(s_Wnd, u_SrcHalfWidth, ipos0); float p1 = d_WndGetSample(s_Wnd, u_SrcHalfWidth, ipos1); float p2 = d_WndGetSample(s_Wnd, u_SrcHalfWidth, ipos2); float p3 = d_WndGetSample(s_Wnd, u_SrcHalfWidth, ipos3); destValue = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceilf(srcPos - rate*0.5f); int ipos2 = (int)floorf(srcPos + rate*0.5f); float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += d_WndGetSample(s_Wnd, u_SrcHalfWidth, ipos); } destValue = sum / (float)(ipos2 - ipos1 + 1); } d_WndSetSample(s_dstWnd, u_TargetHalfWidth, i, destValue); } if (workerId == 0) s_dstWnd[u_TargetHalfWidth] = 0.0f; __syncthreads(); } __device__ void d_CreateAmpSpectrumFromWindow(float halfWinlen, unsigned u_halfWidth, float* s_Wnd, float* s_res_wnd, unsigned uSpecLen) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; unsigned l = 0; unsigned fftLen = 1; while (fftLen < u_halfWidth) { l++; fftLen <<= 1; } float fLen = (float)fftLen; d_ScaleWindow(halfWinlen, u_halfWidth, s_Wnd, s_res_wnd, fLen); for (unsigned i = 1 + workerId; i < fftLen; i += numWorker) { s_res_wnd[i] += s_res_wnd[i+fftLen]; s_res_wnd[i + fftLen] = 0.0f; } __syncthreads(); d_fft(s_res_wnd, l); float rate = halfWinlen / fLen; for (unsigned i = workerId; i < fftLen; i += numWorker) { float v = 0.0f; if (i < uSpecLen) { float amplitude = sqrtf(s_res_wnd[i] * s_res_wnd[i] + s_res_wnd[i + fftLen] * s_res_wnd[i + fftLen]); v = amplitude*rate; } s_res_wnd[i] = v; } __syncthreads(); for (unsigned i = fftLen+workerId; i < 2*fftLen; i += numWorker) { s_res_wnd[i] = 0.0f; } __syncthreads(); } inline __device__ float d_SymWndGetSample(const float* s_SymWnd, unsigned u_halfWidth, int i) { if (i< -(int)(u_halfWidth - 1) || i>u_halfWidth - 1) return 0.0f; int idst = i >= 0 ? i : -i; float v = s_SymWnd[idst]; return i >= 0 ? v : -v; } __device__ void d_ScaleSymWindow(float srcHalfWinlen, unsigned u_SrcHalfWidth, const float* s_SymWnd, float* s_dstSymWnd, float targetHalfWidth) { unsigned u_TargetHalfWidth = (unsigned)ceilf(targetHalfWidth); float rate = srcHalfWinlen / targetHalfWidth; bool interpolation = rate < 1.0f; unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (int i = workerId; i <= (int)(u_TargetHalfWidth - 1); i += numWorker) { float destValue; float srcPos = (float)i*rate; if (interpolation) { int ipos1 = (int)floorf(srcPos); float frac = srcPos - (float)ipos1; int ipos2 = ipos1 + 1; int ipos0 = ipos1 - 1; int ipos3 = ipos1 + 2; float p0 = d_SymWndGetSample(s_SymWnd, u_SrcHalfWidth, ipos0); float p1 = d_SymWndGetSample(s_SymWnd, u_SrcHalfWidth, ipos1); float p2 = d_SymWndGetSample(s_SymWnd, u_SrcHalfWidth, ipos2); float p3 = d_SymWndGetSample(s_SymWnd, u_SrcHalfWidth, ipos3); destValue = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceilf(srcPos - rate*0.5f); int ipos2 = (int)floorf(srcPos + rate*0.5f); float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += d_SymWndGetSample(s_SymWnd, u_SrcHalfWidth, ipos); } destValue = sum / (float)(ipos2 - ipos1 + 1); } s_dstSymWnd[i] = destValue; } __syncthreads(); } __device__ void d_CreateSymmetricWindowFromAmpSpec(float* s_spectrum, unsigned uSpecLen, float halfWinlen, unsigned u_halfWidth, float* s_SymWnd) { unsigned l = 0; unsigned fftLen = 1; while ((float)fftLen < u_halfWidth) { l++; fftLen <<= 1; } float rate = (float)fftLen / halfWinlen; unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; if (workerId == 0) { s_SymWnd[0] = 0.0f; s_SymWnd[fftLen] = 0.0f; s_SymWnd[fftLen/2] = 0.0f; s_SymWnd[fftLen + fftLen/2] = 0.0f; } for (unsigned i = 1 + workerId; i < fftLen / 2; i += numWorker) { float x = 0.0f; if (i < uSpecLen) { float amplitude = s_spectrum[i]; x = amplitude * rate; } s_SymWnd[i] = 0.0f; s_SymWnd[fftLen + i] = x; s_SymWnd[fftLen - i] = 0.0f; s_SymWnd[2 * fftLen - i] = -x; } __syncthreads(); d_ifft(s_SymWnd, l); for (unsigned i = workerId; i < fftLen; i += numWorker) { float window = (cosf((float)i * (float)PI / (float)fftLen) + 1.0f)*0.5f; s_SymWnd[i + fftLen] = s_SymWnd[i]*window; } __syncthreads(); d_ScaleSymWindow((float)fftLen, fftLen, s_SymWnd + fftLen, s_SymWnd, halfWinlen); } __device__ void SymWin_Repitch_FormantPreserved(float srcHalfWinLen, float* srcBuf, float dstHalfWinLen, float* dstBuf, float k) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; unsigned u_TargetHalfWidth = (unsigned)ceilf(dstHalfWinLen); unsigned uSrcHalfWidth = (unsigned)ceilf(srcHalfWinLen); float rate = dstHalfWinLen / srcHalfWinLen; float amplitude = k*sqrtf(rate); for (unsigned i = workerId; (float)i < dstHalfWinLen; i += numWorker) { float dstV = 0.0f; float srcPos = (float)i; unsigned uSrcPos = (unsigned)(srcPos + 0.5f); while (uSrcPos < uSrcHalfWidth) { dstV += srcBuf[uSrcPos]; srcPos += dstHalfWinLen; uSrcPos = (unsigned)(srcPos + 0.5f); } srcPos = dstHalfWinLen - (float)i; uSrcPos = (unsigned)(srcPos + 0.5f); while (uSrcPos < uSrcHalfWidth) { dstV -= srcBuf[uSrcPos]; srcPos += dstHalfWinLen; uSrcPos = (unsigned)(srcPos + 0.5f); } float window = (cosf((float)i * (float)PI / dstHalfWinLen) + 1.0f)*0.5f; dstBuf[i] += dstV*amplitude*window; } __syncthreads(); } __device__ void SymWin_WriteToBuf(unsigned dstLen, float* d_dstBuf, float pos, float halfWinLen, float* s_symWnd) { int ipos = (int)floorf(pos); unsigned uHalfWinLen = (unsigned)ceilf(halfWinLen); unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (int i = (int)(workerId)-(int)(uHalfWinLen - 1); i <= (int)(uHalfWinLen - 1); i += (int)numWorker) { int uI = i < 0 ? -i : i; float v = s_symWnd[uI]; int dstI = ipos + i; if (dstI >= 0 && dstI < dstLen) d_dstBuf[dstI] += i<0? -v:v; } __syncthreads(); } __device__ void Win_WriteToBuf(unsigned dstLen, float* d_dstBuf, float pos, float halfWinLen, float* s_Wnd) { int ipos = (int)floorf(pos); unsigned uHalfWinLen = (unsigned)ceilf(halfWinLen); unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (int i = (int)(workerId)-(int)(uHalfWinLen - 1); i <= (int)(uHalfWinLen - 1); i += (int)numWorker) { int uI = i < 0 ? halfWinLen*2 + i : i; float v = s_Wnd[uI]; int dstI = ipos + i; if (dstI >= 0 && dstI < dstLen) d_dstBuf[dstI] += v; } __syncthreads(); } __device__ void AmpSpec_Scale(float srcHalfWinLen, float* srcBuf, float dstHalfWinLen, float* dstBuf, float k) { unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; unsigned srcSpecLen = (unsigned)ceilf(srcHalfWinLen*0.5f); unsigned specLen = (unsigned)ceilf(dstHalfWinLen*0.5f); float rate = srcHalfWinLen / dstHalfWinLen; float mulRate = sqrtf(dstHalfWinLen / srcHalfWinLen) *k; bool interpolation = rate < 1.0f; for (unsigned i = workerId; i < specLen; i += numWorker) { float destValue; float srcPos = (float)i*rate; if (interpolation) { int ipos1 = (int)floorf(srcPos); float frac = srcPos - (float)ipos1; int ipos2 = ipos1 + 1; int ipos0 = ipos1 - 1; int ipos3 = ipos1 + 2; float p0 = ipos0 < 0 ? 0.0f : srcBuf[ipos0]; float p1 = ipos1 >= srcSpecLen ? 0.0f : srcBuf[ipos1]; float p2 = ipos2 >= srcSpecLen ? 0.0f : srcBuf[ipos2]; float p3 = ipos3 >= srcSpecLen ? 0.0f : srcBuf[ipos3]; destValue = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceilf(srcPos - rate*0.5f); int ipos2 = (int)floorf(srcPos + rate*0.5f); float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += (ipos<0 || ipos >= srcSpecLen) ? 0.0f : srcBuf[ipos]; } destValue = sum / (float)(ipos2 - ipos1 + 1); } dstBuf[i] += destValue*mulRate; } __syncthreads(); } __device__ void d_CreateNoiseWindowFromAmpSpec(float* s_spectrum, float* randphase, unsigned uSpecLen, float halfWinlen, unsigned u_halfWidth, float* s_NoiseWnd, float targetHalfWidth) { unsigned l = 0; unsigned fftLen = 1; while ((float)fftLen < u_halfWidth) { l++; fftLen <<= 1; } float rate = (float)fftLen / halfWinlen; unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; if (workerId == 0) { s_NoiseWnd[0] = 0.0f; s_NoiseWnd[fftLen] = 0.0f; s_NoiseWnd[fftLen / 2] = 0.0f; s_NoiseWnd[fftLen + fftLen / 2] = 0.0f; } for (unsigned i = 1 + workerId; i < fftLen / 2; i += numWorker) { float x = 0.0f; float y = 0.0f; if (i < uSpecLen) { float amplitude = s_spectrum[i] * rate; float phase = randphase[i] * 2.0f*PI; x = amplitude * cosf(phase); y = amplitude * sinf(phase); } s_NoiseWnd[i] = x; s_NoiseWnd[fftLen + i] = y; s_NoiseWnd[fftLen - i] = x; s_NoiseWnd[2 * fftLen - i] = -y; } __syncthreads(); d_ifft(s_NoiseWnd, l); unsigned u_targetHalfWidth = (unsigned)ceilf(targetHalfWidth); unsigned skip_len = max(2 * fftLen, 2 * u_targetHalfWidth); for (unsigned i = workerId; i < fftLen; i += numWorker) { float window = (cosf((float)i * (float)PI / (float)fftLen) + 1.0f)*0.5f; s_NoiseWnd[i + skip_len] = s_NoiseWnd[i] * window; if (i>0) s_NoiseWnd[skip_len+ 2 * fftLen - i] = s_NoiseWnd[fftLen - i] * window; } if (workerId == 0) s_NoiseWnd[skip_len + fftLen] = 0; __syncthreads(); d_ScaleWindow((float)fftLen, fftLen, s_NoiseWnd + skip_len, s_NoiseWnd, targetHalfWidth); } ================================================ FILE: VoiceSampler/VoiceUtil.h ================================================ #ifndef _VoiceUtil_h #define _VoiceUtil_h #define Symmetric_Type_Axis 0 #define Symmetric_Type_Center 1 #define Symmetric_Type Symmetric_Type_Center #include #include "fft.h" #include #include #include #include #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif inline float rand01() { float f = (float)rand() / (float)RAND_MAX; if (f < 0.0000001f) f = 0.0000001f; if (f > 0.9999999f) f = 0.9999999f; return f; } inline float randGauss(float sd) { return sd*sqrtf(-2.0f*logf(rand01()))*cosf(rand01()*(float)PI); } namespace VoiceUtil { inline void calcPOT(unsigned lenIn, unsigned& lenOut, unsigned& l) { lenOut = 1; l = 0; while (lenOut < lenIn) { l++; lenOut <<= 1; } } struct Buffer { unsigned m_sampleRate; std::vector m_data; void Allocate(unsigned size) { m_data.resize(size); SetZero(); } float GetSample(int i) const { size_t usize = m_data.size(); if (i<0 || i >= (int)usize) return 0.0f; return m_data[i]; } void SetZero() { memset(m_data.data(), 0, sizeof(float)*m_data.size()); } void SetSample(int i, float v) { size_t usize = m_data.size(); if (i < 0 || i >= (int)usize) return; m_data[i] = v; } void AddToSample(int i, float v) { size_t usize = m_data.size(); if (i < 0 || i >= (int)usize) return; m_data[i] += v; } float GetMax() { float maxv = 0.0f; for (size_t i = 0; i < m_data.size(); i++) { if (fabsf(m_data[i])>maxv) maxv = fabsf(m_data[i]); } return maxv; } }; class AmpSpectrum; class Window { public: virtual ~Window(){} float m_halfWidth; std::vector m_data; void Allocate(float halfWidth) { unsigned u_halfWidth = (unsigned)ceilf(halfWidth); unsigned u_width = u_halfWidth << 1; m_halfWidth = halfWidth; m_data.resize(u_width); SetZero(); } void SetZero() { memset(m_data.data(), 0, sizeof(float)*m_data.size()); } void CreateFromBuffer(const Buffer& src, float center, float halfWidth) { unsigned u_halfWidth = (unsigned)ceilf(halfWidth); unsigned u_width = u_halfWidth << 1; m_halfWidth = halfWidth; m_data.resize(u_width); SetZero(); int i_Center = (int)center; for (int i = -(int)u_halfWidth; i < (int)u_halfWidth; i++) { float window = (cosf((float)i * (float)PI / halfWidth) + 1.0f)*0.5f; int srcIndex = i_Center + i; float v_src = src.GetSample(srcIndex); SetSample(i, window* v_src); } } void MergeToBuffer(Buffer& buf, float pos) { int ipos = (int)floorf(pos); unsigned u_halfWidth = GetHalfWidthOfData(); for (int i = max(-(int)u_halfWidth, -ipos); i < (int)u_halfWidth; i++) { int dstIndex = ipos + i; if (dstIndex >= (int)buf.m_data.size()) break; buf.m_data[dstIndex] += GetSample(i); } } virtual void Interpolate(const Window& win0, const Window& win1, float k, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned u_halfWidth = (unsigned)ceilf(targetHalfWidth); unsigned u_Width = u_halfWidth << 1; m_data.resize(u_Width); for (int i = -((int)u_halfWidth - 1); i <= (int)u_halfWidth - 1; i++) { float v0 = win0.GetSample(i); float v1 = win1.GetSample(i); this->SetSample(i, (1.0f - k) *v0 + k* v1); } } virtual unsigned GetHalfWidthOfData() const { unsigned u_width = (unsigned)m_data.size(); unsigned u_halfWidth = u_width >> 1; return u_halfWidth; } virtual float GetSample(int i) const { unsigned u_width = (unsigned)m_data.size(); unsigned u_halfWidth = u_width >> 1; unsigned pos; if (i >= 0) { if ((unsigned)i > u_halfWidth - 1) return 0.0f; pos = (unsigned)i; } else { if (((int)u_width + i) < (int)u_halfWidth + 1) return 0.0f; pos = u_width - (unsigned)(-i); } return m_data[pos]; } virtual void SetSample(int i, float v) { unsigned u_width = (unsigned)m_data.size(); unsigned u_halfWidth = u_width >> 1; unsigned pos; if (i >= 0) { if ((unsigned)i > u_halfWidth - 1) return; pos = (unsigned)i; } else { if (((int)u_width + i) < (int)u_halfWidth + 1) return; pos = u_width - (unsigned)(-i); } m_data[pos] = v; } virtual void Scale(const Window& src, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned u_TargetHalfWidth = (unsigned)ceilf(targetHalfWidth); unsigned u_TargetWidth = u_TargetHalfWidth << 1; m_data.resize(u_TargetWidth); float rate = src.m_halfWidth / targetHalfWidth; bool interpolation = rate < 1.0f; for (int i = -(int)(u_TargetHalfWidth - 1); i <= (int)(u_TargetHalfWidth - 1); i++) { float destValue; float srcPos = (float)i*rate; if (interpolation) { int ipos1 = (int)floorf(srcPos); float frac = srcPos - (float)ipos1; int ipos2 = ipos1 + 1; int ipos0 = ipos1 - 1; int ipos3 = ipos1 + 2; float p0 = src.GetSample(ipos0); float p1 = src.GetSample(ipos1); float p2 = src.GetSample(ipos2); float p3 = src.GetSample(ipos3); destValue = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceilf(srcPos - rate*0.5f); int ipos2 = (int)floorf(srcPos + rate*0.5f); float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += src.GetSample(ipos); } destValue = sum / (float)(ipos2 - ipos1 + 1); } this->SetSample(i, destValue); } } inline void CreateFromAmpSpec_noise(const AmpSpectrum& src, float targetHalfWidth=-1.0f); }; class AmpSpectrum { public: float m_halfWidth; std::vector m_data; void Allocate(float halfWidth) { m_halfWidth = halfWidth; unsigned specLen = (unsigned)ceilf(m_halfWidth*0.5f); m_data.resize(specLen); SetZero(); } void SetZero() { memset(m_data.data(), 0, sizeof(float)*m_data.size()); } bool NonZero() { for (unsigned i = 1; i < (unsigned)m_data.size(); i++) if (m_data[i] != 0.0f) return true; return false; } void CreateFromWindow(const Window& src) { m_halfWidth = src.m_halfWidth; unsigned u_srcHalfWidth = src.GetHalfWidthOfData(); unsigned l = 0; unsigned fftLen = 1; while (fftLen < u_srcHalfWidth) { l++; fftLen <<= 1; } float fLen = (float)fftLen; Window l_scaled; const Window* scaled = &l_scaled; if (src.m_halfWidth == fLen) { scaled = &src; } else { l_scaled.Scale(src, fLen); } DComp* fftBuf = new DComp[fftLen]; memset(fftBuf, 0, sizeof(DComp)*fftLen); for (unsigned i = 0; i < fftLen; i++) { fftBuf[i].Re = (double)scaled->GetSample((int)i) + (double)scaled->GetSample((int)i - (int)fftLen); } fft(fftBuf, l); float rate = m_halfWidth / fLen; m_data.resize((unsigned)ceilf(m_halfWidth*0.5f)); for (unsigned i = 0; i < (unsigned)m_data.size(); i++) { if (i >= fftLen) m_data[i] = 0.0f; else m_data[i] = (float)DCAbs(&fftBuf[i])*rate; } delete[] fftBuf; } void Interpolate(const AmpSpectrum& spec0, const AmpSpectrum& spec1, float k, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned specLen = (unsigned)ceilf(m_halfWidth*0.5f); m_data.resize(specLen); for (unsigned i = 0; i = (int)m_data.size()) i = (int)m_data.size() - 1; return m_data[i]; } void Scale(const AmpSpectrum& src, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned specLen = (unsigned)ceilf(m_halfWidth*0.5f); m_data.resize(specLen); float rate = src.m_halfWidth / targetHalfWidth; float mulRate = sqrtf(targetHalfWidth / src.m_halfWidth); bool interpolation = rate < 1.0f; for (unsigned i = 0; i < specLen; i++) { float destValue; float srcPos = (float)i*rate; if (interpolation) { int ipos1 = (int)floorf(srcPos); float frac = srcPos - (float)ipos1; int ipos2 = ipos1 + 1; int ipos0 = ipos1 - 1; int ipos3 = ipos1 + 2; float p0 = src.GetSample(ipos0); float p1 = src.GetSample(ipos1); float p2 = src.GetSample(ipos2); float p3 = src.GetSample(ipos3); destValue = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceilf(srcPos - rate*0.5f); int ipos2 = (int)floorf(srcPos + rate*0.5f); float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += src.GetSample(ipos); } destValue = sum / (float)(ipos2 - ipos1 + 1); } m_data[i] = destValue*mulRate; } } }; void Window::CreateFromAmpSpec_noise(const AmpSpectrum& src, float targetHalfWidth) { unsigned l = 0; unsigned fftLen = 1; while ((float)fftLen < src.m_halfWidth) { l++; fftLen <<= 1; } DComp* fftBuf = new DComp[fftLen]; memset(fftBuf, 0, sizeof(DComp)*fftLen); float rate = (float)fftLen / src.m_halfWidth; for (unsigned i = 1; i < (unsigned)src.m_data.size(); i++) { if (i < fftLen / 2) { float angle = (float)rand01()*(float)PI*2.0f; float re = src.m_data[i] * cosf(angle) * rate; float im = src.m_data[i] * sinf(angle) * rate; fftBuf[i].Re = (double)re; fftBuf[i].Im = (double)im; fftBuf[fftLen - i].Re = (double)re; fftBuf[fftLen - i].Im = -(double)im; } } ifft(fftBuf, l); Window tempWin; tempWin.m_halfWidth = (float)fftLen; tempWin.m_data.resize(fftLen * 2); for (unsigned i = 0; i < fftLen; i++) { float window = (cosf((float)i * (float)PI / tempWin.m_halfWidth) + 1.0f)*0.5f; tempWin.m_data[i] = window*(float)fftBuf[i].Re; if (i>0) tempWin.m_data[fftLen * 2 - i] = window*(float)fftBuf[fftLen - i].Re; } delete[] fftBuf; this->Scale(tempWin, targetHalfWidth>0.0f ? targetHalfWidth: src.m_halfWidth); } class SymmetricWindow_Base : public Window { public: virtual ~SymmetricWindow_Base(){} bool NonZero() { for (unsigned i = 0; i < (unsigned)m_data.size(); i++) if (m_data[i] != 0.0f) return true; return false; } virtual unsigned GetHalfWidthOfData() const { unsigned u_halfWidth = (unsigned)m_data.size(); return u_halfWidth; } virtual void Scale(const SymmetricWindow_Base& src, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned u_TargetHalfWidth = (unsigned)ceilf(targetHalfWidth); m_data.resize(u_TargetHalfWidth); float rate = src.m_halfWidth / targetHalfWidth; bool interpolation = rate < 1.0f; for (unsigned i = 0; i < u_TargetHalfWidth; i++) { float destValue; float srcPos = (float)i*rate; if (interpolation) { int ipos1 = (int)floorf(srcPos); float frac = srcPos - (float)ipos1; int ipos2 = ipos1 + 1; int ipos0 = ipos1 - 1; int ipos3 = ipos1 + 2; float p0 = src.GetSample(ipos0); float p1 = src.GetSample(ipos1); float p2 = src.GetSample(ipos2); float p3 = src.GetSample(ipos3); destValue = (-0.5f*p0 + 1.5f*p1 - 1.5f*p2 + 0.5f*p3)*powf(frac, 3.0f) + (p0 - 2.5f*p1 + 2.0f*p2 - 0.5f*p3)*powf(frac, 2.0f) + (-0.5f*p0 + 0.5f*p2)*frac + p1; } else { int ipos1 = (int)ceilf(srcPos - rate*0.5f); int ipos2 = (int)floorf(srcPos + rate*0.5f); float sum = 0.0f; for (int ipos = ipos1; ipos <= ipos2; ipos++) { sum += src.GetSample(ipos); } destValue = sum / (float)(ipos2 - ipos1 + 1); } m_data[i] = destValue; } } virtual void Interpolate(const SymmetricWindow_Base& win0, const SymmetricWindow_Base& win1, float k, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned u_halfWidth = (unsigned)ceilf(targetHalfWidth); m_data.resize(u_halfWidth); for (unsigned i = 0; i <= u_halfWidth - 1; i++) { float v0 = win0.GetSample(i); float v1 = win1.GetSample(i); this->SetSample(i, (1.0f - k) *v0 + k* v1); } } }; class SymmetricWindow_Axis : public SymmetricWindow_Base { public: virtual ~SymmetricWindow_Axis(){} virtual float GetSample(int i) const { if (i < 0) { if (-i >= m_data.size()) return 0.0f; return m_data[-i]; } else { if (i >= m_data.size()) return 0.0f; return m_data[i]; } } virtual void SetSample(int i, float v) { if (i < 0) { if (-i >= m_data.size()) return; m_data[-i] = v; } else { if (i >= m_data.size()) return; m_data[i] = v; } } void CreateFromAsymmetricWindow(const Window& src) { unsigned u_srcHalfWidth = src.GetHalfWidthOfData(); unsigned l = 0; unsigned fftLen = 1; while (fftLen < u_srcHalfWidth) { l++; fftLen <<= 1; } DComp* fftBuf = new DComp[fftLen]; memset(fftBuf, 0, sizeof(DComp)*fftLen); for (unsigned i = 0; i < fftLen; i++) { fftBuf[i].Re = (double)src.GetSample((int)i) + (double)src.GetSample((int)i - (int)fftLen); } fft(fftBuf, l); fftBuf[0].Re = 0.0f; fftBuf[0].Im = 0.0f; fftBuf[fftLen / 2].Re = 0.0f; fftBuf[fftLen / 2].Im = 0.0f; for (unsigned i = 1; i < fftLen /2; i++) { double absv = DCAbs(&fftBuf[i]); fftBuf[i].Re = absv; fftBuf[i].Im = 0.0f; fftBuf[fftLen-i].Re = absv; fftBuf[fftLen-i].Im = 0.0f; } ifft(fftBuf, l); m_data.resize(fftLen); m_halfWidth = (float)(fftLen); float rate = m_halfWidth / src.m_halfWidth; for (unsigned i = 0; i < fftLen; i++) m_data[i] = (float)fftBuf[i].Re; // rewindow float amplitude = sqrtf(rate); for (unsigned i = 0; i < fftLen; i++) { float window = (cosf((float)i * (float)PI / m_halfWidth) + 1.0f)*0.5f; m_data[i] *= window*amplitude; } delete[] fftBuf; } void Repitch_FormantPreserved(const SymmetricWindow_Axis& src, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned u_TargetHalfWidth = (unsigned)ceilf(targetHalfWidth); m_data.resize(u_TargetHalfWidth); float srcHalfWidth = src.m_halfWidth; unsigned uSrcHalfWidth = src.GetHalfWidthOfData(); float rate = targetHalfWidth / srcHalfWidth; float targetWidth = targetHalfWidth*2.0f; for (unsigned i = 0; (float)i < targetHalfWidth; i++) { m_data[i] = 0.0f; float srcPos = (float)i; unsigned uSrcPos = (unsigned)(srcPos + 0.5f); while (uSrcPos < uSrcHalfWidth) { m_data[i] += src.m_data[uSrcPos]; srcPos += targetHalfWidth; uSrcPos = (unsigned)(srcPos + 0.5f); } srcPos = targetHalfWidth - (float)i; uSrcPos = (unsigned)(srcPos + 0.5f); while (uSrcPos < uSrcHalfWidth) { m_data[i] += src.m_data[uSrcPos]; srcPos += targetHalfWidth; uSrcPos = (unsigned)(srcPos + 0.5f); } } // rewindow float amplitude = sqrtf(rate); for (unsigned i = 0; (float)i < targetHalfWidth; i++) { float window = (cosf((float)i * (float)PI / targetHalfWidth) + 1.0f)*0.5f; m_data[i] *= amplitude*window; } } void CreateFromAmpSpec(const AmpSpectrum& src, float targetHalfWidth=-1.0f) { unsigned l = 0; unsigned fftLen = 1; while ((float)fftLen < src.m_halfWidth) { l++; fftLen <<= 1; } DComp* fftBuf = new DComp[fftLen]; memset(fftBuf, 0, sizeof(DComp)*fftLen); float rate = (float)fftLen / src.m_halfWidth; for (unsigned i = 0; i < (unsigned)src.m_data.size(); i++) { if (i < fftLen / 2) { fftBuf[i].Re = src.m_data[i] * rate; if (i>0) fftBuf[fftLen - i].Re = src.m_data[i] * rate; } } ifft(fftBuf, l); SymmetricWindow_Axis tempWin; tempWin.m_halfWidth = (float)fftLen; tempWin.m_data.resize(fftLen); for (unsigned i = 0; i < fftLen; i++) { float window = (cosf((float)i * (float)PI / tempWin.m_halfWidth) + 1.0f)*0.5f; tempWin.m_data[i] = window*(float)fftBuf[i].Re; } delete[] fftBuf; this->Scale(tempWin, targetHalfWidth>0.0f ? targetHalfWidth: src.m_halfWidth); } }; class SymmetricWindow_Center : public SymmetricWindow_Base { public: virtual ~SymmetricWindow_Center(){} virtual float GetSample(int i) const { if (i < 0) { if (-i >= m_data.size()) return 0.0f; return -m_data[-i]; } else { if (i >= m_data.size()) return 0.0f; return m_data[i]; } } virtual void SetSample(int i, float v) { if (i < 0) { if (-i >= m_data.size()) return; m_data[-i] = -v; } else { if (i >= m_data.size()) return; m_data[i] = v; } } void CreateFromAsymmetricWindow(const Window& src) { unsigned u_srcHalfWidth = src.GetHalfWidthOfData(); unsigned l = 0; unsigned fftLen = 1; while (fftLen < u_srcHalfWidth) { l++; fftLen <<= 1; } DComp* fftBuf = new DComp[fftLen]; memset(fftBuf, 0, sizeof(DComp)*fftLen); for (unsigned i = 0; i < fftLen; i++) { fftBuf[i].Re = (double)src.GetSample((int)i) + (double)src.GetSample((int)i - (int)fftLen); } fft(fftBuf, l); fftBuf[0].Re = 0.0f; fftBuf[0].Im = 0.0f; fftBuf[fftLen / 2].Re = 0.0f; fftBuf[fftLen / 2].Im = 0.0f; for (unsigned i = 1; i < fftLen / 2; i++) { double absv = DCAbs(&fftBuf[i]); fftBuf[i].Re = 0.0f; fftBuf[i].Im = absv; fftBuf[fftLen - i].Re = 0.0f; fftBuf[fftLen - i].Im = -absv; } ifft(fftBuf, l); m_data.resize(fftLen); m_halfWidth = (float)(fftLen); float rate = m_halfWidth / src.m_halfWidth; for (unsigned i = 0; i < fftLen; i++) m_data[i] = (float)fftBuf[i].Re; // rewindow float amplitude = sqrtf(rate); for (unsigned i = 0; i < fftLen; i++) { float window = (cosf((float)i * (float)PI / m_halfWidth) + 1.0f)*0.5f; m_data[i] *= window*amplitude; } delete[] fftBuf; } void Repitch_FormantPreserved(const SymmetricWindow_Center& src, float targetHalfWidth) { m_halfWidth = targetHalfWidth; unsigned u_TargetHalfWidth = (unsigned)ceilf(targetHalfWidth); m_data.resize(u_TargetHalfWidth); float srcHalfWidth = src.m_halfWidth; unsigned uSrcHalfWidth = src.GetHalfWidthOfData(); float rate = targetHalfWidth / srcHalfWidth; float targetWidth = targetHalfWidth*2.0f; for (unsigned i = 0; (float)i < targetHalfWidth; i++) { m_data[i] = 0.0f; float srcPos = (float)i; unsigned uSrcPos = (unsigned)(srcPos + 0.5f); while (uSrcPos < uSrcHalfWidth) { m_data[i] += src.m_data[uSrcPos]; srcPos += targetHalfWidth; uSrcPos = (unsigned)(srcPos + 0.5f); } srcPos = targetHalfWidth - (float)i; uSrcPos = (unsigned)(srcPos + 0.5f); while (uSrcPos < uSrcHalfWidth) { m_data[i] -= src.m_data[uSrcPos]; srcPos += targetHalfWidth; uSrcPos = (unsigned)(srcPos + 0.5f); } } // rewindow float amplitude = sqrtf(rate); for (unsigned i = 0; (float)i < targetHalfWidth; i++) { float window = (cosf((float)i * (float)PI / targetHalfWidth) + 1.0f)*0.5f; m_data[i] *= amplitude*window; } } void CreateFromAmpSpec(const AmpSpectrum& src, float targetHalfWidth = -1.0f) { unsigned l = 0; unsigned fftLen = 1; while ((float)fftLen < src.m_halfWidth) { l++; fftLen <<= 1; } DComp* fftBuf = new DComp[fftLen]; memset(fftBuf, 0, sizeof(DComp)*fftLen); float rate = (float)fftLen / src.m_halfWidth; for (unsigned i = 1; i < (unsigned)src.m_data.size(); i++) { if (i < fftLen / 2) { fftBuf[i].Im = src.m_data[i] * rate; fftBuf[fftLen - i].Im = -src.m_data[i] * rate; } } ifft(fftBuf, l); SymmetricWindow_Center tempWin; tempWin.m_halfWidth = (float)fftLen; tempWin.m_data.resize(fftLen); for (unsigned i = 0; i < fftLen; i++) { float window = (cosf((float)i * (float)PI / tempWin.m_halfWidth) + 1.0f)*0.5f; tempWin.m_data[i] = window*(float)fftBuf[i].Re; } delete[] fftBuf; this->Scale(tempWin, targetHalfWidth>0.0f ? targetHalfWidth:src.m_halfWidth); } }; #if Symmetric_Type==Symmetric_Type_Axis typedef SymmetricWindow_Axis SymmetricWindow; #else typedef SymmetricWindow_Center SymmetricWindow; #endif #define AutoRegression_numCoefs 10 #define AutoRegression_numSD 10 class AutoRegression { static void LevinsonSolve(const float* samples, float* solution, unsigned n) { float *solution_last = new float[n]; for (unsigned pass = 0; pass < n; pass++) { float numerator = samples[pass + 1]; float denominator = samples[0]; for (unsigned i = 0; i < pass; i++) { numerator -= solution_last[i] * samples[pass - i]; denominator -= solution_last[i] * samples[i + 1]; } float solution_pass = numerator / denominator; solution[pass] = solution_pass; for (unsigned i = 0; i < pass; i++) solution[i] = solution_last[i]-solution_pass*solution_last[pass - 1 - i]; memcpy(solution_last, solution, sizeof(float)*n); } delete[] solution_last; /*for (unsigned i = 0; i < n; i++) { float y = samples[i + 1]; float y1 = 0.0f; for (unsigned j = 0; j < n; j++) { int delta = (int)i - (int)j; if (delta < 0) delta = -delta; y1 += samples[delta] * solution[j]; } printf("%f %f\n", y, y1); }*/ } public: float m_coefs[AutoRegression_numCoefs]; float m_sd[AutoRegression_numSD]; void Estimate(const float* samples, unsigned count) { if (count <= AutoRegression_numCoefs) return; float ave = 0.0f; for (unsigned i = 0; i < count; i++) { ave += samples[i]; } ave /= (float)(count); float* _samples = new float[count]; for (unsigned i = 0; i < count; i++) { _samples[i] = samples[i] - ave; } float ac[AutoRegression_numCoefs + 1]; for (unsigned i = 0; i <= AutoRegression_numCoefs; i++) { float sum = 0.0f; for (unsigned j = 0; j < count - i; j++) { sum += _samples[j] * _samples[j + i]; } ac[i] = sum; } if (ac[0] == 0.0f) { memset(m_coefs, 0, sizeof(float)* AutoRegression_numCoefs); memset(m_sd, 0, sizeof(float)* AutoRegression_numSD); return; } LevinsonSolve(ac, m_coefs, AutoRegression_numCoefs); unsigned num_samples = count - AutoRegression_numCoefs; float pos = 0.0f; float step = (float)num_samples / AutoRegression_numSD; for (unsigned j = 0; j < AutoRegression_numSD; j++, pos += step) { float dev = 0.0f; float sqrErr = 0.0f; for (unsigned i = (unsigned)ceilf(pos); i <= (unsigned)floorf(pos + step); i++) { if (i + AutoRegression_numCoefs < count) { float est = 0.0f; for (unsigned j = 0; j < AutoRegression_numCoefs; j++) { est += m_coefs[AutoRegression_numCoefs-1-j] * _samples[i + j]; } float err_i = _samples[i + AutoRegression_numCoefs] - est; sqrErr += err_i*err_i; dev += 1.0f; } } m_sd[j] = sqrtf(sqrErr / dev); //printf("%f ", m_sd[j]); } //printf("\n"); delete[] _samples; } }; } #endif ================================================ FILE: VoiceSampler/api.cpp ================================================ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #define SCOREDRAFT_API __declspec(dllexport) #else #define SCOREDRAFT_API #endif extern "C" { SCOREDRAFT_API unsigned HaveCUDA(); SCOREDRAFT_API void* FrqDataPointCreate(double freq, double dyn); SCOREDRAFT_API void FrqDataPointDestroy(void* ptr); SCOREDRAFT_API void* FrqDataCreate(); SCOREDRAFT_API void FrqDataDestroy(void* ptr); SCOREDRAFT_API void FrqDataSet(void* ptr, int interval, double key, void* ptr_data_points); SCOREDRAFT_API void FrqDataDetect(void* ptr, void* ptr_f32_buf, int interval); SCOREDRAFT_API void* SourceMapCtrlPntCreate(float srcPos, float dstPos, int isVowel); SCOREDRAFT_API void SourceMapCtrlPntDestroy(void* ptr); SCOREDRAFT_API void* PieceCreate(void* ptr_f32buf, void* ptr_frq_data, void* ptr_src_map); SCOREDRAFT_API void PieceDestroy(void* ptr); SCOREDRAFT_API void* GeneralCtrlPntCreate(float value, float dstPos); SCOREDRAFT_API void GeneralCtrlPntDestroy(void* ptr); SCOREDRAFT_API void* SentenceDescriptorCreate(void* ptr_pieces, void* ptr_piece_map, void* ptr_freq_map, void* ptr_volume_map); SCOREDRAFT_API void SentenceDescriptorDestroy(void* ptr); SCOREDRAFT_API void GenerateSentence(void* ptr_wavbuf, void* ptr_sentence); SCOREDRAFT_API void GenerateSentenceCUDA(void* ptr_wavbuf, void* ptr_sentence); } #include "utils.h" #include #include "SentenceDescriptor.h" #include "SentenceGeneratorCPU.h" #ifdef HAVE_CUDA #include "SentenceGeneratorCUDA.h" #include #endif #include #include "VoiceUtil.h" #include "FrequencyDetection.h" using namespace VoiceUtil; static bool s_have_cuda = false; unsigned HaveCUDA() { #if HAVE_CUDA int count; cudaGetDeviceCount(&count); if (count > 0 && cudaGetLastError() == 0) { cudaFree(nullptr); if (cudaGetLastError() == 0) s_have_cuda = true; } #endif return s_have_cuda?1:0; } void* FrqDataPointCreate(double freq, double dyn) { FrqDataPoint *pnt = new FrqDataPoint; pnt->freq = freq; pnt->dyn = dyn; return pnt; } void FrqDataPointDestroy(void* ptr) { delete (FrqDataPoint*)ptr; } void* FrqDataCreate() { return new FrqData; } void FrqDataDestroy(void* ptr) { delete (FrqData*)ptr; } void FrqDataSet(void* ptr, int interval, double key, void* ptr_data_points) { FrqData* frq_data = (FrqData*)ptr; PtrArray* data_points = (PtrArray*)ptr_data_points; frq_data->interval = interval; frq_data->key = key; frq_data->data.resize(data_points->size()); for (size_t i = 0; i < data_points->size(); i++) { FrqDataPoint *pnt = (FrqDataPoint *)(*data_points)[i]; frq_data->data[i] = *pnt; } } void DetectFreqs(const Buffer& buf, std::vector& frequencies, std::vector& dynamics, unsigned step) { unsigned halfWinLen = 1024; float* temp = new float[halfWinLen * 2]; for (unsigned center = 0; center < buf.m_data.size(); center += step) { Window win; win.CreateFromBuffer(buf, (float)center, (float)halfWinLen); for (int i = -(int)halfWinLen; i < (int)halfWinLen; i++) temp[i + halfWinLen] = win.GetSample(i); float freq; float dyn; fetchFrequency(halfWinLen * 2, temp, buf.m_sampleRate, freq, dyn); frequencies.push_back(freq); dynamics.push_back(dyn); } delete[] temp; } void FrqDataDetect(void* ptr, void* ptr_f32_buf, int interval) { FrqData* frq_data = (FrqData*)ptr; F32Buf* f32buf = (F32Buf*)ptr_f32_buf; size_t len = f32buf->size(); float* f32data = f32buf->data(); Buffer buf; buf.m_sampleRate = 44100; buf.Allocate((unsigned)len); memcpy(buf.m_data.data(), f32data, sizeof(float)*len); std::vector frequencies; std::vector dynamics; DetectFreqs(buf, frequencies, dynamics, interval); float ave = 0.0f; float count = 0.0f; for (unsigned i = 0; i < (unsigned)frequencies.size(); i++) { if (frequencies[i] > 55.0f) { count += 1.0f; ave += frequencies[i]; } } ave = ave / count; frq_data->interval = interval; frq_data->key = (double)ave; frq_data->data.resize(frequencies.size()); for (size_t i = 0; i < frequencies.size(); i++) { frq_data->data[i].freq = (double)frequencies[i]; frq_data->data[i].dyn = (double)dynamics[i]; } } void* SourceMapCtrlPntCreate(float srcPos, float dstPos, int isVowel) { SourceMapCtrlPnt* pnt = new SourceMapCtrlPnt; pnt->srcPos = srcPos; pnt->dstPos = dstPos; pnt->isVowel = isVowel; return pnt; } void SourceMapCtrlPntDestroy(void* ptr) { delete (SourceMapCtrlPnt*)ptr; } void* PieceCreate(void* ptr_f32buf, void* ptr_frq_data, void* ptr_src_map) { F32Buf* wav = (F32Buf*)ptr_f32buf; FrqData* frq_data = (FrqData*)ptr_frq_data; PtrArray* src_map = (PtrArray*)ptr_src_map; Piece* piece = new Piece; piece->src.wav.buf = wav->data(); piece->src.wav.len = (unsigned)wav->size(); piece->src.frq = *frq_data; piece->srcMap.resize(src_map->size()); for (size_t i = 0; i < src_map->size(); i++) { SourceMapCtrlPnt* pnt = (SourceMapCtrlPnt*)(*src_map)[i]; piece->srcMap[i] = *pnt; } return piece; } void PieceDestroy(void* ptr) { delete (Piece*)ptr; } void* GeneralCtrlPntCreate(float value, float dstPos) { GeneralCtrlPnt* pnt = new GeneralCtrlPnt; pnt->value = value; pnt->dstPos = dstPos; return pnt; } void GeneralCtrlPntDestroy(void* ptr) { delete (GeneralCtrlPnt*)ptr; } void* SentenceDescriptorCreate(void* ptr_pieces, void* ptr_piece_map, void* ptr_freq_map, void* ptr_volume_map) { PtrArray* pieces = (PtrArray*)ptr_pieces; PtrArray* piece_map = (PtrArray*)ptr_piece_map; PtrArray* freq_map = (PtrArray*)ptr_freq_map; PtrArray* volume_map = (PtrArray*)ptr_volume_map; SentenceDescriptor* descriptor = new SentenceDescriptor; descriptor->pieces.resize(pieces->size()); for (size_t i = 0; i < pieces->size(); i++) { Piece* piece = (Piece*)(*pieces)[i]; descriptor->pieces[i] = *piece; } descriptor->piece_map.resize(piece_map->size()); for (size_t i = 0; i < piece_map->size(); i++) { GeneralCtrlPnt* pnt = (GeneralCtrlPnt*)(*piece_map)[i]; descriptor->piece_map[i] = *pnt; } descriptor->freq_map.resize(freq_map->size()); for (size_t i = 0; i < freq_map->size(); i++) { GeneralCtrlPnt* pnt = (GeneralCtrlPnt*)(*freq_map)[i]; descriptor->freq_map[i] = *pnt; } descriptor->volume_map.resize(volume_map->size()); for (size_t i = 0; i < volume_map->size(); i++) { GeneralCtrlPnt* pnt = (GeneralCtrlPnt*)(*volume_map)[i]; descriptor->volume_map[i] = *pnt; } return descriptor; } void SentenceDescriptorDestroy(void* ptr) { delete (SentenceDescriptor*)ptr; } inline void GenerateSentenceX(void* ptr_wavbuf, void* ptr_sentence, bool cuda) { WavBuffer* wavbuf = (WavBuffer*)ptr_wavbuf; SentenceDescriptor* sentence = (SentenceDescriptor*)ptr_sentence; std::vector& pieces = sentence->pieces; float falignPos = -pieces[0].srcMap[0].dstPos; for (size_t i = 0; i < pieces.size(); i++) { Piece& piece = pieces[i]; std::vector& srcMap = piece.srcMap; for (size_t j = 0; j < srcMap.size(); j++) { srcMap[j].dstPos += falignPos; } } std::vector& piece_map = sentence->piece_map; std::vector& freq_map = sentence->freq_map; std::vector& volume_map = sentence->volume_map; for (size_t i = 0; i < piece_map.size(); i++) piece_map[i].dstPos += falignPos; for (size_t i = 0; i < freq_map.size(); i++) freq_map[i].dstPos += falignPos; for (size_t i = 0; i < volume_map.size(); i++) volume_map[i].dstPos += falignPos; float flen = freq_map[freq_map.size() - 1].dstPos; float rate = wavbuf->m_sampleRate; wavbuf->m_alignPos = (unsigned)(falignPos*0.001f*rate + 0.5f); size_t len = (size_t)ceilf(flen*0.001f*rate); wavbuf->Allocate(1, len); #ifdef HAVE_CUDA if (cuda && HaveCUDA()!=0) GenerateSentenceCUDA(sentence, wavbuf->m_data, (unsigned)len); else #endif GenerateSentenceCPU(sentence, wavbuf->m_data, (unsigned)len); } void GenerateSentence(void* ptr_wavbuf, void* ptr_sentence) { GenerateSentenceX(ptr_wavbuf, ptr_sentence, false); } void GenerateSentenceCUDA(void* ptr_wavbuf, void* ptr_sentence) { GenerateSentenceX(ptr_wavbuf, ptr_sentence, true); } ================================================ FILE: VoiceSampler/fft.cuh ================================================ #include "helper_math.h" #define PI ((float)3.1415926535897932384626433832795) __device__ unsigned short reverseBits(unsigned short x, unsigned l) { x = (((x & 0xaaaa) >> 1) | ((x & 0x5555) << 1)); x = (((x & 0xcccc) >> 2) | ((x & 0x3333) << 2)); x = (((x & 0xf0f0) >> 4) | ((x & 0x0f0f) << 4)); x = ((x >> 8) | (x << 8)); return x >> (16 - l); } __device__ float2 CompMul(const float2& c1, const float2& c2) { float2 ret; ret.x = c1.x*c2.x - c1.y*c2.y; ret.y = c1.x*c2.y + c1.y*c2.x; return ret; } __device__ float2 CompPowN(float2 c, unsigned n) { float2 mul = c; float2 ret = make_float2(1.0f, 0.0f); while (n > 0) { if (n & 1) { ret = CompMul(ret, mul); } mul = CompMul(mul, mul); n >>= 1; } return ret; } __device__ void d_fft(float* a, unsigned l) { unsigned n = 1 << l; unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (unsigned short i = (unsigned short)workerId+1; i< (unsigned short)n - 1; i += (unsigned short)numWorker) { unsigned short j = reverseBits(i,l); unsigned u, v; if (i < j) { u = i; v = j; } else if (j lastj) { u = CompMul(u, w); lastj = j; } float2 comp_a_i = make_float2(a[i], a[i + n]); float2 comp_a_ip = make_float2(a[ip], a[ip + n]); float2 t = CompMul(u, comp_a_ip); comp_a_ip = comp_a_i - t; comp_a_i = comp_a_i + t; a[i] = comp_a_i.x; a[i + n] = comp_a_i.y; a[ip] = comp_a_ip.x; a[ip + n] = comp_a_ip.y; } __syncthreads(); } } __global__ void g_fft_test(float* d_buf, unsigned l) { d_fft(d_buf, l); } void h_fft_test(float* d_buf, unsigned l) { g_fft_test << <1, 256 >> >(d_buf, l); } __device__ void d_ifft(float* a, unsigned l) { unsigned n = 1 << l; unsigned numWorker = blockDim.x; unsigned workerId = threadIdx.x; for (unsigned short i = (unsigned short)workerId + 1; i< (unsigned short)n - 1; i += (unsigned short)numWorker) { unsigned short j = reverseBits(i, l); unsigned u, v; if (i < j) { u = i; v = j; } else if (j lastj) { u = CompMul(u, w); lastj = j; } float2 comp_a_i = make_float2(0.5f*a[i], 0.5f*a[i + n]); float2 comp_a_ip = make_float2(a[ip], a[ip + n]); float2 t = CompMul(u, comp_a_ip); comp_a_ip = comp_a_i - t; comp_a_i = comp_a_i + t; a[i] = comp_a_i.x; a[i + n] = comp_a_i.y; a[ip] = comp_a_ip.x; a[ip + n] = comp_a_ip.y; } __syncthreads(); } } __global__ void g_ifft_test(float* d_buf, unsigned l) { d_ifft(d_buf, l); } void h_ifft_test(float* d_buf, unsigned l) { g_ifft_test << <1, 256 >> >(d_buf, l); } ================================================ FILE: VoiceSampler/helper_math.h ================================================ /** * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. * * Please refer to the NVIDIA end user license agreement (EULA) associated * with this source code for terms and conditions that govern your use of * this software. Any use, reproduction, disclosure, or distribution of * this software and related documentation outside the terms of the EULA * is strictly prohibited. * */ /* * This file implements common mathematical operations on vector types * (float3, float4 etc.) since these are not provided as standard by CUDA. * * The syntax is modeled on the Cg standard library. * * This is part of the Helper library includes * * Thanks to Linh Hah for additions and fixes. */ #ifndef HELPER_MATH_H #define HELPER_MATH_H #include "cuda_runtime.h" typedef unsigned int uint; typedef unsigned short ushort; #ifndef EXIT_WAIVED #define EXIT_WAIVED 2 #endif #ifndef __CUDACC__ #include //////////////////////////////////////////////////////////////////////////////// // host implementations of CUDA functions //////////////////////////////////////////////////////////////////////////////// inline float fminf(float a, float b) { return a < b ? a : b; } inline float fmaxf(float a, float b) { return a > b ? a : b; } inline int max(int a, int b) { return a > b ? a : b; } inline int min(int a, int b) { return a < b ? a : b; } inline float rsqrtf(float x) { return 1.0f / sqrtf(x); } #endif //////////////////////////////////////////////////////////////////////////////// // constructors //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 make_float2(float s) { return make_float2(s, s); } inline __host__ __device__ float2 make_float2(float3 a) { return make_float2(a.x, a.y); } inline __host__ __device__ float2 make_float2(int2 a) { return make_float2(float(a.x), float(a.y)); } inline __host__ __device__ float2 make_float2(uint2 a) { return make_float2(float(a.x), float(a.y)); } inline __host__ __device__ int2 make_int2(int s) { return make_int2(s, s); } inline __host__ __device__ int2 make_int2(int3 a) { return make_int2(a.x, a.y); } inline __host__ __device__ int2 make_int2(uint2 a) { return make_int2(int(a.x), int(a.y)); } inline __host__ __device__ int2 make_int2(float2 a) { return make_int2(int(a.x), int(a.y)); } inline __host__ __device__ uint2 make_uint2(uint s) { return make_uint2(s, s); } inline __host__ __device__ uint2 make_uint2(uint3 a) { return make_uint2(a.x, a.y); } inline __host__ __device__ uint2 make_uint2(int2 a) { return make_uint2(uint(a.x), uint(a.y)); } inline __host__ __device__ float3 make_float3(float s) { return make_float3(s, s, s); } inline __host__ __device__ float3 make_float3(float2 a) { return make_float3(a.x, a.y, 0.0f); } inline __host__ __device__ float3 make_float3(float2 a, float s) { return make_float3(a.x, a.y, s); } inline __host__ __device__ float3 make_float3(float4 a) { return make_float3(a.x, a.y, a.z); } inline __host__ __device__ float3 make_float3(int3 a) { return make_float3(float(a.x), float(a.y), float(a.z)); } inline __host__ __device__ float3 make_float3(uint3 a) { return make_float3(float(a.x), float(a.y), float(a.z)); } inline __host__ __device__ int3 make_int3(int s) { return make_int3(s, s, s); } inline __host__ __device__ int3 make_int3(int2 a) { return make_int3(a.x, a.y, 0); } inline __host__ __device__ int3 make_int3(int2 a, int s) { return make_int3(a.x, a.y, s); } inline __host__ __device__ int3 make_int3(uint3 a) { return make_int3(int(a.x), int(a.y), int(a.z)); } inline __host__ __device__ int3 make_int3(float3 a) { return make_int3(int(a.x), int(a.y), int(a.z)); } inline __host__ __device__ uint3 make_uint3(uint s) { return make_uint3(s, s, s); } inline __host__ __device__ uint3 make_uint3(uint2 a) { return make_uint3(a.x, a.y, 0); } inline __host__ __device__ uint3 make_uint3(uint2 a, uint s) { return make_uint3(a.x, a.y, s); } inline __host__ __device__ uint3 make_uint3(uint4 a) { return make_uint3(a.x, a.y, a.z); } inline __host__ __device__ uint3 make_uint3(int3 a) { return make_uint3(uint(a.x), uint(a.y), uint(a.z)); } inline __host__ __device__ float4 make_float4(float s) { return make_float4(s, s, s, s); } inline __host__ __device__ float4 make_float4(float3 a) { return make_float4(a.x, a.y, a.z, 0.0f); } inline __host__ __device__ float4 make_float4(float3 a, float w) { return make_float4(a.x, a.y, a.z, w); } inline __host__ __device__ float4 make_float4(int4 a) { return make_float4(float(a.x), float(a.y), float(a.z), float(a.w)); } inline __host__ __device__ float4 make_float4(uint4 a) { return make_float4(float(a.x), float(a.y), float(a.z), float(a.w)); } inline __host__ __device__ int4 make_int4(int s) { return make_int4(s, s, s, s); } inline __host__ __device__ int4 make_int4(int3 a) { return make_int4(a.x, a.y, a.z, 0); } inline __host__ __device__ int4 make_int4(int3 a, int w) { return make_int4(a.x, a.y, a.z, w); } inline __host__ __device__ int4 make_int4(uint4 a) { return make_int4(int(a.x), int(a.y), int(a.z), int(a.w)); } inline __host__ __device__ int4 make_int4(float4 a) { return make_int4(int(a.x), int(a.y), int(a.z), int(a.w)); } inline __host__ __device__ uint4 make_uint4(uint s) { return make_uint4(s, s, s, s); } inline __host__ __device__ uint4 make_uint4(uint3 a) { return make_uint4(a.x, a.y, a.z, 0); } inline __host__ __device__ uint4 make_uint4(uint3 a, uint w) { return make_uint4(a.x, a.y, a.z, w); } inline __host__ __device__ uint4 make_uint4(int4 a) { return make_uint4(uint(a.x), uint(a.y), uint(a.z), uint(a.w)); } //////////////////////////////////////////////////////////////////////////////// // negate //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 operator-(float2 &a) { return make_float2(-a.x, -a.y); } inline __host__ __device__ int2 operator-(int2 &a) { return make_int2(-a.x, -a.y); } inline __host__ __device__ float3 operator-(float3 &a) { return make_float3(-a.x, -a.y, -a.z); } inline __host__ __device__ int3 operator-(int3 &a) { return make_int3(-a.x, -a.y, -a.z); } inline __host__ __device__ float4 operator-(float4 &a) { return make_float4(-a.x, -a.y, -a.z, -a.w); } inline __host__ __device__ int4 operator-(int4 &a) { return make_int4(-a.x, -a.y, -a.z, -a.w); } //////////////////////////////////////////////////////////////////////////////// // addition //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 operator+(float2 a, float2 b) { return make_float2(a.x + b.x, a.y + b.y); } inline __host__ __device__ void operator+=(float2 &a, float2 b) { a.x += b.x; a.y += b.y; } inline __host__ __device__ float2 operator+(float2 a, float b) { return make_float2(a.x + b, a.y + b); } inline __host__ __device__ float2 operator+(float b, float2 a) { return make_float2(a.x + b, a.y + b); } inline __host__ __device__ void operator+=(float2 &a, float b) { a.x += b; a.y += b; } inline __host__ __device__ int2 operator+(int2 a, int2 b) { return make_int2(a.x + b.x, a.y + b.y); } inline __host__ __device__ void operator+=(int2 &a, int2 b) { a.x += b.x; a.y += b.y; } inline __host__ __device__ int2 operator+(int2 a, int b) { return make_int2(a.x + b, a.y + b); } inline __host__ __device__ int2 operator+(int b, int2 a) { return make_int2(a.x + b, a.y + b); } inline __host__ __device__ void operator+=(int2 &a, int b) { a.x += b; a.y += b; } inline __host__ __device__ uint2 operator+(uint2 a, uint2 b) { return make_uint2(a.x + b.x, a.y + b.y); } inline __host__ __device__ void operator+=(uint2 &a, uint2 b) { a.x += b.x; a.y += b.y; } inline __host__ __device__ uint2 operator+(uint2 a, uint b) { return make_uint2(a.x + b, a.y + b); } inline __host__ __device__ uint2 operator+(uint b, uint2 a) { return make_uint2(a.x + b, a.y + b); } inline __host__ __device__ void operator+=(uint2 &a, uint b) { a.x += b; a.y += b; } inline __host__ __device__ float3 operator+(float3 a, float3 b) { return make_float3(a.x + b.x, a.y + b.y, a.z + b.z); } inline __host__ __device__ void operator+=(float3 &a, float3 b) { a.x += b.x; a.y += b.y; a.z += b.z; } inline __host__ __device__ float3 operator+(float3 a, float b) { return make_float3(a.x + b, a.y + b, a.z + b); } inline __host__ __device__ void operator+=(float3 &a, float b) { a.x += b; a.y += b; a.z += b; } inline __host__ __device__ int3 operator+(int3 a, int3 b) { return make_int3(a.x + b.x, a.y + b.y, a.z + b.z); } inline __host__ __device__ void operator+=(int3 &a, int3 b) { a.x += b.x; a.y += b.y; a.z += b.z; } inline __host__ __device__ int3 operator+(int3 a, int b) { return make_int3(a.x + b, a.y + b, a.z + b); } inline __host__ __device__ void operator+=(int3 &a, int b) { a.x += b; a.y += b; a.z += b; } inline __host__ __device__ uint3 operator+(uint3 a, uint3 b) { return make_uint3(a.x + b.x, a.y + b.y, a.z + b.z); } inline __host__ __device__ void operator+=(uint3 &a, uint3 b) { a.x += b.x; a.y += b.y; a.z += b.z; } inline __host__ __device__ uint3 operator+(uint3 a, uint b) { return make_uint3(a.x + b, a.y + b, a.z + b); } inline __host__ __device__ void operator+=(uint3 &a, uint b) { a.x += b; a.y += b; a.z += b; } inline __host__ __device__ int3 operator+(int b, int3 a) { return make_int3(a.x + b, a.y + b, a.z + b); } inline __host__ __device__ uint3 operator+(uint b, uint3 a) { return make_uint3(a.x + b, a.y + b, a.z + b); } inline __host__ __device__ float3 operator+(float b, float3 a) { return make_float3(a.x + b, a.y + b, a.z + b); } inline __host__ __device__ float4 operator+(float4 a, float4 b) { return make_float4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } inline __host__ __device__ void operator+=(float4 &a, float4 b) { a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w; } inline __host__ __device__ float4 operator+(float4 a, float b) { return make_float4(a.x + b, a.y + b, a.z + b, a.w + b); } inline __host__ __device__ float4 operator+(float b, float4 a) { return make_float4(a.x + b, a.y + b, a.z + b, a.w + b); } inline __host__ __device__ void operator+=(float4 &a, float b) { a.x += b; a.y += b; a.z += b; a.w += b; } inline __host__ __device__ int4 operator+(int4 a, int4 b) { return make_int4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } inline __host__ __device__ void operator+=(int4 &a, int4 b) { a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w; } inline __host__ __device__ int4 operator+(int4 a, int b) { return make_int4(a.x + b, a.y + b, a.z + b, a.w + b); } inline __host__ __device__ int4 operator+(int b, int4 a) { return make_int4(a.x + b, a.y + b, a.z + b, a.w + b); } inline __host__ __device__ void operator+=(int4 &a, int b) { a.x += b; a.y += b; a.z += b; a.w += b; } inline __host__ __device__ uint4 operator+(uint4 a, uint4 b) { return make_uint4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } inline __host__ __device__ void operator+=(uint4 &a, uint4 b) { a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w; } inline __host__ __device__ uint4 operator+(uint4 a, uint b) { return make_uint4(a.x + b, a.y + b, a.z + b, a.w + b); } inline __host__ __device__ uint4 operator+(uint b, uint4 a) { return make_uint4(a.x + b, a.y + b, a.z + b, a.w + b); } inline __host__ __device__ void operator+=(uint4 &a, uint b) { a.x += b; a.y += b; a.z += b; a.w += b; } //////////////////////////////////////////////////////////////////////////////// // subtract //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 operator-(float2 a, float2 b) { return make_float2(a.x - b.x, a.y - b.y); } inline __host__ __device__ void operator-=(float2 &a, float2 b) { a.x -= b.x; a.y -= b.y; } inline __host__ __device__ float2 operator-(float2 a, float b) { return make_float2(a.x - b, a.y - b); } inline __host__ __device__ float2 operator-(float b, float2 a) { return make_float2(b - a.x, b - a.y); } inline __host__ __device__ void operator-=(float2 &a, float b) { a.x -= b; a.y -= b; } inline __host__ __device__ int2 operator-(int2 a, int2 b) { return make_int2(a.x - b.x, a.y - b.y); } inline __host__ __device__ void operator-=(int2 &a, int2 b) { a.x -= b.x; a.y -= b.y; } inline __host__ __device__ int2 operator-(int2 a, int b) { return make_int2(a.x - b, a.y - b); } inline __host__ __device__ int2 operator-(int b, int2 a) { return make_int2(b - a.x, b - a.y); } inline __host__ __device__ void operator-=(int2 &a, int b) { a.x -= b; a.y -= b; } inline __host__ __device__ uint2 operator-(uint2 a, uint2 b) { return make_uint2(a.x - b.x, a.y - b.y); } inline __host__ __device__ void operator-=(uint2 &a, uint2 b) { a.x -= b.x; a.y -= b.y; } inline __host__ __device__ uint2 operator-(uint2 a, uint b) { return make_uint2(a.x - b, a.y - b); } inline __host__ __device__ uint2 operator-(uint b, uint2 a) { return make_uint2(b - a.x, b - a.y); } inline __host__ __device__ void operator-=(uint2 &a, uint b) { a.x -= b; a.y -= b; } inline __host__ __device__ float3 operator-(float3 a, float3 b) { return make_float3(a.x - b.x, a.y - b.y, a.z - b.z); } inline __host__ __device__ void operator-=(float3 &a, float3 b) { a.x -= b.x; a.y -= b.y; a.z -= b.z; } inline __host__ __device__ float3 operator-(float3 a, float b) { return make_float3(a.x - b, a.y - b, a.z - b); } inline __host__ __device__ float3 operator-(float b, float3 a) { return make_float3(b - a.x, b - a.y, b - a.z); } inline __host__ __device__ void operator-=(float3 &a, float b) { a.x -= b; a.y -= b; a.z -= b; } inline __host__ __device__ int3 operator-(int3 a, int3 b) { return make_int3(a.x - b.x, a.y - b.y, a.z - b.z); } inline __host__ __device__ void operator-=(int3 &a, int3 b) { a.x -= b.x; a.y -= b.y; a.z -= b.z; } inline __host__ __device__ int3 operator-(int3 a, int b) { return make_int3(a.x - b, a.y - b, a.z - b); } inline __host__ __device__ int3 operator-(int b, int3 a) { return make_int3(b - a.x, b - a.y, b - a.z); } inline __host__ __device__ void operator-=(int3 &a, int b) { a.x -= b; a.y -= b; a.z -= b; } inline __host__ __device__ uint3 operator-(uint3 a, uint3 b) { return make_uint3(a.x - b.x, a.y - b.y, a.z - b.z); } inline __host__ __device__ void operator-=(uint3 &a, uint3 b) { a.x -= b.x; a.y -= b.y; a.z -= b.z; } inline __host__ __device__ uint3 operator-(uint3 a, uint b) { return make_uint3(a.x - b, a.y - b, a.z - b); } inline __host__ __device__ uint3 operator-(uint b, uint3 a) { return make_uint3(b - a.x, b - a.y, b - a.z); } inline __host__ __device__ void operator-=(uint3 &a, uint b) { a.x -= b; a.y -= b; a.z -= b; } inline __host__ __device__ float4 operator-(float4 a, float4 b) { return make_float4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); } inline __host__ __device__ void operator-=(float4 &a, float4 b) { a.x -= b.x; a.y -= b.y; a.z -= b.z; a.w -= b.w; } inline __host__ __device__ float4 operator-(float4 a, float b) { return make_float4(a.x - b, a.y - b, a.z - b, a.w - b); } inline __host__ __device__ void operator-=(float4 &a, float b) { a.x -= b; a.y -= b; a.z -= b; a.w -= b; } inline __host__ __device__ int4 operator-(int4 a, int4 b) { return make_int4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); } inline __host__ __device__ void operator-=(int4 &a, int4 b) { a.x -= b.x; a.y -= b.y; a.z -= b.z; a.w -= b.w; } inline __host__ __device__ int4 operator-(int4 a, int b) { return make_int4(a.x - b, a.y - b, a.z - b, a.w - b); } inline __host__ __device__ int4 operator-(int b, int4 a) { return make_int4(b - a.x, b - a.y, b - a.z, b - a.w); } inline __host__ __device__ void operator-=(int4 &a, int b) { a.x -= b; a.y -= b; a.z -= b; a.w -= b; } inline __host__ __device__ uint4 operator-(uint4 a, uint4 b) { return make_uint4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); } inline __host__ __device__ void operator-=(uint4 &a, uint4 b) { a.x -= b.x; a.y -= b.y; a.z -= b.z; a.w -= b.w; } inline __host__ __device__ uint4 operator-(uint4 a, uint b) { return make_uint4(a.x - b, a.y - b, a.z - b, a.w - b); } inline __host__ __device__ uint4 operator-(uint b, uint4 a) { return make_uint4(b - a.x, b - a.y, b - a.z, b - a.w); } inline __host__ __device__ void operator-=(uint4 &a, uint b) { a.x -= b; a.y -= b; a.z -= b; a.w -= b; } //////////////////////////////////////////////////////////////////////////////// // multiply //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 operator*(float2 a, float2 b) { return make_float2(a.x * b.x, a.y * b.y); } inline __host__ __device__ void operator*=(float2 &a, float2 b) { a.x *= b.x; a.y *= b.y; } inline __host__ __device__ float2 operator*(float2 a, float b) { return make_float2(a.x * b, a.y * b); } inline __host__ __device__ float2 operator*(float b, float2 a) { return make_float2(b * a.x, b * a.y); } inline __host__ __device__ void operator*=(float2 &a, float b) { a.x *= b; a.y *= b; } inline __host__ __device__ int2 operator*(int2 a, int2 b) { return make_int2(a.x * b.x, a.y * b.y); } inline __host__ __device__ void operator*=(int2 &a, int2 b) { a.x *= b.x; a.y *= b.y; } inline __host__ __device__ int2 operator*(int2 a, int b) { return make_int2(a.x * b, a.y * b); } inline __host__ __device__ int2 operator*(int b, int2 a) { return make_int2(b * a.x, b * a.y); } inline __host__ __device__ void operator*=(int2 &a, int b) { a.x *= b; a.y *= b; } inline __host__ __device__ uint2 operator*(uint2 a, uint2 b) { return make_uint2(a.x * b.x, a.y * b.y); } inline __host__ __device__ void operator*=(uint2 &a, uint2 b) { a.x *= b.x; a.y *= b.y; } inline __host__ __device__ uint2 operator*(uint2 a, uint b) { return make_uint2(a.x * b, a.y * b); } inline __host__ __device__ uint2 operator*(uint b, uint2 a) { return make_uint2(b * a.x, b * a.y); } inline __host__ __device__ void operator*=(uint2 &a, uint b) { a.x *= b; a.y *= b; } inline __host__ __device__ float3 operator*(float3 a, float3 b) { return make_float3(a.x * b.x, a.y * b.y, a.z * b.z); } inline __host__ __device__ void operator*=(float3 &a, float3 b) { a.x *= b.x; a.y *= b.y; a.z *= b.z; } inline __host__ __device__ float3 operator*(float3 a, float b) { return make_float3(a.x * b, a.y * b, a.z * b); } inline __host__ __device__ float3 operator*(float b, float3 a) { return make_float3(b * a.x, b * a.y, b * a.z); } inline __host__ __device__ void operator*=(float3 &a, float b) { a.x *= b; a.y *= b; a.z *= b; } inline __host__ __device__ int3 operator*(int3 a, int3 b) { return make_int3(a.x * b.x, a.y * b.y, a.z * b.z); } inline __host__ __device__ void operator*=(int3 &a, int3 b) { a.x *= b.x; a.y *= b.y; a.z *= b.z; } inline __host__ __device__ int3 operator*(int3 a, int b) { return make_int3(a.x * b, a.y * b, a.z * b); } inline __host__ __device__ int3 operator*(int b, int3 a) { return make_int3(b * a.x, b * a.y, b * a.z); } inline __host__ __device__ void operator*=(int3 &a, int b) { a.x *= b; a.y *= b; a.z *= b; } inline __host__ __device__ uint3 operator*(uint3 a, uint3 b) { return make_uint3(a.x * b.x, a.y * b.y, a.z * b.z); } inline __host__ __device__ void operator*=(uint3 &a, uint3 b) { a.x *= b.x; a.y *= b.y; a.z *= b.z; } inline __host__ __device__ uint3 operator*(uint3 a, uint b) { return make_uint3(a.x * b, a.y * b, a.z * b); } inline __host__ __device__ uint3 operator*(uint b, uint3 a) { return make_uint3(b * a.x, b * a.y, b * a.z); } inline __host__ __device__ void operator*=(uint3 &a, uint b) { a.x *= b; a.y *= b; a.z *= b; } inline __host__ __device__ float4 operator*(float4 a, float4 b) { return make_float4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); } inline __host__ __device__ void operator*=(float4 &a, float4 b) { a.x *= b.x; a.y *= b.y; a.z *= b.z; a.w *= b.w; } inline __host__ __device__ float4 operator*(float4 a, float b) { return make_float4(a.x * b, a.y * b, a.z * b, a.w * b); } inline __host__ __device__ float4 operator*(float b, float4 a) { return make_float4(b * a.x, b * a.y, b * a.z, b * a.w); } inline __host__ __device__ void operator*=(float4 &a, float b) { a.x *= b; a.y *= b; a.z *= b; a.w *= b; } inline __host__ __device__ int4 operator*(int4 a, int4 b) { return make_int4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); } inline __host__ __device__ void operator*=(int4 &a, int4 b) { a.x *= b.x; a.y *= b.y; a.z *= b.z; a.w *= b.w; } inline __host__ __device__ int4 operator*(int4 a, int b) { return make_int4(a.x * b, a.y * b, a.z * b, a.w * b); } inline __host__ __device__ int4 operator*(int b, int4 a) { return make_int4(b * a.x, b * a.y, b * a.z, b * a.w); } inline __host__ __device__ void operator*=(int4 &a, int b) { a.x *= b; a.y *= b; a.z *= b; a.w *= b; } inline __host__ __device__ uint4 operator*(uint4 a, uint4 b) { return make_uint4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); } inline __host__ __device__ void operator*=(uint4 &a, uint4 b) { a.x *= b.x; a.y *= b.y; a.z *= b.z; a.w *= b.w; } inline __host__ __device__ uint4 operator*(uint4 a, uint b) { return make_uint4(a.x * b, a.y * b, a.z * b, a.w * b); } inline __host__ __device__ uint4 operator*(uint b, uint4 a) { return make_uint4(b * a.x, b * a.y, b * a.z, b * a.w); } inline __host__ __device__ void operator*=(uint4 &a, uint b) { a.x *= b; a.y *= b; a.z *= b; a.w *= b; } //////////////////////////////////////////////////////////////////////////////// // divide //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 operator/(float2 a, float2 b) { return make_float2(a.x / b.x, a.y / b.y); } inline __host__ __device__ void operator/=(float2 &a, float2 b) { a.x /= b.x; a.y /= b.y; } inline __host__ __device__ float2 operator/(float2 a, float b) { return make_float2(a.x / b, a.y / b); } inline __host__ __device__ void operator/=(float2 &a, float b) { a.x /= b; a.y /= b; } inline __host__ __device__ float2 operator/(float b, float2 a) { return make_float2(b / a.x, b / a.y); } inline __host__ __device__ float3 operator/(float3 a, float3 b) { return make_float3(a.x / b.x, a.y / b.y, a.z / b.z); } inline __host__ __device__ void operator/=(float3 &a, float3 b) { a.x /= b.x; a.y /= b.y; a.z /= b.z; } inline __host__ __device__ float3 operator/(float3 a, float b) { return make_float3(a.x / b, a.y / b, a.z / b); } inline __host__ __device__ void operator/=(float3 &a, float b) { a.x /= b; a.y /= b; a.z /= b; } inline __host__ __device__ float3 operator/(float b, float3 a) { return make_float3(b / a.x, b / a.y, b / a.z); } inline __host__ __device__ float4 operator/(float4 a, float4 b) { return make_float4(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); } inline __host__ __device__ void operator/=(float4 &a, float4 b) { a.x /= b.x; a.y /= b.y; a.z /= b.z; a.w /= b.w; } inline __host__ __device__ float4 operator/(float4 a, float b) { return make_float4(a.x / b, a.y / b, a.z / b, a.w / b); } inline __host__ __device__ void operator/=(float4 &a, float b) { a.x /= b; a.y /= b; a.z /= b; a.w /= b; } inline __host__ __device__ float4 operator/(float b, float4 a) { return make_float4(b / a.x, b / a.y, b / a.z, b / a.w); } //////////////////////////////////////////////////////////////////////////////// // min //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 fminf(float2 a, float2 b) { return make_float2(fminf(a.x,b.x), fminf(a.y,b.y)); } inline __host__ __device__ float3 fminf(float3 a, float3 b) { return make_float3(fminf(a.x,b.x), fminf(a.y,b.y), fminf(a.z,b.z)); } inline __host__ __device__ float4 fminf(float4 a, float4 b) { return make_float4(fminf(a.x,b.x), fminf(a.y,b.y), fminf(a.z,b.z), fminf(a.w,b.w)); } inline __host__ __device__ int2 min(int2 a, int2 b) { return make_int2(min(a.x,b.x), min(a.y,b.y)); } inline __host__ __device__ int3 min(int3 a, int3 b) { return make_int3(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z)); } inline __host__ __device__ int4 min(int4 a, int4 b) { return make_int4(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z), min(a.w,b.w)); } inline __host__ __device__ uint2 min(uint2 a, uint2 b) { return make_uint2(min(a.x,b.x), min(a.y,b.y)); } inline __host__ __device__ uint3 min(uint3 a, uint3 b) { return make_uint3(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z)); } inline __host__ __device__ uint4 min(uint4 a, uint4 b) { return make_uint4(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z), min(a.w,b.w)); } //////////////////////////////////////////////////////////////////////////////// // max //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 fmaxf(float2 a, float2 b) { return make_float2(fmaxf(a.x,b.x), fmaxf(a.y,b.y)); } inline __host__ __device__ float3 fmaxf(float3 a, float3 b) { return make_float3(fmaxf(a.x,b.x), fmaxf(a.y,b.y), fmaxf(a.z,b.z)); } inline __host__ __device__ float4 fmaxf(float4 a, float4 b) { return make_float4(fmaxf(a.x,b.x), fmaxf(a.y,b.y), fmaxf(a.z,b.z), fmaxf(a.w,b.w)); } inline __host__ __device__ int2 max(int2 a, int2 b) { return make_int2(max(a.x,b.x), max(a.y,b.y)); } inline __host__ __device__ int3 max(int3 a, int3 b) { return make_int3(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z)); } inline __host__ __device__ int4 max(int4 a, int4 b) { return make_int4(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z), max(a.w,b.w)); } inline __host__ __device__ uint2 max(uint2 a, uint2 b) { return make_uint2(max(a.x,b.x), max(a.y,b.y)); } inline __host__ __device__ uint3 max(uint3 a, uint3 b) { return make_uint3(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z)); } inline __host__ __device__ uint4 max(uint4 a, uint4 b) { return make_uint4(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z), max(a.w,b.w)); } //////////////////////////////////////////////////////////////////////////////// // lerp // - linear interpolation between a and b, based on value t in [0, 1] range //////////////////////////////////////////////////////////////////////////////// inline __device__ __host__ float lerp(float a, float b, float t) { return a + t*(b-a); } inline __device__ __host__ float2 lerp(float2 a, float2 b, float t) { return a + t*(b-a); } inline __device__ __host__ float3 lerp(float3 a, float3 b, float t) { return a + t*(b-a); } inline __device__ __host__ float4 lerp(float4 a, float4 b, float t) { return a + t*(b-a); } //////////////////////////////////////////////////////////////////////////////// // clamp // - clamp the value v to be in the range [a, b] //////////////////////////////////////////////////////////////////////////////// inline __device__ __host__ float clamp(float f, float a, float b) { return fmaxf(a, fminf(f, b)); } inline __device__ __host__ int clamp(int f, int a, int b) { return max(a, min(f, b)); } inline __device__ __host__ uint clamp(uint f, uint a, uint b) { return max(a, min(f, b)); } inline __device__ __host__ float2 clamp(float2 v, float a, float b) { return make_float2(clamp(v.x, a, b), clamp(v.y, a, b)); } inline __device__ __host__ float2 clamp(float2 v, float2 a, float2 b) { return make_float2(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y)); } inline __device__ __host__ float3 clamp(float3 v, float a, float b) { return make_float3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b)); } inline __device__ __host__ float3 clamp(float3 v, float3 a, float3 b) { return make_float3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z)); } inline __device__ __host__ float4 clamp(float4 v, float a, float b) { return make_float4(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b), clamp(v.w, a, b)); } inline __device__ __host__ float4 clamp(float4 v, float4 a, float4 b) { return make_float4(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z), clamp(v.w, a.w, b.w)); } inline __device__ __host__ int2 clamp(int2 v, int a, int b) { return make_int2(clamp(v.x, a, b), clamp(v.y, a, b)); } inline __device__ __host__ int2 clamp(int2 v, int2 a, int2 b) { return make_int2(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y)); } inline __device__ __host__ int3 clamp(int3 v, int a, int b) { return make_int3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b)); } inline __device__ __host__ int3 clamp(int3 v, int3 a, int3 b) { return make_int3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z)); } inline __device__ __host__ int4 clamp(int4 v, int a, int b) { return make_int4(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b), clamp(v.w, a, b)); } inline __device__ __host__ int4 clamp(int4 v, int4 a, int4 b) { return make_int4(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z), clamp(v.w, a.w, b.w)); } inline __device__ __host__ uint2 clamp(uint2 v, uint a, uint b) { return make_uint2(clamp(v.x, a, b), clamp(v.y, a, b)); } inline __device__ __host__ uint2 clamp(uint2 v, uint2 a, uint2 b) { return make_uint2(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y)); } inline __device__ __host__ uint3 clamp(uint3 v, uint a, uint b) { return make_uint3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b)); } inline __device__ __host__ uint3 clamp(uint3 v, uint3 a, uint3 b) { return make_uint3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z)); } inline __device__ __host__ uint4 clamp(uint4 v, uint a, uint b) { return make_uint4(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b), clamp(v.w, a, b)); } inline __device__ __host__ uint4 clamp(uint4 v, uint4 a, uint4 b) { return make_uint4(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z), clamp(v.w, a.w, b.w)); } //////////////////////////////////////////////////////////////////////////////// // dot product //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float dot(float2 a, float2 b) { return a.x * b.x + a.y * b.y; } inline __host__ __device__ float dot(float3 a, float3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; } inline __host__ __device__ float dot(float4 a, float4 b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; } inline __host__ __device__ int dot(int2 a, int2 b) { return a.x * b.x + a.y * b.y; } inline __host__ __device__ int dot(int3 a, int3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; } inline __host__ __device__ int dot(int4 a, int4 b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; } inline __host__ __device__ uint dot(uint2 a, uint2 b) { return a.x * b.x + a.y * b.y; } inline __host__ __device__ uint dot(uint3 a, uint3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; } inline __host__ __device__ uint dot(uint4 a, uint4 b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; } //////////////////////////////////////////////////////////////////////////////// // length //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float length(float2 v) { return sqrtf(dot(v, v)); } inline __host__ __device__ float length(float3 v) { return sqrtf(dot(v, v)); } inline __host__ __device__ float length(float4 v) { return sqrtf(dot(v, v)); } //////////////////////////////////////////////////////////////////////////////// // normalize //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 normalize(float2 v) { float invLen = rsqrtf(dot(v, v)); return v * invLen; } inline __host__ __device__ float3 normalize(float3 v) { float invLen = rsqrtf(dot(v, v)); return v * invLen; } inline __host__ __device__ float4 normalize(float4 v) { float invLen = rsqrtf(dot(v, v)); return v * invLen; } //////////////////////////////////////////////////////////////////////////////// // floor //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 floorf(float2 v) { return make_float2(floorf(v.x), floorf(v.y)); } inline __host__ __device__ float3 floorf(float3 v) { return make_float3(floorf(v.x), floorf(v.y), floorf(v.z)); } inline __host__ __device__ float4 floorf(float4 v) { return make_float4(floorf(v.x), floorf(v.y), floorf(v.z), floorf(v.w)); } //////////////////////////////////////////////////////////////////////////////// // frac - returns the fractional portion of a scalar or each vector component //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float fracf(float v) { return v - floorf(v); } inline __host__ __device__ float2 fracf(float2 v) { return make_float2(fracf(v.x), fracf(v.y)); } inline __host__ __device__ float3 fracf(float3 v) { return make_float3(fracf(v.x), fracf(v.y), fracf(v.z)); } inline __host__ __device__ float4 fracf(float4 v) { return make_float4(fracf(v.x), fracf(v.y), fracf(v.z), fracf(v.w)); } //////////////////////////////////////////////////////////////////////////////// // fmod //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 fmodf(float2 a, float2 b) { return make_float2(fmodf(a.x, b.x), fmodf(a.y, b.y)); } inline __host__ __device__ float3 fmodf(float3 a, float3 b) { return make_float3(fmodf(a.x, b.x), fmodf(a.y, b.y), fmodf(a.z, b.z)); } inline __host__ __device__ float4 fmodf(float4 a, float4 b) { return make_float4(fmodf(a.x, b.x), fmodf(a.y, b.y), fmodf(a.z, b.z), fmodf(a.w, b.w)); } //////////////////////////////////////////////////////////////////////////////// // absolute value //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float2 fabs(float2 v) { return make_float2(fabs(v.x), fabs(v.y)); } inline __host__ __device__ float3 fabs(float3 v) { return make_float3(fabs(v.x), fabs(v.y), fabs(v.z)); } inline __host__ __device__ float4 fabs(float4 v) { return make_float4(fabs(v.x), fabs(v.y), fabs(v.z), fabs(v.w)); } inline __host__ __device__ int2 abs(int2 v) { return make_int2(abs(v.x), abs(v.y)); } inline __host__ __device__ int3 abs(int3 v) { return make_int3(abs(v.x), abs(v.y), abs(v.z)); } inline __host__ __device__ int4 abs(int4 v) { return make_int4(abs(v.x), abs(v.y), abs(v.z), abs(v.w)); } //////////////////////////////////////////////////////////////////////////////// // reflect // - returns reflection of incident ray I around surface normal N // - N should be normalized, reflected vector's length is equal to length of I //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float3 reflect(float3 i, float3 n) { return i - 2.0f * n * dot(n,i); } //////////////////////////////////////////////////////////////////////////////// // cross product //////////////////////////////////////////////////////////////////////////////// inline __host__ __device__ float3 cross(float3 a, float3 b) { return make_float3(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); } //////////////////////////////////////////////////////////////////////////////// // smoothstep // - returns 0 if x < a // - returns 1 if x > b // - otherwise returns smooth interpolation between 0 and 1 based on x //////////////////////////////////////////////////////////////////////////////// inline __device__ __host__ float smoothstep(float a, float b, float x) { float y = clamp((x - a) / (b - a), 0.0f, 1.0f); return (y*y*(3.0f - (2.0f*y))); } inline __device__ __host__ float2 smoothstep(float2 a, float2 b, float2 x) { float2 y = clamp((x - a) / (b - a), 0.0f, 1.0f); return (y*y*(make_float2(3.0f) - (make_float2(2.0f)*y))); } inline __device__ __host__ float3 smoothstep(float3 a, float3 b, float3 x) { float3 y = clamp((x - a) / (b - a), 0.0f, 1.0f); return (y*y*(make_float3(3.0f) - (make_float3(2.0f)*y))); } inline __device__ __host__ float4 smoothstep(float4 a, float4 b, float4 x) { float4 y = clamp((x - a) / (b - a), 0.0f, 1.0f); return (y*y*(make_float4(3.0f) - (make_float4(2.0f)*y))); } #endif ================================================ FILE: docs/README.md ================================================ # ScoreDraft ## Introduction [Introduction in English](intro_eng.md) [中文使用说明](intro_cn.md) ## Meteor Demos ### English * [TikTok](meteor/tiktok) * [MyLove](meteor/MyLove) * [SoreFeetSong](meteor/SoreFeetSong) ### Japanese * [おうちに帰りたい](meteor/ouchi) ### Chinese * [无涯](meteor/WuYa) * [踏浪](meteor/TaLang) ================================================ FILE: docs/_config.yml ================================================ theme: jekyll-theme-hacker ================================================ FILE: docs/intro_cn.html_files/github-markdown.css ================================================ @font-face { font-family: octicons-link; src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); } .markdown-body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color: #333; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; line-height: 1.6; word-wrap: break-word; } .markdown-body a { background-color: transparent; } .markdown-body a:active, .markdown-body a:hover { outline: 0; } .markdown-body strong { font-weight: bold; } .markdown-body h1 { font-size: 2em; margin: 0.67em 0; } .markdown-body img { border: 0; } .markdown-body hr { box-sizing: content-box; height: 0; } .markdown-body pre { overflow: auto; } .markdown-body code, .markdown-body kbd, .markdown-body pre { font-family: monospace, monospace; font-size: 1em; } .markdown-body input { color: inherit; font: inherit; margin: 0; } .markdown-body html input[disabled] { cursor: default; } .markdown-body input { line-height: normal; } .markdown-body input[type="checkbox"] { box-sizing: border-box; padding: 0; } .markdown-body table { border-collapse: collapse; border-spacing: 0; } .markdown-body td, .markdown-body th { padding: 0; } .markdown-body * { box-sizing: border-box; } .markdown-body input { font: 13px / 1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } .markdown-body a { color: #4078c0; text-decoration: none; } .markdown-body a:hover, .markdown-body a:active { text-decoration: underline; } .markdown-body hr { height: 0; margin: 15px 0; overflow: hidden; background: transparent; border: 0; border-bottom: 1px solid #ddd; } .markdown-body hr:before { display: table; content: ""; } .markdown-body hr:after { display: table; clear: both; content: ""; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 15px; margin-bottom: 15px; line-height: 1.1; } .markdown-body h1 { font-size: 30px; } .markdown-body h2 { font-size: 21px; } .markdown-body h3 { font-size: 16px; } .markdown-body h4 { font-size: 14px; } .markdown-body h5 { font-size: 12px; } .markdown-body h6 { font-size: 11px; } .markdown-body blockquote { margin: 0; } .markdown-body ul, .markdown-body ol { padding: 0; margin-top: 0; margin-bottom: 0; } .markdown-body ol ol, .markdown-body ul ol { list-style-type: lower-roman; } .markdown-body ul ul ol, .markdown-body ul ol ol, .markdown-body ol ul ol, .markdown-body ol ol ol { list-style-type: lower-alpha; } .markdown-body dd { margin-left: 0; } .markdown-body code { font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; } .markdown-body pre { margin-top: 0; margin-bottom: 0; font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; } .markdown-body .select::-ms-expand { opacity: 0; } .markdown-body .octicon { font: normal normal normal 16px/1 octicons-link; display: inline-block; text-decoration: none; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .markdown-body .octicon-link:before { content: '\f05c'; } .markdown-body:before { display: table; content: ""; } .markdown-body:after { display: table; clear: both; content: ""; } .markdown-body>*:first-child { margin-top: 0 !important; } .markdown-body>*:last-child { margin-bottom: 0 !important; } .markdown-body a:not([href]) { color: inherit; text-decoration: none; } .markdown-body .anchor { display: inline-block; padding-right: 2px; margin-left: -18px; } .markdown-body .anchor:focus { outline: none; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 1em; margin-bottom: 16px; font-weight: bold; line-height: 1.4; } .markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { color: #000; vertical-align: middle; visibility: hidden; } .markdown-body h1:hover .anchor, .markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor, .markdown-body h4:hover .anchor, .markdown-body h5:hover .anchor, .markdown-body h6:hover .anchor { text-decoration: none; } .markdown-body h1:hover .anchor .octicon-link, .markdown-body h2:hover .anchor .octicon-link, .markdown-body h3:hover .anchor .octicon-link, .markdown-body h4:hover .anchor .octicon-link, .markdown-body h5:hover .anchor .octicon-link, .markdown-body h6:hover .anchor .octicon-link { visibility: visible; } .markdown-body h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom: 1px solid #eee; } .markdown-body h1 .anchor { line-height: 1; } .markdown-body h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom: 1px solid #eee; } .markdown-body h2 .anchor { line-height: 1; } .markdown-body h3 { font-size: 1.5em; line-height: 1.43; } .markdown-body h3 .anchor { line-height: 1.2; } .markdown-body h4 { font-size: 1.25em; } .markdown-body h4 .anchor { line-height: 1.2; } .markdown-body h5 { font-size: 1em; } .markdown-body h5 .anchor { line-height: 1.1; } .markdown-body h6 { font-size: 1em; color: #777; } .markdown-body h6 .anchor { line-height: 1.1; } .markdown-body p, .markdown-body blockquote, .markdown-body ul, .markdown-body ol, .markdown-body dl, .markdown-body table, .markdown-body pre { margin-top: 0; margin-bottom: 16px; } .markdown-body hr { height: 4px; padding: 0; margin: 16px 0; background-color: #e7e7e7; border: 0 none; } .markdown-body ul, .markdown-body ol { padding-left: 2em; } .markdown-body ul ul, .markdown-body ul ol, .markdown-body ol ol, .markdown-body ol ul { margin-top: 0; margin-bottom: 0; } .markdown-body li>p { margin-top: 16px; } .markdown-body dl { padding: 0; } .markdown-body dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: bold; } .markdown-body dl dd { padding: 0 16px; margin-bottom: 16px; } .markdown-body blockquote { padding: 0 15px; color: #777; border-left: 4px solid #ddd; } .markdown-body blockquote>:first-child { margin-top: 0; } .markdown-body blockquote>:last-child { margin-bottom: 0; } .markdown-body table { display: block; width: 100%; overflow: auto; word-break: normal; word-break: keep-all; } .markdown-body table th { font-weight: bold; } .markdown-body table th, .markdown-body table td { padding: 6px 13px; border: 1px solid #ddd; } .markdown-body table tr { background-color: #fff; border-top: 1px solid #ccc; } .markdown-body table tr:nth-child(2n) { background-color: #f8f8f8; } .markdown-body img { max-width: 100%; box-sizing: content-box; background-color: #fff; } .markdown-body code { padding: 0; padding-top: 0.2em; padding-bottom: 0.2em; margin: 0; font-size: 85%; background-color: rgba(0,0,0,0.04); border-radius: 3px; } .markdown-body code:before, .markdown-body code:after { letter-spacing: -0.2em; content: "\00a0"; } .markdown-body pre>code { padding: 0; margin: 0; font-size: 100%; word-break: normal; white-space: pre; background: transparent; border: 0; } .markdown-body .highlight { margin-bottom: 16px; } .markdown-body .highlight pre, .markdown-body pre { padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: #f7f7f7; border-radius: 3px; } .markdown-body .highlight pre { margin-bottom: 0; word-break: normal; } .markdown-body pre { word-wrap: normal; } .markdown-body pre code { display: inline; max-width: initial; padding: 0; margin: 0; overflow: initial; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } .markdown-body pre code:before, .markdown-body pre code:after { content: normal; } .markdown-body kbd { display: inline-block; padding: 3px 5px; font-size: 11px; line-height: 10px; color: #555; vertical-align: middle; background-color: #fcfcfc; border: solid 1px #ccc; border-bottom-color: #bbb; border-radius: 3px; box-shadow: inset 0 -1px 0 #bbb; } .markdown-body .pl-c { color: #969896; } .markdown-body .pl-c1, .markdown-body .pl-s .pl-v { color: #0086b3; } .markdown-body .pl-e, .markdown-body .pl-en { color: #795da3; } .markdown-body .pl-s .pl-s1, .markdown-body .pl-smi { color: #333; } .markdown-body .pl-ent { color: #63a35c; } .markdown-body .pl-k { color: #a71d5d; } .markdown-body .pl-pds, .markdown-body .pl-s, .markdown-body .pl-s .pl-pse .pl-s1, .markdown-body .pl-sr, .markdown-body .pl-sr .pl-cce, .markdown-body .pl-sr .pl-sra, .markdown-body .pl-sr .pl-sre { color: #183691; } .markdown-body .pl-v { color: #ed6a43; } .markdown-body .pl-id { color: #b52a1d; } .markdown-body .pl-ii { background-color: #b52a1d; color: #f8f8f8; } .markdown-body .pl-sr .pl-cce { color: #63a35c; font-weight: bold; } .markdown-body .pl-ml { color: #693a17; } .markdown-body .pl-mh, .markdown-body .pl-mh .pl-en, .markdown-body .pl-ms { color: #1d3e81; font-weight: bold; } .markdown-body .pl-mq { color: #008080; } .markdown-body .pl-mi { color: #333; font-style: italic; } .markdown-body .pl-mb { color: #333; font-weight: bold; } .markdown-body .pl-md { background-color: #ffecec; color: #bd2c00; } .markdown-body .pl-mi1 { background-color: #eaffea; color: #55a532; } .markdown-body .pl-mdr { color: #795da3; font-weight: bold; } .markdown-body .pl-mo { color: #1d3e81; } .markdown-body kbd { display: inline-block; padding: 3px 5px; font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; line-height: 10px; color: #555; vertical-align: middle; background-color: #fcfcfc; border: solid 1px #ccc; border-bottom-color: #bbb; border-radius: 3px; box-shadow: inset 0 -1px 0 #bbb; } .markdown-body .task-list-item { list-style-type: none; } .markdown-body .task-list-item+.task-list-item { margin-top: 3px; } .markdown-body .task-list-item input { margin: 0 0.35em 0.25em -1.6em; vertical-align: middle; } .markdown-body :checked+.radio-label { z-index: 1; position: relative; border-color: #4078c0; } ================================================ FILE: docs/intro_cn.md ================================================ # ScoreDraft 使用说明 ScoreDraft 源代码位于 [GitHub](https://github.com/fynv/ScoreDraft),那里你总是可以找到我最新提交的修改。 可通过以下命令下载 PyPi 包,支持64位 Windows 和 Linux. ``` pip install scoredraft ``` 此处文档将介绍ScoreDraft各个基本元素的使用。 ## HelloWorld (使用TrackBuffer) 我们就由一个最简单的例子入手来介绍ScoreDraft 的基本使用和设计思想。 ```python import ScoreDraft from ScoreDraft.Notes import * seq=[do(),do(),so(),so(),la(),la(),so(5,96)] buf=ScoreDraft.TrackBuffer() ScoreDraft.KarplusStrongInstrument().play(buf, seq) ScoreDraft.WriteTrackBufferToWav(buf,'twinkle.wav') ```

Play命令

```python ScoreDraft.KarplusStrongInstrument().play(buf, seq) ``` ScoreDraft最重要的接口设计,是一类我们后面称为Play命令的语句,它的基本形式是 ```python instrument.play(buf,seq) ``` 其中,instrument是乐器,buf是音轨缓存,seq是序列。整句话代表用乐器instrument演奏序列seq,结果写入buf。 与此类似的,还可以用打击乐组来演奏,或用(虚拟)歌手来演唱,这些语句都具有与这里类似的形式,统称为Play命令。 Play命令还可以传入速率(tempo)、参考频率(refFreq)等信息,它们有默认值,因此可以省略。 ### 导入 ```python import ScoreDraft from ScoreDraft.Notes import * ``` 使用ScoreDraft必须首先导入ScoreDraft包,该包定义了ScoreDraft的核心Python 接口。 多数应用也会包含ScoreDraft.Notes 模块中的音符定义。这里要注意一个事实,那就是,音符定义并不是ScoreDraft核心接口的一部分。对于音符的音高,核心接口直接接受的是物理频率。具体来说,在每一个Play命令中,我们可以传入一个以Hz为单位的参考频率,此处记为f_ref,然后对每一个音符,我们指定一个无量纲的相对频率f_rel[i],此时音符的物理频率可由以下公式计算得到: ``` f_note[i] = f_ref *f_rel[i]. ``` ScoreDraft.Notes给出了一系列“音符”函数(do(), re(), mi()...)的定义,帮助我们把音乐语言转换为物理量。这些函数都十分简单,这使得用户可根据自己的需要在必要的时候对其进行修改和扩展,比如,当你需要一个不同于十二平均律的律制的时候。 ### 乐谱的表示 ```python seq=[do(),do(),so(),so(),la(),la(),so(5,96)] ``` 乐谱本体在ScoreDraft中表示为一组Python列表,称为“序列”。后面的章节会详细介绍这些序列的组成规则。尽管序列的各个元素是按顺序依次处理的,由这些元素产生的声音却有可能彼此重合,这是通过在序列中包含退格操作来实现的。 因为序列的本质是Python列表,原则上我们可以使用Python提供的任何功能来辅助我们编写音乐的过程。这方面的技巧可能需要另外的文档来专门介绍。 ### 音轨缓存(TrackBuffer) ```python buf=ScoreDraft.TrackBuffer() ``` ScoreDraft 用音轨缓存来储存波形数据,不论是音乐合成的中间结果还是最终的混音结果都储存在音轨缓存当中。 在ScoreDraft包中定义有TrackBuffer类,它是对C++接口的直接封装,相对于后面要介绍的Document类,TrackBuffer类是较为底层的操作接口。 ## HelloWorld (使用Document) ```python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.Document() seq=[do(),do(),so(),so(),la(),la(),so(5,96)] doc.playNoteSeq(seq, ScoreDraft.KarplusStrongInstrument()) doc.mixDown('twinkle.wav') ``` 多数音乐作品需要复数个音轨缓存(TrackBuffer)。ScoreDraft包中提供了一个Document类,用来统一管理多个音轨缓存,在实际使用中,我们建议使用ScoreDraft.Document类,而不是直接使用音轨缓存对应的ScoreDraft.TrackBuffer类。 如上面的例子所示, 使用Document类代替TrackBuffer类同时伴随着Play命令写法的变化。使用Document的Play命令时隐含了TrackBuffer对象,同时乐器变为参数。可以形式化地写为doc.play(seq,instrument),代替了instrument.play(buf,seq)。 这样做有几个好处。首先,它简化了音轨缓存的创建,Document类会在执行Play命令时帮你隐式地完成这件事。第二,它大大地简化了混音操作,由于音轨全部在Document类内管理,在混音的时候不必手动列举需要混合的各个音轨。第三,可视化插件可以在Document类上做文章来实现多态性。比如在使用Meteor可视化器的时候,最简单的做法就是把ScoreDraft.Document类用Meteor.Document类来替换。 使用Document类时,速率、参考频率等信息也由Document的实例对象统一管理,不再需要通过Play命令的参数来传入。 ## 初始化 Intruments/Percussions/Singers 用户随时可以通过 PrintCatalog.py 来得到一个可以全部乐器/打击 乐/歌手初始化器的列表: ```python # PrintCatalog.py import ScoreDraft ScoreDraft.PrintCatalog() ``` 该脚本的输出类似于如下的效果: ``` { "Engines": [ "KarplusStrongInstrument - Instrument", "InstrumentSampler_Single - Instrument", "InstrumentSampler_Multi - Instrument", "PercussionSampler - Percussion", "SF2Instrument - Instrument", "UtauDraft - Singing" ], "Instruments": [ "Ah - InstrumentSampler_Single", "Cello - InstrumentSampler_Single", "CleanGuitar - InstrumentSampler_Single", "Lah - InstrumentSampler_Single", "String - InstrumentSampler_Single", "Violin - InstrumentSampler_Single", "Arachno - SF2Instrument", "SynthFontViena - SF2Instrument" ], "Percussions": [ "BassDrum - PercussionSampler", "ClosedHitHat - PercussionSampler", "Snare - PercussionSampler", ], "Singers": [ "Ayaka_UTAU - UtauDraft", "GePing_UTAU - UtauDraft", "jklex_UTAU - UtauDraft", "uta_UTAU - UtauDraft", ] } ``` 第一个列表"Engines"列出的是各个可用的引擎以及它们的类型(乐器/打击乐/歌手)。 后续的三个列表分别给出可以立即使用的乐器/打击乐/歌手初始化器和它们所基于的引擎。ScoreDraft在启动时,根据脚本运行的位置搜索特定的几个目录来建立乐器采样、音源库的索引,并自动创建上面这些初始化器。这些初始化器的声明是动态代码块,在代码中是找不到的,但是使用却很方便,例如,您可以通过下面的代码来初始化一个大提琴乐器: ```python Cello1 = ScoreDraft.Cello() ``` ### 乐器采样器 乐器采样器引擎使用1个或多个wav文件作为样本来构造乐器。wav文件必须是1个或2个通道的16bit PCM格式。乐器采样器的算法是通过对样本的简单拉伸来改变音高的。因此使用的音频样本应具有足够的长度。 #### 单采样 用户可以使用ScoreDraft.InstrumentSampler_Single类来直接创建一个乐器,在创建时需要给出wav文件的路径,该路径或是绝对路径,或是相对于启动目录: ```python flute = ScoreDraft.InstrumentSampler_Single('c:/samples/flute.wav') ``` 你也可以把wav文件布署到启动位置下的 InstrumentSamples 目录中,这样ScoreDraft 就可以自动为你创建一个初始化器。去掉扩展名的文件名将作为初始化器的名字出现在 PrintCatalog 列表当中。 #### 多采样 用户可以使用 ScoreDraft.InstrumentSampler_Multi 类来直接创建一个乐器,在创建的时候需要给出一个包含全部用到的wav文件的目录路径。这些音频样本应覆盖一定的音高范围。 采样器将通过在这些音高之间基于目标音高来插值得到最终的合成结果。 你也可以在 InstrumentSamples 目录下建立一个子目录来布署这些wav文件。,这样ScoreDraft 就可以自动为你创建一个初始化器。新建的子目录名将作为初始化器的名字出现在PrintCatalog列表当中。 ### SoundFont2 乐器 ScoreDraft 包含一个 SoundFont2 引擎。你可以通过 ScoreDraft.SF2Instrument 类来加载SoundFont音源。在使用 ScoreDraft.SF2Instrument 类创建一个乐器时,用户需要给出.sf2文件的路径,以及想要使用的preset的编号。 ```python piano = ScoreDraft.SF2Instrument('florestan-subset.sf2', 0) ``` 函数ScoreDraft.ListPresetsSF2()可以用来得到一个.sf2文件中全部preset的列表: ```python ScoreDraft.ListPresetsSF2('florestan-subset.sf2') ``` 你也可以把.sf2文件布署到启动位置下的 SF2 目录中,这样ScoreDraft 就可以自动为你创建一个初始化器。去掉扩展名的文件名将作为初始化器的名字出现在 PrintCatalog 列表当中。因为我们还需要知道使用哪个preset, 在使用这个初始化器的时候依然需要一个preset_index参数。 SoundFont2 的支持来自于对 [TinySoundFont](https://github.com/schellingb/TinySoundFont)项目的移植,在此对作者Bernhard Schelling 表示感谢! ### 打击乐采样器 打击乐采样器引擎使用1个wav文件来构造打击乐器,wav文件必须是1个或2个通道的16bit PCM格式。打击乐采样器在使用样本时不做任何修改,直接添加包络。因此使用的音频样本应具有足够的长度。 用户可以使用 ScoreDraft.PercussionSampler 类来直接创建一个打击乐器,在创建时需要给出wav文件的路径: ```python drum = ScoreDraft.PercussionSampler('./Drum.wav') ``` 你也可以把wav文件布署到启动位置下的 PercussionSamples 目录中,这样ScoreDraft 就可以自动为你创建一个初始化器。去掉扩展名的文件名将作为初始化器的名字出现在PrintCatalog列表当中。 ### UtauDraft 引擎 UtauDraft 引擎使用一个UTAU的音源目录来生成歌手。 用户可以通过ScoreDraft.UtauDraft类来直接创建歌手,创建的时候需要给出UTAU音源的路径,同时可以给出一个bool值指定是否使用CUDA加速,该值默认为真,系统会在CUDA可以使用的情况下自动使用CUDA加速。如果需要禁用CUDA加速,则需传入一个"False": ```python cz = ScoreDraft.UtauDraft('d:/CZloid', False) ``` 你也可以把音源目录布署到启动位置下的 UTAUVoice 目录中,这样ScoreDraft 就可以自动为你创建一个初始化器。音源目录名将作为初始化器的名字出现在PrintCatalog列表当中。如果音源目录原来的名字不适合用作Python的变量名,那么用户应对目录名进行必要的修改以避免发生Python解析错误。 UtauDraft 引擎试图尽可能支持UTAU的各种音源,包括单独音,连续音,VCV, CVVC等。引擎会读取音源的oto.ini和.frq来提取音源的特征。如果有prefix.map,引擎也会读取这个文件来进行样本音高的选择。 当使用 UtauDraft 引擎时,歌唱片段中使用的歌词应以oto.ini中的定义为准,正如在UTAU中那样。使用单独音音源时,我们只需要直接使用这些歌词。 当使用VCV或CVVC等类型的音源时,为了正确处理音节之间的过渡,同时简化歌词输入,用户需要选择一个拆音函数来使用。ScoreDraft目前提供了以下的拆音函数: * ScoreDraft.CVVCChineseConverter: for CVVChinese * ScoreDraft.XiaYYConverter: for XiaYuYao style Chinese * ScoreDraft.JPVCVConverter: for Japanese 連続音 * ScoreDraft.TsuroVCVConverter: for Tsuro style Chinese VCV * ScoreDraft.TTEnglishConverter: for Delta style (Teto) English CVVC * ScoreDraft.VCCVEnglishConverter: for CZ style VCCV English 拆音函数的使用方法如下所示, 只需调用singer.setLyricConverter(converter)即可: ```python import ScoreDraft Ayaka = ScoreDraft.Ayaka_UTAU() Ayaka.setLyricConverter(ScoreDraft.CVVCChineseConverter) ``` 当使用CZ VCCV音源时,还需要调用一下singer.setCZMode(),让引擎使用特殊的方式来进行映射。 拆音函数应具有以下的形式,如果上面列出的拆音函数无法满足需求,用户可以尝试编写自己的拆音函数: ```python def LyricConverterFunc(LyricForEachSyllable): ... return [(lyric1ForSyllable1, weight11, isVowel11, lyric2ForSyllable1, weight21, isVowel21... ),(lyric1ForSyllable2, weight12, isVowel12, lyric2ForSyllable2, weight22, isVowel22...), ...] ``` 输入参数'LyricForEachSyllable' 是歌唱片段中输入的歌词列表 [lyric1, lyric2, ...], 每个歌词 对应一个音节。拆音函数将每个输入歌词转换为1个或多个歌词,来瓜分原歌词的时值。输出的时候,要给每个 分解后的歌词设置一个权重,以指示分解后的歌词在原歌词的时值中所占的比例。另外还需要提供一个bool值isVowel表示分离出来的这个部分是否包含原音节的元音部分。 ## 乐器演奏 用于乐器演奏的序列称为Note序列,Note序列中的元素是具有(rel_freq, duration) 形式的Python元组, rel_freq是浮点数,duration是整数. 例子: ```python seq=[(1.0, 48), (1.25, 48), (1.5,48)] ``` 使用一个已有的Document对象 "doc"和某个乐器实例, 你可以像下面这样来演奏一个Note序列: ```python doc.playNoteSeq(seq, ScoreDraft.Piano()) ``` 浮点数rel_freq表示一个相对于当前Document参考频率的相对频率, Document的参考频率可以通过doc.setReferenceFreqeuncy()来设置,默认为261.626,单位是Hz. 音长duration使用48代表一拍,在Document中可以通过doc.setTempo()设置速率,默认为80,单位为拍/秒。对于doc.setTempo(),也可以传入一组控制点,见“动态速率映射”部分。 使用ScoreDraftNotes时,音符可以用较为直观的方式表示为: ```python seq=[do(5,48), mi(5,48), so(5,48)] ``` 七个音符函数 (do(),re(),mi(),fa(),so(),la(),ti()) 各自有两个整数参数,八度号octave和时长duration。时长值会直接pass给输出的元组,而相对频率rel_freq则由octave和音符函数本身决定。 octave=5代表中心八度,因此do(5,48)的相对频率为1.0,而do(4,48)的相对频率为0.5。 当rel_feq小于0时,该音符会被解释为一个特殊操作。取决于duration大于0或小于0,大于0时代表一个空拍,小于0时代表一个退格。 ScoreDraftNotes提供了两个函数BL(duration)和BK(duration)来生成这两个音符。退格功能非常有用,它使我们可以把多个音符叠加起来构成和弦,例如,下面是一个大三和弦: ```python seq=[do(5,48), BK(48), mi(5,48), BK(48), so(5,48)] ``` ## 打击乐演奏 对于打击乐演奏,首先您应该考虑选择哪些打击乐器来组成一个打击乐组。 例如,我选择低音鼓和小军鼓: ```python BassDrum=ScoreDraft.BassDrum() Snare=ScoreDraft.Snare() perc_list= [BassDrum, Snare] ``` 用于打击乐演奏的序列称为Beat序列,Note序列中的元素是具有(percussion_index, duration) 形式的Python元组, 两个参数都是整数。percussion_index用来指示前面打击乐组中的某件打击乐器,duration与乐器演奏中的duration是相同概念。 通常,我们会定义几个辅助函数来使Beat序列的编写变得直观: ```python def dong(duration=48): return (0,duration) def ca(duration=48): return (1,duration) ``` 使用上面两个函数,我们就可以用下面的方式来编写Beat序列了: ```python seq = [dong(), ca(24), dong(24), dong(), ca(), dong(), ca(24), dong(24), dong(), ca()] ``` 使用一个已有的Document对象 "doc"和打击乐组, 你可以像下面这样来演奏一个Beat序列: ```python doc.playBeatSeq(seq, perc_list) ``` ## 唱歌 ScoreDraft 提供的唱歌界面与乐器/打击乐演奏界面比较类似。用于唱歌的序列称为Singing序列,它比Note序列要稍微复杂一些。例如: ```python seq=[('yi',do(),'shan',do(),'yi',so(),'shan',so(),'liang',la(),'jing',la(),'jing',so(5,72)), BL(24) ] seq+=[('man',fa(),'tian',fa(),'dou',mi(),'shi',mi(),'xiao',re(),'xing',re(),'xing',do(5,72)), BL(24) ] ``` 每个“歌唱片段”(由逗号分隔的第一级元组)包含一个或多个作为歌词的字符串。每个歌词后可以跟一个或多个元组,用来定义该歌词对应的音高。这些元组在最简单的情况下可以是和乐器音符相同的 (freq_rel, duration) 的形式。一个元组也可以包含更多的freq_rel/duration对,如(freq_rel1, duration1, freq_rel2, duration2, ...),此时则定义了多个控制点, 控制点和控制点之间音高线性过渡,最后一个控制点之后的区间音高保持水平。元组之间不做音高插值。使用 ScoreDraft.Notes ,你可以把多个乐器音符用“+”连接,来构造一个音高折线,如do(5,24)+so(5,24)+do(5,0),该音高折线有三个控制点,总时值为48。 每个“歌唱片段”内的所有音节(歌词+音符)都应连续演唱,除非遇到空拍 BL() 或倒退 BK(),那时系统将不得不把把一个歌唱片段分解成多个歌唱片段来处理。使用一个已有的Document对象 "doc"和某个歌手,歌唱命令类似下面这样: ```python doc.sing(seq, ScoreDraft.GePing_UTAU()) ``` 分段线性的音高表示可以用来模拟rap。在ScoreDraft.RapChinese模块中提供了一个工具函数CRap(),可以用来帮助生成中文四声的Rap。使用实例如: ```python seq= [ CRap("chu", 2, 36)+CRap("he", 2, 60)+CRap("ri", 4, 48)+CRap("dang", 1, 48)+CRap("wu", 3, 48), BL(24)] ``` ## 动态速率映射 ``` tempo_map=[(beat_position_1, dest_position_1), (beat_position_2, dest_position_2), ...] ``` 用它来取代play()命令中的整数tempo, 可以将生成的音频精确地对齐到时间轴上。 以上,beat_position_i 为整数,代表被演奏序列中的一个位置,它的单位和duration相同,48代表一拍。 dest_position_i 为浮点数,代表生成音频的时间点,单位是毫秒。注意这里采用的是时间轴上的绝对位置。 当tempo_map中存在beat_position_1=0时,生成的音频的起始点会自动对齐到dest_position_1。 当tempo_map中不存在beat_position_1=0时,生成的音频的起始点以音轨缓存当前的光标位置为准。 对于 beat_position_i, 通常我们建议使用ScoreDraft.TellDuration(seq),通过测量序列的长度,方便地得到 beat_position_i 的值。 对于 dest_position_i ,通常需要手动测量待对齐的音频(或视频)内容来得到。 例子: ```python seq=[do(),do(),so(),so(),la(),la(),so(5,96)] buf = ScoreDraft.TrackBuffer() piano = ScoreDraft.Piano() tempo_map = [ (0, 1000.0), (ScoreDraft.TellDuration(seq), 5000.0) ] piano.play(buf, seq, tempo_map) ``` 以上代码在生成音频时,会把音频的起点和终点精确对齐到1s和5s处。 ## 回放和可视化 ScoreDraft 目前提供两个播放器/可视化模块。 ### PCMPlayer ScoreDraft.PCMPlayer 可以用来播放一个之前生成的TrackBuffer对象buf,可以显示窗口也可以不显示窗口。 无窗口模式: ```python player = ScoreDraft.PCMPlayer() player.play_track(buf) ``` 这里play_track()是异步调用,这意味着这个函数在启动音频播放之后会立刻返回Python代码执行。 此时你可以继续提交新的播放。所有提交的音轨会组成队列依次播放。 有窗口模式: ```python player = ScoreDraft.PCMPlayer(ui = True) player.play_track(buf) player.main_loop() ``` ui=True时必须要调用main_loop()来实现窗口交互响应,但是这样一来成了同步调用了。如果需要异步调用的话,则应使用ScoreDraft.AsyncUIPCMPlayer: ```python player = ScoreDraft.AsyncUIPCMPlayer() player.play_track(buf) ``` 或者更简单地: ```python ScoreDraft.PlayTrackBuffer(buf) ``` PCMPlayer 支持两种可视化模式,按“W”显示波形,按“S”显示频谱。 ### Meteor Meteor 可以用来可视化前面介绍过的各种序列,同时播放混合好的音轨。使用Meteor最简单的方法是用ScoreDraft.MeteorDocument代替ScoreDraft.Document来使用,该类包含ScoreDraft.Document中的所有接口,外加一个额外的方法 MeteorDocument.meteor(chn=-1). 如果你在旧的项目中使用ScoreDraft.Document,你只需要用ScoreDraft.MeteorDocument来替换它,然后在代码最后调用doc.meteor() 可视化器将会被激活。与 PlayTrackBuffer()不同,doc.meteor()是同步调用,代码会暂停执行,直到播放结束。 ## MusicXML 和 LilyPond 支持 ScoreDraft 通过 class MusicXMLDocument 支持MusicXML和LilyPond格式的输入。可以由一个MusicXML文件或LilyPond文件创建该对象。MusicXML: ```python doc = ScoreDraft.from_music_xml('xyz.xml') ``` LilyPond: ```python doc = ScoreDraft.from_lilypond('xyz.ly') ``` 方法 playXML() 用于将音符播放到音轨当中: ```python instruments = [ScoreDraft.Piano()] doc.playXML(instruments) ``` 每个乐器对应于一个音轨(一行音符),当乐器数比音轨数少时,最后一个乐器会被使用多次。 MusicXMLDocument 对象可以像其他文档对象一样使用,默认支持meteor. ## 基于 YAML 格式的输入 我们可以看出,使用 LilyPond 进行输入,相比于用 Python 录入序列要更为简洁、容易。但是,LilyPond 的语法非常复杂,解析起来并不容易。前面的例子中,ScoreDraft 在内部使用了 python_ly 库,把 ly 转换成 MusicXML,再读取 MusicXML 进行合成。这个转换过程并不是很可靠,遇到复杂的 ly 文件会出问题。此外,还有一些对于合成过程有用的信息,是无法包含在 LilyPond 和 MusicXML 文件当中的,导致我们还需要在Python代码中对引擎进行一些额外的设置。 显然,我们可以在“人类可读性”和“机器可读性”中间寻求某种折中。这里提出一种方案,使用 YAML 作为外层结构描述,并内嵌 LilyPond 代码片段来输入音符。这样折中之后,我们就可以把音乐合成所需的全部信息放入到一个YAML文件中。 ```yaml # exmaple 1 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 ``` score 是最顶层对象,包含全部内容。第二层包括全局设置和 staffs 列表。 每个 staff 定义一行音符,以及如何合成这行音符。instrument 属性告诉 Python 如何初始化用来合成这行音符的乐器。它的值本身是有效的Python代码,ScoreDraft在内部会使用exec() 来执行这个代码。这里 Arachano 是一个 SoundFont2 音色库,我们事先把它部署在 SF2 目录下面。括号内的编号代表音色序号,如40号是小提琴,0号是钢琴。 content 是一个多行字符串,主要包含LilyPond音符。 从版本 1.0.3 开始,加入了一个命令行指令 scoredraft,用来处理 YAML 输入。用法如下: ``` usage: scoredraft [-h] [-ly LY] [-wav WAV] [-meteor METEOR] [-run] yaml positional arguments: yaml input yaml filename optional arguments: -h, --help show this help message and exit -ly LY output lilyond filename -wav WAV output wav filename -meteor METEOR output meteor filename -run run meteor ``` 使用 -ly 参数,可以把YAML文件转成一个正常的 LilyPond 文件,可以进一步完善后发布。除了音符以外的更多信息则将会传递给合成引擎用于合成过程,而这些信息大多不会记录在LilyPond文件中。 ![](workflow.png) 上图显示了 scoredraft 内部的工作流程。从原理上,只要是对合成过程有用的信息我们都可以把它包含到 YAML 文件里。例如,可以用如下方法加入踏板控制信息: ```yaml # exmaple 2 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 pedal: | bd1 bd1 bd1 bd1 bd1 bd1 bd1 bd1 ``` LilyPond 其实是有专门的踏板指令的,但是没有工具可以可靠地把这个信息转换成 MusicXML。因此,在YAML中我们用一个打击乐序列来表示踏板的运动,这里bd本来是用来表示底鼓的,使用其他打击乐也没有问题,毕竟踏板只需要一个开关信息。 在吉他轨中,我们经常希望在和弦音中加入一个微小的延迟,用来模拟扫弦效果。在YAML中我们只要加入一个sweep属性就可以在合成过程中自动模拟这个效果。 ```yaml # exmaple 3 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(24) sweep: 0.1 content: | \clef "bass" c4 e 2 c,4 e 2 c,4 e 2 f,4 a 2 f,4 a 2 g,4 b 2 g,4 b 2 c4 e 2 ``` sweep: 0.1 告诉 ScoreDraft 在和弦音中加入10% 的延迟。 要加入打击乐的话,只需要设置 is_drum: true,然后就可以在 content 里使用打击乐音符了。 ```yaml # exmaple 4 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(24) sweep: 0.1 content: | \clef "bass" c4 e 2 c,4 e 2 c,4 e 2 f,4 a 2 f,4 a 2 g,4 b 2 g,4 b 2 c4 e 2 - is_drum: true instrument: Arachno(128) content: | bd4 hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh ``` 对于鼓轨来说,instrument 必须是一个GM鼓乐器,如我们这里设置的 Arachno(128)。 歌唱合成也可以在YAML中进行编写。 ```yaml # example 5 score: tempo: 150 staffs: - relative: c' is_vocal: true singer: TetoEng_UTAU() converter: TTEnglishConverter content: | r4 g c d e2 e2 r4 e dis e d4 (c) c2 r4 c d e f2 g4 (a) r4 a g f e2. r4 utau: | ju Ar maI s@n SaIn. maI oU nli s@n SaIn. ju meIk mi h{p i. wEn skaIz Ar greI. - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 pedal: | bd1 bd1 bd1 bd1 bd1 bd1 bd1 bd1 - is_drum: true instrument: Arachno(128) content: | bd4 hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh ``` 首先,设置 is_vocal: true。第二,设置一个 singer 属性代替 instrument 属性。在多数情况下,还要设置一个converter属性来设置歌词转换器。如果使用的是CZ式VCCV的话,还需要设置 CZMode: true。第三,添加一个 utau 属性来加入音标。音节之间用空格分隔,每句话结尾加一个点。除了这个句尾点之外,content 代码中的休止符 r 也标志着一句话的结束。每个音节默认对应一个音符,如果需要对应多个音符则需要加入连音线。 ### 属性参考 目前,ScoreDraft 在 YAML 格式中识别的属性并不多,上面基本上都提到了。这里给出一个完整的列表。 #### score 顶层对象 #### tempo 全局属性,定义速率,单位BPM #### title 曲谱标题 #### composer 曲谱作者 #### staffs 音轨表 #### content 音轨属性,包含嵌入的LilyPond代码。原则上可以包含任何 LilyPond 代码。在使用 -ly 命令行参数时,这些代码会被直接输出到 ly 文件中。但是,对于合成器来说,只有一小部分 LilyPond 语法是有意义的。除了基本的音符之外,<> 和弦标记和 ()连音标记会被识别。连音标记对于歌唱合成有用。 #### is_drum 音轨属性,表示当前音轨是否是鼓轨。 #### is_vocal 音轨属性,表示当前音轨是否是歌声。 当 is_drum 和 is_vocal 都没有被设置时,当前轨默认为乐器轨。 #### relative 音轨属性,用于乐器和歌唱轨,表示 content 里的音符是相对模式。 #### instrument 音轨属性,用于乐器和鼓轨,表示乐器信息。 属性值应为用来调用乐器初始化器所需的 Python 代码。 对于鼓轨,该乐器应为GM鼓乐器。 #### pedal 音轨属性,用于乐器轨中控制延音踏板。属性值用打击乐的语法来编写,可以使用任何一种打击乐音符。支持休止符。 #### sweep 音轨属性,用于乐器轨中,为和弦音添加一个延迟来模拟吉他扫弦效果。 #### singer 音轨属性,用于歌唱轨中,表示歌手信息。 属性值应为用来调用歌手初始化器所需的Python代码。 #### converter 音轨属性,用于歌唱轨中,提供歌词转换器信息。 属性值应为该歌词转换器的 Python 变量名。 #### CZMode 音轨属性,用于歌唱轨中,表示当前歌手是否是CZ VCCV模式的。 #### utau 音轨属性,用于歌唱轨中,包含每个音节的 UTAU 音标。音节用空格分隔,句尾加一个点。 #### volume 音轨属性,试用于任何音轨。用于混音器的音量值。 #### pan 音轨属性,试用于任何音轨。用于混音器的偏移值。 ================================================ FILE: docs/intro_eng.md ================================================ # Introduction to ScoreDraft The source-code of ScoreDraft is hosted on [GitHub](https://github.com/fynv/ScoreDraft), where you can always find the latest changes that I have made. PyPi packages for Windows x64 & Linux x64 are available for download by ``` pip install scoredraft ``` This document will introduce the uses of each basic elements of ScoreDraft. ## HelloWorld Example (using TrackBuffer) Let's start from a minimal example to explain the basic usage and design ideas of ScoreDraft. ```python import ScoreDraft from ScoreDraft.Notes import * seq=[do(),do(),so(),so(),la(),la(),so(5,96)] buf=ScoreDraft.TrackBuffer() ScoreDraft.KarplusStrongInstrument().play(buf, seq) ScoreDraft.WriteTrackBufferToWav(buf,'twinkle.wav') ``` ### Play Calls ```python ScoreDraft.KarplusStrongInstrument().play(buf, seq) ``` As the most important interface design of ScoreDraft, "Play Calls" is a class of commands of the form: ```python instrument.play(buf,seq) ``` which simply means, play sequence **seq** with the instrument and write the resulted waveform to "buf". Similarly, you can also use a percussion group to play or use a "singer" to sing. We will use the term **Play Call** to refer to any command of these sorts. We will sometimes pass in tempo and reference frequency parameters into a **Play Call**. There are built-in default values for these parameters so they are not compulsory. ### Imports ```python import ScoreDraft from ScoreDraft.Notes import * ``` The first thing to do is to import "ScoreDraft" package, which provides the core Python interfaces of ScoreDraft. Most application code will also import the note definitions from the "ScoreDraft.Notes" module. In fact, the core interface of ScoreDraft does not include any specific definition of musical notes. It simply accepts a physical frequency **f_ref** in Hz as a reference frequency for each **Play Call**, and a relative frequency **f_rel[i]**, which is just a multiplier, for each note. The physical frequency of each **f_note[i]** can be then calculated by: ``` f_note[i] = f_ref *f_rel[i]. ``` In the note definition module **ScoreDraft.Notes**, a bunch of note functions do(), re(), mi(), fa() are defined to convert musical language to physical numbers. These functions are really simple in nature, thus allowing user to easily modify or extend for special purposes, such as when an alternative tuning (other than 12-equal-temperament) is desirable. ### Score Representation ```python seq=[do(),do(),so(),so(),la(),la(),so(5,96)] ``` The score itself is represented as a set of Python lists, called sequences. How theses sequences are formed will be explained in the succeeding sections. The elements of the sequences are processed consecutively, but generated sound can overlap with each other by containing backspace operations in the sequences. Because the sequences are just Python lists in nature, the full function set of Python can be utilized to automate the score authoring work. Explaining those tricks may require a separate document. ### TrackBuffer ```python buf=ScoreDraft.TrackBuffer() ``` ScoreDraft uses track-buffers to store wave-forms. A track-buffer can be used as either an intermediate storage for synthesis result or the final buffer for the mix-down result of several intermediate buffers. The package ScoreDraft provides a class TrackBuffer, which is a direct encapsulation of the C++ interface. Comparing to the class Document (to be introduced later), class TrackBuffer is a low-level interface. ## HelloWorld Example (using Document) ```python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.Document() seq=[do(),do(),so(),so(),la(),la(),so(5,96)] doc.playNoteSeq(seq, ScoreDraft.KarplusStrongInstrument()) doc.mixDown('twinkle.wav') ``` Most musical pieces need multiple track-buffers. The class ScoreDraft.Document is provided as an unified track-buffer manager, and it is more recommended than using **ScoreDraft.TrackBuffer** directly. As shown in the above example, using class Document is accompanied by some changes in the writing style of the Play Calls. When issuing a **Play Call** through the class Document, the target track-buffer is always implicated, so a parameter is not necessary anymore. At the same time, the instrument used for playing becomes a parameter. The format now looks like doc.play(seq,instrument) instead of instrument.play(buf,seq). There are a few benefits. First, it simplifies the creation of track-buffers, the document object can do that for you implicitly during Play Calls. Second, it largely simplifies the mixdown call. You don't need to enumerate all the track-buffer to be mixed when they are managed insides the document object. Third, visualization component can exploit polymorphism by replacing the Document class with an extended version. For example, the Meteor visualizer can be enabled with minimal effort by replacing **ScoreDraft.Document** with **ScoreDraft.MeteorDocument**. The class Document also manages tempo and reference frequency parameters internally, so we don't pass them through the Play Calls anymore in this case. ## Initialization of Intruments/Percussions/Singers User can always run the PrintCatalog.py to get a list of all available instrument/percussion/singer initializers. ```python # PrintCatalog.py import ScoreDraft ScoreDraft.PrintCatalog() ``` The output will look like: ``` { "Engines": [ "KarplusStrongInstrument - Instrument", "InstrumentSampler_Single - Instrument", "InstrumentSampler_Multi - Instrument", "PercussionSampler - Percussion", "SF2Instrument - Instrument", "UtauDraft - Singing" ], "Instruments": [ "Ah - InstrumentSampler_Single", "Cello - InstrumentSampler_Single", "CleanGuitar - InstrumentSampler_Single", "Lah - InstrumentSampler_Single", "String - InstrumentSampler_Single", "Violin - InstrumentSampler_Single", "Arachno - SF2Instrument", "SynthFontViena - SF2Instrument" ], "Percussions": [ "BassDrum - PercussionSampler", "ClosedHitHat - PercussionSampler", "Snare - PercussionSampler", ], "Singers": [ "Ayaka_UTAU - UtauDraft", "GePing_UTAU - UtauDraft", "jklex_UTAU - UtauDraft", "uta_UTAU - UtauDraft", ] } ``` The first list **Engines** gives a list of names of available engines and the type of engine (is it an instrument or percussion or singing engine?). The 3 succeeding lists gives names of ready-to-use instrument/percussion/singer initializers and the engines they are based on. ScoreDraft creates these initializers automatically at starting time by searching some specific directories for samples/banks based on the starting place of the Python script. The definitions of the initializers are dynamic code blocks, you cannot find them in the source-code. However, using them is simple. For example you can initialize a Cello instrument by: ```python Cello1 = ScoreDraft.Cello() ``` ### Instrument Sampler The instrument sampler engine uses one or multiple wav files as the input to create an instrument. The .wav files must have one or two channels in 16bit PCM format. The algorithm of the instrument sampler is by simply stretching the sample audio and adding a envelope. So be sure that the samples have sufficient lengths. #### Single-sampling You can use the class **ScoreDraft.InstrumentSampler_Single** to create an instrument directly. At creation time, you need to provide a path to the wav file. The path can be either absolute path or relative to the starting folder. ```python flute = ScoreDraft.InstrumentSampler_Single('c:/samples/flute.wav') ``` You can also put the wav files into the **InstrumentSamples** directory under the starting directory so that ScoreDraft can create an initializer for you automatically. The file name without extension will appear as the initializer name in the PrintCatalog lists. #### Multi-sampling You can use the class ScoreDraft.InstrumentSampler_Multi to create an instrument directly. At creation time, you need to provide a path to a folder containing all the wav files of an instrument. The audio samples should span a range of different pitches. The sampler will generate notes by intepolating between the samplers according to the target pitch. ```python guitar = ScoreDraft.InstrumentSampler_Multi('c:/samples/guitar') ``` You can also create a subdirectory under the **InstrumentSamples** directory and put in all the wav files for the instrument. Then ScoreDraft will automatically create an initializer for you using the subdirectory name as the initializer name, which will appear in the PrintCatalog lists. ### SoundFont2 Instruments ScoreDraft contains a SoundFont2 engine. You can use the class **ScoreDraft.SF2Instrument** to load a SoundFont. Just provide the path to the .sf2 file and the index of the preset you want to use: ```python piano = ScoreDraft.SF2Instrument('florestan-subset.sf2', 0) ``` The function ScoreDraft.ListPresetsSF2() can be used to obtain a list of all available presets in a .sf2 file: ```python ScoreDraft.ListPresetsSF2('florestan-subset.sf2') ``` You can also put the .sf2 file into the **SF2** directory under the starting directory so that ScoreDraft will create an initializer for you automatically. The file name without extension will appear as the initializer name in the PrintCatalog lists. Because we need to know which preset to use, a preset_index parameter is still needed when calling the initializer. SoundFont2 support is based on a porting of [TinySoundFont](https://github.com/schellingb/TinySoundFont) Here I acknowledge Bernhard Schelling for the work! ### Percussion Sampler The percussion sampler engine uses one wav file as the input to create a percussion. The .wav files must have one or two channels in 16bit PCM format. The algorithm of the percussion sampler is by simply adding a envelope. So be sure that the samples have sufficient lengths. You can use the class ScoreDraft.PercussionSampler to create a percussion directly. At creation time, you need to provide a path to the wav file. ```python drum = ScoreDraft.PercussionSampler('./Drum.wav') ``` You can also put the wav files into the **PercussionSamples** directory under the starting directory so that ScoreDraft can create an initializer for you automatically. The file name without extension will appear as the initializer name in the PrintCatalog lists. ### UtauDraft Engine The UtauDraft engine uses a UTAU voicebank to create a singer. You can use the class ScoreDraft.UtauDraft directly. At creation time, you need to provide a path to the UTAU voicebank, and optionally a bool value indicating whether to use CUDA acceleration or not. The default is use CUDA acceleration when available. Pass in a **False** to disable it without attempting. ```python cz = ScoreDraft.UtauDraft('d:/CZloid', False) ``` You can also put the voicebank folder into the **UTAUVoice** directory under the starting directory so that ScoreDraft can create an initializer for you automatically. The subdirectory name + "_UTAU" will apprear as the initializer name in the PrintCatalog lists. (The "_UTAU" posfix exists for some historical reason). If the original sub-folder name is unsuitable to be used as an Python variable name, then you should rename it to prevent a Python error. The UtauDraft Enigine tries to be compatible with all kinds of UTAU voice-banks, including 単独音,連続音, VCV, CVVC as much as possible. oto.ini and .frq files will be used to understand the audio samples. prefix.map will also be used when one is present. When using UtauDraft Engine, for 単独音, you can use the names defined in oto.ini as lyrics, just like in UTAU. For other types of voicebanks, in order to tackle transitions correctly as well as simplifying the lyric input, user should choose one of the lyric-converters to use. Currently there are: * ScoreDraft.CVVCChineseConverter: for CVVChinese * ScoreDraft.XiaYYConverter: for XiaYuYao style Chinese * ScoreDraft.JPVCVConverter: for Japanese 連続音 * ScoreDraft.TsuroVCVConverter: for Tsuro style Chinese VCV * ScoreDraft.TTEnglishConverter: for Delta style (Teto) English CVVC * ScoreDraft.VCCVEnglishConverter: for CZ style VCCV English For setting lyric converter just call **singer.setLyricConverter(converter)**, for example: ```python import ScoreDraft Teto = ScoreDraft.TetoEng_UTAU() Teto.setLyricConverter(ScoreDraft.TTEnglishConverter) ``` For CZ style VCCV, you need one more call: singer.setCZMode() to let the engine use a special mapping method. The converter functions are defined in the following form, write your own if the above converters does not meet you requirements: ```python def LyricConverterFunc(LyricForEachSyllable): ... return [(lyric1ForSyllable1, weight11, isVowel11, lyric2ForSyllable1, weight21, isVowel21... ),(lyric1ForSyllable2, weight12, isVowel12, lyric2ForSyllable2, weight22, isVowel22...), ...] ``` The argument 'LyricForEachSyllable' has the form [lyric1, lyric2, ...], where each lyric is a string, which is the input lyric of a syllable. The converter function should convert 1 input lyric into 1 or more lyrics to split the duration of the original syllable. A weight value should be provided to indicate the ratio or duration of the converted note. A bool value "isVowel" need to be provided to indicate whether it contains the vowel part of the syllable. ## Instrument Play The kind of sequence used for instrument play is called note sequence. Note sequences are Python lists consisting of tuples in (rel_freq, duration) form, where "rel_freq" is a float and "duration" an integer. For example: ```python seq=[(1.0, 48), (1.25, 48), (1.5,48)] ``` With an existing document object "doc", you can "play" the sequence using some instrument like following: ```python doc.playNoteSeq(seq, ScoreDraft.Piano()) ``` The float "rel_freq" is a relative frequency relative to the reference frequency stored in the document object, which can be set with doc.setReferenceFreqeuncy(), and defaulted to 261.626(in Hz). The duration of a note is "1 beat" when the integer value "duration" equals 48. The document objects manages a tempo value in beats/minute, which can be set using doc.setTempo(), and defaulted to 80. It is also allowed to feed doc.setTempo() with a series of control points, which builds a **Dynamic Tempo Mapping**, which is to be discussed later. When **ScoreDraft.Notes** is imported, we can write the note sequences in a more musically intuitive way: ```python seq=[do(5,48), mi(5,48), so(5,48)] ``` The note functions have intuitive names (do(),re(),mi(),fa(),so(),la(),ti()), and they take in 2 integer parameters, octave and duration. The return values are tuples. While the duration parameter is directly passed to the duration component of the returned tuple, the rel_freq component of the tuple is decided by the octave value plus the note function itself. The default octave is 5, which means the center octave. For example, the returned rel_freq of "do(5,48)" will be "1.0", and rel_freq of "do(4,48)" will be "0.5". When rel_freq < 0.0, ScoreDraft will treat the note as some special marker, depending on whether duration>0 or duration<0. When duration>0, it means a rest. When duration<0, it means a backspace. **ScoreDraft.Notes** provides 2 functions **BL(duration)** and **BK(duration)** to formalize these uses. Backspaces are very useful, because when cursor moves backwards, the next notes will be possible to overlap with the previous notes, making representation of chords possible. For example, a major triad can be written like: ```python seq=[do(5,48), BK(48), mi(5,48), BK(48), so(5,48)] ``` ## Percussion Play For percussion play, first you should consider what percussions to choose to build a percussion group. For example, I choose BassDrum and Snare: ```python BassDrum=ScoreDraft.BassDrum() Snare=ScoreDraft.Snare() perc_list= [BassDrum, Snare] ``` The kind of sequence used for percussion play is called beat sequence. Beat sequences are consisted of tuples in (percussion_index, duration) form. Both "percussion_index" and "duration" are integers, where "percussion_index" refers to the index in the "perc_list" defined above, and "duration" is the same as instrument play. Often, we want to define some utility functions to make the writing of beat sequences more intuitive: ```python def dong(duration=48): return (0,duration) def ca(duration=48): return (1,duration) ``` Now you can use the above 2 functions to build a beat sequence like: ```python seq = [dong(), ca(24), dong(24), dong(), ca(), dong(), ca(24), dong(24), dong(), ca()] ``` With an existing document object "doc", you can "play" the sequence using "perc_list" like: ```python doc.playBeatSeq(seq, perc_list) ``` ## Singing ScoreDraft provides a singing interface similar to instrument and percussion play. The kind of sequence used for singing is called singing sequence. A singing sequence is a little more complicated than a note sequence. For example: ```python seq = [ ("mA", mi(5,24), "mA", re(5,24), mi(5,48)), BL(24)] seq +=[ ("du",mi(5,24),"ju", so(5,24), "rIm", la(5,24), "Em", mi(5,12),re(5,12), "b3", re(5,72)), BL(24)] ``` Each singing segment contains one or more lyric as a string, each followed by one or more tuples to define the pitch corresponding to the leading lyric. In the simplest case, one of the tuples can be the same form as an instrument note: (freq_rel, duration). The tuple can also contain multiple freq_rel/duration pairs to define multiple control-points, like (freq_rel1, duration1, freq_rel2, duration2, ...). In that case, pitches will be linearly interpolated between control points, and the last control point defines a period of flat pitch. Pitches are not interpolated between tuples. Using **ScoreDraft.Notes** definitions, you can define a piece-wise pitch curve by concatenating multiple instrument notes, like do(5,24)+so(5,24)+do(5,0), which defines a pitch curve of 3 control points and a total duration of 48. All lyrics and notes in the same singing segment are intended to be sung continuously. However, when there are rests/backspaces, the singing-segment will be broken into multiple segments to sing. The singing command looks like following, with an existing "doc" and some singer: ```python # Teto = ScoreDraft.TetoEng_UTAU() # Teto.setLyricConverter(ScoreDraft.TTEnglishConverter) doc.sing(seq, Teto) ``` The piece-wise formed pitch curve can be used to simulate rapping. There is an utility CRap() defined in ScoreDraftRapChinese.py to help to generate the tones of Mandarin Chinese (the 4 tones). An example using CRap(): ```python seq= [ CRap("chu", 2, 36)+CRap("he", 2, 60)+CRap("ri", 4, 48)+CRap("dang", 1, 48)+CRap("wu", 3, 48), BL(24)] ``` ## Dynamic Tempo Mapping Dynamic tempo mapping is used to accurately define the timeline position and tempo of the generated sound. It works by replacing the tempo term of a Play Call with a Python list of the following form: ``` tempo_map=[(beat_position_1, dest_position_1), (beat_position_2, dest_position_2), ...] ``` beat_position_i is a integer that represent a position in the input sequence. It has the same unit as the duration term, where 1 beat is represented by 48. dest_position_i is a floating point that represent a absolute position on the destination timeline, in the unit of milliseconds. When there is beat_position_1=0, the starting point of the generated waveform will be aligned with dest_position_1. When there is not beat_position_1=0, the starting point of the generated waveform is decided by the current cursor position of the destination track buffer. For beat_position_i, it is suggested to calculate it by calling ScoreDraft.TellDuration(seq), which measures the length of the sequence seq. For dest_position_i, we often need to measure the target material (audio/video) that we are aligning to, manually. For example: ```python seq=[do(),do(),so(),so(),la(),la(),so(5,96)] buf = ScoreDraft.TrackBuffer() piano = ScoreDraft.Piano() tempo_map = [ (0, 1000.0), (ScoreDraft.TellDuration(seq), 5000.0) ] piano.play(buf, seq, tempo_map) ``` The about code will generate the sound accurately aligned to the 1s ~ 5s. ## Playback & Visualization ScoreDraft now contains 2 players/visualizers. ### PCMPlayer **ScoreDraft.PCMPlayer** can be used to play a previously generate TrackBuffer object **buf**, with or without a display window. For windowless use: ```python player = ScoreDraft.PCMPlayer() player.play_track(buf) ``` Here **play_track()** is an asynchronized call, which means that it will return immediately to execute the succeeding Python code after the playback is started. You can continue to submit more track-buffers to be played-back. The track-buffers will be queued and played-back consecutively. For visualzied use: ```python player = ScoreDraft.PCMPlayer(ui = True) player.play_track(buf) player.main_loop() ``` **main_loop()** has to be called in order to make the UI interactive. However, that will make it a synchronized call. If an asynchronized behavior is required, you should instead use **ScoreDraft.AsyncUIPCMPlayer**: ```python player = ScoreDraft.AsyncUIPCMPlayer() player.play_track(buf) ``` Or more simply: ```python ScoreDraft.PlayTrackBuffer(buf) ``` PCMPlayer supports 2 visualization modes: * Press 'W' to show waveform * Press 'S' to show spectrum ### Meteor Meteor can be used to visualize all kinds of sequences while playing-back the mixed track. The easiest way to use Meteor is to use ScoreDraft.MeteorDocument instead of ScoreDraft.Document.The definition of ScoreDraft.MeteorDocument contains all interface as the one defined in ScoreDraft.Document, plus an extra method MeteorDocument.meteor(chn=-1). If you are using ScoreDraft.Document in your old project, you just need to use Meteor.Document to replace it, and call doc.meteor() at the end of the code, the visualizer will thus be activated. Unlike PlayTrackBuffer(), doc.meteor() is a synchronized call. The execution will be blocked until the end of play-back. ## MusicXML & LilyPond Support ScoreDraft supports MusicXML & LilyPond through **class MusicXMLDocument**. It can be created from a MusicXML file: ```python doc = ScoreDraft.from_music_xml('xyz.xml') ``` or from a LilyPond file: ```python doc = ScoreDraft.from_lilypond('xyz.ly') ``` To play the notes into the track-buffers, use the **playXML()** method: ```python instruments = [ScoreDraft.Piano()] doc.playXML(instruments) ``` Each instrument is aligned to a track (staff). If there are fewer instruments than tracks, the last instrument will be used multiple times. A **MusicXMLDocument** can be used just like other documents, **Meteor** is supported by default. ## YAML Based Input We can see that the **LilyPond** syntax is more compact and easier to write comparing to writing the sequences directly into Python. However, parsing **LilyPond** is non-trivial. The previous method uses **python_ly** to first convert **ly** to **MusicXML** then reads from the **MusicXML** format. That process doesn't always work well. Moreover, there are cases where information useful to the synthesizer engine cannot be included into **LilyPond** and **MusicXML**, so we still need extra configurations in our Python code. Obviously, a trade-off can be made between human-readability and machine-readability. The solution is to use **YAML** for the outline structure, and **LilyPond** syntax for notes only, so that we are able to include everything we need for the synthesizer into a single **YAML** file. ```yaml # exmaple 1 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 ``` **score** is the top-level object including everything. The second level includes global settings, besides the **staffs**. Each **staff** defines a line of notes and descriptions of how to synthesize it. The **instrument** field tells Python how to initialize the instrument to play the notes. It is literally Python code which is evaluated using **exec()** internally. Here **Arachno** is a soundfont which is deployed inside the SF2 directory. The index tells which preset to use (40 = violin, 0 = piano). Inside the **content** filed, **LilyPond** notes are embedded as a multiline string. Since version 1.0.3, a command-line tool **scoredraft** is provided to process the YAML input. ``` usage: scoredraft [-h] [-ly LY] [-wav WAV] [-meteor METEOR] [-run] yaml positional arguments: yaml input yaml filename optional arguments: -h, --help show this help message and exit -ly LY output lilyond filename -wav WAV output wav filename -meteor METEOR output meteor filename -run run meteor ``` With **scoredraft -ly**, the YAML file can be converted to a regular **LilyPond** file, which can be further improved for publishment. More information besides the notes can be passed to the synthesizer engine, which doesn't necessarily go into the **LilyPond** file. ![](workflow.png) The picture above shows the internal workflow how a YAML file gets processed. The workflow allows arbitrary information (useful to the synthesizer) to be included into the YAML file. For example, we can add pedal movements like: ```yaml # exmaple 2 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 pedal: | bd1 bd1 bd1 bd1 bd1 bd1 bd1 bd1 ``` There is a dedicated syntax in **LilyPond** for pedals. However, there's no tool that can reliably convert that syntax into **MusicXML**. Therefore, instead, we simply define it as a percussion sequence, where **bd** means base-drum. You can use other percussion notes too, there's no difference since a pedal is just a simple trigger. For guitar tracks, we often want to add a little delay to the chord notes to simulate sweeping. This can be configured by adding a "sweep" field: ```yaml # exmaple 3 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(24) sweep: 0.1 content: | \clef "bass" c4 e 2 c,4 e 2 c,4 e 2 f,4 a 2 f,4 a 2 g,4 b 2 g,4 b 2 c4 e 2 ``` **sweep: 0.1** tells ScoreDraft to add a 10% delay to chord notes. To include a percussion track, simply add **is_drum: true** then you can use the percussion notes: ```yaml # exmaple 4 score: tempo: 150 staffs: - relative: c'' instrument: Arachno(40) content: | r4 g c d e2 e2 r4 e dis e d2 c2 r4 c d e f2 a2 r4 a g f e2. r4 - relative: c instrument: Arachno(24) sweep: 0.1 content: | \clef "bass" c4 e 2 c,4 e 2 c,4 e 2 f,4 a 2 f,4 a 2 g,4 b 2 g,4 b 2 c4 e 2 - is_drum: true instrument: Arachno(128) content: | bd4 hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh ``` For percussion tracks, the **instrument** field must be a GM Drum instrument like the one used here. For singing synthesizing, some different configuration fields are needed: ```yaml # example 5 score: tempo: 150 staffs: - relative: c' is_vocal: true singer: TetoEng_UTAU() converter: TTEnglishConverter content: | r4 g c d e2 e2 r4 e dis e d4 (c) c2 r4 c d e f2 g4 (a) r4 a g f e2. r4 utau: | ju Ar maI s@n SaIn. maI oU nli s@n SaIn. ju meIk mi h{p i. wEn skaIz Ar greI. - relative: c instrument: Arachno(0) content: | \clef "bass" c g' g c, g' g c, g' g f c' c f, c' c g d' d g, d' d c, g' 2 pedal: | bd1 bd1 bd1 bd1 bd1 bd1 bd1 bd1 - is_drum: true instrument: Arachno(128) content: | bd4 hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh bd hh sn hh ``` First, set **is_vocal** to **true**. Second, instead of defining a **instrument**, here we need a **singer**. Most of the cases, a **converter** needs to be given to handle syllable connections. If the voicebank is defined in CZMode, simply add **CZMode: true**. Third, add an **utau** field to include the phonetic symbols. Syllables are separated by spaces, with a dot at the end of each sentence. A rest 'r' in the **content** code also marks the end of a sentence. Each syllable is mapped to 1 note by default. Slurs can be used so that multiple notes can be mapped to a syllable. ### Reference Currently, there is only a small set of YAML keys recognized by ScoreDraft, and basically everything has been mentioned above. Here is a exhaustive list of all keys. #### score The top-level object #### tempo Global property defining tempo in BPM. #### title Title of the score. (for LilyPond) #### composer Author of the score. (for LilyPond) #### staffs Entry to the array of staffs. #### content Staff property containing embedded **LilyPond** code. Basically any **LilyPond** code can be put here. For **-ly** output, these code will be put straightly to the **ly** file. However, for the synthesizer, only a small part of **LilyPond** syntax is acknowledged. Besides the notes, **<>** is recognized as a chord, and **()** is recognized as slur. Slurs are useful for singing synthesize. #### is_drum Staff property indicating whether the current staff is a percussion track. #### is_vocal Staff property indicating whether the current staff is a singing track When neither **is_drum** nor **is_vocal** is set, the current staff is a instrumental track. #### relative Staff property for a instrumental/singing track, indicating the **content** is in relative mode. #### instrument Staff property for an instrumental/percussion track, giving instrument information. The value should be literal Python code calling the instrument initializer. For percussion tracks, the instrument should be a GM Drum instrument. #### pedal Staff property for an instrumental track, telling the movement of the sustaining pedal. The value should be written using arbitrary percussion notes. Rests are supported. #### sweep Staff property for an instrumental track, adding a delay to chord notes to simulate a guitar sweeping effect. #### singer Staff property for a singing track, giving singer information. The value should be literal Python code calling the singer initializer. #### converter Staff property for a singing track, giving the Python variable name of the lyric converter required by the singer. #### CZMode Staff property for a singing track, indicating whether the singer is in CZMode. #### utau Staff property for a singing track containing **UTAU** phonetic symbols for each syllable. Syllables are separated by spaces, with a dot at the end of each sentence. #### volume Staff property for any track. Volume value used by the mixer. #### pan Staff property for any track. Pan value used by the mixer. ================================================ FILE: docs/meteor/MyLove.html_files/github-markdown.css ================================================ @font-face { font-family: octicons-link; src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); } .markdown-body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color: #333; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; line-height: 1.6; word-wrap: break-word; } .markdown-body a { background-color: transparent; } .markdown-body a:active, .markdown-body a:hover { outline: 0; } .markdown-body strong { font-weight: bold; } .markdown-body h1 { font-size: 2em; margin: 0.67em 0; } .markdown-body img { border: 0; } .markdown-body hr { box-sizing: content-box; height: 0; } .markdown-body pre { overflow: auto; } .markdown-body code, .markdown-body kbd, .markdown-body pre { font-family: monospace, monospace; font-size: 1em; } .markdown-body input { color: inherit; font: inherit; margin: 0; } .markdown-body html input[disabled] { cursor: default; } .markdown-body input { line-height: normal; } .markdown-body input[type="checkbox"] { box-sizing: border-box; padding: 0; } .markdown-body table { border-collapse: collapse; border-spacing: 0; } .markdown-body td, .markdown-body th { padding: 0; } .markdown-body * { box-sizing: border-box; } .markdown-body input { font: 13px / 1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } .markdown-body a { color: #4078c0; text-decoration: none; } .markdown-body a:hover, .markdown-body a:active { text-decoration: underline; } .markdown-body hr { height: 0; margin: 15px 0; overflow: hidden; background: transparent; border: 0; border-bottom: 1px solid #ddd; } .markdown-body hr:before { display: table; content: ""; } .markdown-body hr:after { display: table; clear: both; content: ""; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 15px; margin-bottom: 15px; line-height: 1.1; } .markdown-body h1 { font-size: 30px; } .markdown-body h2 { font-size: 21px; } .markdown-body h3 { font-size: 16px; } .markdown-body h4 { font-size: 14px; } .markdown-body h5 { font-size: 12px; } .markdown-body h6 { font-size: 11px; } .markdown-body blockquote { margin: 0; } .markdown-body ul, .markdown-body ol { padding: 0; margin-top: 0; margin-bottom: 0; } .markdown-body ol ol, .markdown-body ul ol { list-style-type: lower-roman; } .markdown-body ul ul ol, .markdown-body ul ol ol, .markdown-body ol ul ol, .markdown-body ol ol ol { list-style-type: lower-alpha; } .markdown-body dd { margin-left: 0; } .markdown-body code { font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; } .markdown-body pre { margin-top: 0; margin-bottom: 0; font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; } .markdown-body .select::-ms-expand { opacity: 0; } .markdown-body .octicon { font: normal normal normal 16px/1 octicons-link; display: inline-block; text-decoration: none; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .markdown-body .octicon-link:before { content: '\f05c'; } .markdown-body:before { display: table; content: ""; } .markdown-body:after { display: table; clear: both; content: ""; } .markdown-body>*:first-child { margin-top: 0 !important; } .markdown-body>*:last-child { margin-bottom: 0 !important; } .markdown-body a:not([href]) { color: inherit; text-decoration: none; } .markdown-body .anchor { display: inline-block; padding-right: 2px; margin-left: -18px; } .markdown-body .anchor:focus { outline: none; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 1em; margin-bottom: 16px; font-weight: bold; line-height: 1.4; } .markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { color: #000; vertical-align: middle; visibility: hidden; } .markdown-body h1:hover .anchor, .markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor, .markdown-body h4:hover .anchor, .markdown-body h5:hover .anchor, .markdown-body h6:hover .anchor { text-decoration: none; } .markdown-body h1:hover .anchor .octicon-link, .markdown-body h2:hover .anchor .octicon-link, .markdown-body h3:hover .anchor .octicon-link, .markdown-body h4:hover .anchor .octicon-link, .markdown-body h5:hover .anchor .octicon-link, .markdown-body h6:hover .anchor .octicon-link { visibility: visible; } .markdown-body h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom: 1px solid #eee; } .markdown-body h1 .anchor { line-height: 1; } .markdown-body h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom: 1px solid #eee; } .markdown-body h2 .anchor { line-height: 1; } .markdown-body h3 { font-size: 1.5em; line-height: 1.43; } .markdown-body h3 .anchor { line-height: 1.2; } .markdown-body h4 { font-size: 1.25em; } .markdown-body h4 .anchor { line-height: 1.2; } .markdown-body h5 { font-size: 1em; } .markdown-body h5 .anchor { line-height: 1.1; } .markdown-body h6 { font-size: 1em; color: #777; } .markdown-body h6 .anchor { line-height: 1.1; } .markdown-body p, .markdown-body blockquote, .markdown-body ul, .markdown-body ol, .markdown-body dl, .markdown-body table, .markdown-body pre { margin-top: 0; margin-bottom: 16px; } .markdown-body hr { height: 4px; padding: 0; margin: 16px 0; background-color: #e7e7e7; border: 0 none; } .markdown-body ul, .markdown-body ol { padding-left: 2em; } .markdown-body ul ul, .markdown-body ul ol, .markdown-body ol ol, .markdown-body ol ul { margin-top: 0; margin-bottom: 0; } .markdown-body li>p { margin-top: 16px; } .markdown-body dl { padding: 0; } .markdown-body dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: bold; } .markdown-body dl dd { padding: 0 16px; margin-bottom: 16px; } .markdown-body blockquote { padding: 0 15px; color: #777; border-left: 4px solid #ddd; } .markdown-body blockquote>:first-child { margin-top: 0; } .markdown-body blockquote>:last-child { margin-bottom: 0; } .markdown-body table { display: block; width: 100%; overflow: auto; word-break: normal; word-break: keep-all; } .markdown-body table th { font-weight: bold; } .markdown-body table th, .markdown-body table td { padding: 6px 13px; border: 1px solid #ddd; } .markdown-body table tr { background-color: #fff; border-top: 1px solid #ccc; } .markdown-body table tr:nth-child(2n) { background-color: #f8f8f8; } .markdown-body img { max-width: 100%; box-sizing: content-box; background-color: #fff; } .markdown-body code { padding: 0; padding-top: 0.2em; padding-bottom: 0.2em; margin: 0; font-size: 85%; background-color: rgba(0,0,0,0.04); border-radius: 3px; } .markdown-body code:before, .markdown-body code:after { letter-spacing: -0.2em; content: "\00a0"; } .markdown-body pre>code { padding: 0; margin: 0; font-size: 100%; word-break: normal; white-space: pre; background: transparent; border: 0; } .markdown-body .highlight { margin-bottom: 16px; } .markdown-body .highlight pre, .markdown-body pre { padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: #f7f7f7; border-radius: 3px; } .markdown-body .highlight pre { margin-bottom: 0; word-break: normal; } .markdown-body pre { word-wrap: normal; } .markdown-body pre code { display: inline; max-width: initial; padding: 0; margin: 0; overflow: initial; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } .markdown-body pre code:before, .markdown-body pre code:after { content: normal; } .markdown-body kbd { display: inline-block; padding: 3px 5px; font-size: 11px; line-height: 10px; color: #555; vertical-align: middle; background-color: #fcfcfc; border: solid 1px #ccc; border-bottom-color: #bbb; border-radius: 3px; box-shadow: inset 0 -1px 0 #bbb; } .markdown-body .pl-c { color: #969896; } .markdown-body .pl-c1, .markdown-body .pl-s .pl-v { color: #0086b3; } .markdown-body .pl-e, .markdown-body .pl-en { color: #795da3; } .markdown-body .pl-s .pl-s1, .markdown-body .pl-smi { color: #333; } .markdown-body .pl-ent { color: #63a35c; } .markdown-body .pl-k { color: #a71d5d; } .markdown-body .pl-pds, .markdown-body .pl-s, .markdown-body .pl-s .pl-pse .pl-s1, .markdown-body .pl-sr, .markdown-body .pl-sr .pl-cce, .markdown-body .pl-sr .pl-sra, .markdown-body .pl-sr .pl-sre { color: #183691; } .markdown-body .pl-v { color: #ed6a43; } .markdown-body .pl-id { color: #b52a1d; } .markdown-body .pl-ii { background-color: #b52a1d; color: #f8f8f8; } .markdown-body .pl-sr .pl-cce { color: #63a35c; font-weight: bold; } .markdown-body .pl-ml { color: #693a17; } .markdown-body .pl-mh, .markdown-body .pl-mh .pl-en, .markdown-body .pl-ms { color: #1d3e81; font-weight: bold; } .markdown-body .pl-mq { color: #008080; } .markdown-body .pl-mi { color: #333; font-style: italic; } .markdown-body .pl-mb { color: #333; font-weight: bold; } .markdown-body .pl-md { background-color: #ffecec; color: #bd2c00; } .markdown-body .pl-mi1 { background-color: #eaffea; color: #55a532; } .markdown-body .pl-mdr { color: #795da3; font-weight: bold; } .markdown-body .pl-mo { color: #1d3e81; } .markdown-body kbd { display: inline-block; padding: 3px 5px; font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; line-height: 10px; color: #555; vertical-align: middle; background-color: #fcfcfc; border: solid 1px #ccc; border-bottom-color: #bbb; border-radius: 3px; box-shadow: inset 0 -1px 0 #bbb; } .markdown-body .task-list-item { list-style-type: none; } .markdown-body .task-list-item+.task-list-item { margin-top: 3px; } .markdown-body .task-list-item input { margin: 0 0.35em 0.25em -1.6em; vertical-align: middle; } .markdown-body :checked+.radio-label { z-index: 1; position: relative; border-color: #4078c0; } ================================================ FILE: docs/meteor/MyLove.md ================================================
# My Love ## Info * Originally sung by: Westlife * Melody/Lyric by: Jörgen Elofsson, Per Magnusson, David Kreuger and Pelle Nylén * CZloid voicebank: [http://utau.wiki/utau:czloid](http://utau.wiki/utau:czloid) * Video published earlier on Bilibili: [https://www.bilibili.com/video/av19520577](https://www.bilibili.com/video/av19520577) * Teto English Voicebank (CVVC) Voicebank: [http://kasaneteto.jp/en/voicebank.html](http://kasaneteto.jp/en/voicebank.html) ```python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.MeteorDocument() doc.setTempo(72) Teto = ScoreDraft.TetoEng_UTAU() Teto.setLyricConverter(ScoreDraft.TTEnglishConverter) Guitar=ScoreDraft.SteelGuitar() Bass=ScoreDraft.Bass() track=doc.newBuf() track_g=doc.newBuf() track_b=doc.newBuf() track_mix=doc.newBuf() FreqsC=Freqs[:] FreqsD=[f*Freqs[2] for f in Freqs] def doS(octave=5, duration=48): return note(octave,Freqs[1],duration) def faS(octave=5, duration=48): return note(octave,Freqs[6],duration) def soS(octave=5, duration=48): return note(octave,Freqs[8],duration) def Chord3(A,octA,B,octB,C,octC, duration, delay): return [A(octA,duration), BK(duration-delay), B(octB,duration-delay), BK(duration-delay*2), C(octC,duration-delay*2)] def MiSoDo(duration, delay=0): return Chord3(mi,4,so,4,do,5,duration,delay) def DoMiSo(duration, delay=0): return Chord3(do,5,mi,5,so,5,duration,delay) def TiReSo(duration, delay=0): return Chord3(ti,4,re,5,so,5,duration,delay) def TiMiSo(duration, delay=0): return Chord3(ti,4,mi,5,so,5,duration,delay) def LaDoMi(duration, delay=0): return Chord3(la,4,do,5,mi,5,duration,delay) def LaDoFa(duration, delay=0): return Chord3(la,4,do,5,fa,5,duration,delay) def DoReSo(duration, delay=0): return Chord3(do,5,re,5,so,5,duration,delay) def LaReFa(duration, delay=0): return Chord3(la,4,re,5,fa,5,duration,delay) def FaLaDoH(duration, delay=0): return Chord3(fa,5,la,5,do,6,duration,delay) def MiSoDoH(duration, delay=0): return Chord3(mi,5,so,5,do,6,duration,delay) def LaDoFaH(duration, delay=0): return Chord3(la,5,do,6,fa,6,duration,delay) def SoDoMiH(duration, delay=0): return Chord3(so,5,do,6,mi,6,duration,delay) def LaDoMiH(duration, delay=0): return Chord3(la,5,do,6,mi,6,duration,delay) def FaSLaReH(duration, delay=0): return Chord3(faS,5,la,5,re,6,duration,delay) def TiReSoH(duration, delay=0): return Chord3(ti,5,re,6,so,6,duration,delay) def SoTiReH(duration, delay=0): return Chord3(so,5,ti,5,re,6,duration,delay) def SoSTiMiH(duration, delay=0): return Chord3(soS,5,ti,5,mi,6,duration,delay) def MiLaDoH(duration, delay=0): return Chord3(mi,5,la,5,do,6,duration,delay) def ReSoTi(duration, delay=0): return Chord3(re,5,so,5,ti,5,duration,delay) def ReSoDoH(duration, delay=0): return Chord3(re,5,so,5,do,6,duration,delay) def DoFaLa(duration, delay=0): return Chord3(do,5,fa,5,la,5,duration,delay) seq=[BL(192)] seq_g=[BL(96), fa(5,12), la(4,12), re(5,12), fa(5,60), BK(48), do(5,24), la(4,24)] seq_b=[BL(96), re(4,48), do(4,48)] seq+=[BL(192)] seq_g+=[re(5,48), BK(48), so(4,48), re(5,24), BK(24), so(4,24), do(5,12), ti(4,12), la(4,48), la(4,24), ti(4,24)] seq_b+=[ti(3,72), la(3,12), so(3,12), fa(3,96), BK(72), do(4,12), fa(4,60)] seq+=[BL(96), BL(72), BL(12)] seq_g+=MiSoDo(48)+MiSoDo(36)+MiSoDo(24)+MiSoDo(12)+MiSoDo(24)+MiSoDo(24)+[BL(24)] seq_b+=[do(3,144), BL(48)] seq+=[('{n', so(5,12), 'Em', do(6,24),'pti', do(6,12), 'strit', do(6, 36)), BL(12)] seq+=[('{n',so(5,12), 'Em', re(6,24),'pti', re(6,12), 'haUs',re(6, 36)), BL(12)] seq_g+=DoMiSo(48, 2)+DoMiSo(48, 2)+TiReSo(48,2)+TiReSo(48,2) seq_b+=[do(4,72), do(4,24),so(3,72),so(3,24)] seq+=[('@', so(5,12), 'hoUl', ti(5,24), 'In', ti(5,12), 'saId', ti(5,24), 'maI',do(6,24),'hArt',do(6,48)), BL(48)] seq_g+=TiMiSo(48,2)+TiMiSo(48,2)+LaDoMi(48,2)+LaDoMi(24)+LaDoMi(12)+LaDoMi(12) seq_b+=[mi(3,72),mi(3,24), la(3,96)] seq+=[('aIm', so(5,12), 'Ol', la(5,24), '@l', la(5,12),'oUn', la(5,36)),BL(12)] seq+=[('D@',la(5,12),'rum',la(5,24),'zAr',la(5,24), 'gEt', la(5,12),'IN', la(5,24), 'smOl', la(5,24), '3', so(5,36))] seq_g+=LaDoFa(48,2)+LaDoFa(24)+LaDoFa(12)+LaDoFa(12)+LaDoFa(48,2)+LaDoFa(48,2) seq_b+=[fa(3,96),fa(3,72), fa(3,24)] seq+=[BL(48),BL(48), BL(36)] seq_g+=DoReSo(48,2)+DoReSo(24)+DoReSo(12)+DoReSo(12)+TiReSo(48,2)+TiReSo(24)+TiReSo(12)+TiReSo(12) seq_b+=[so(3,96),so(3,96)] seq+=[('aI',so(5,12),'w@n',do(6,24),'d3',do(6,12),'haU',do(6,36)), BL(12)] seq+=[('aI',so(5,12),'w@n',re(6,24),'d3',re(6,12),'waI',re(6,36)), BL(12)] seq_g+=DoMiSo(48, 2)+DoMiSo(48, 2)+TiReSo(48,2)+TiReSo(48,2) seq_b+=[do(4,72), do(4,24),so(3,72),so(3,24)] seq+=[('aI',mi(6,12), 'w@n', so(6,24), 'd3', so(6,12), 'wEr', so(6,12), mi(6,12), 'DeI', mi(6,12), do(6,12), 'Ar', do(6,48)), BL(48)] seq_g+=TiMiSo(48,2)+TiMiSo(48,2)+LaDoMi(48,2)+LaDoMi(24)+LaDoMi(12)+LaDoMi(12) seq_b+=[mi(3,72),mi(3,24), la(3,48), so(3,48)] seq+=[('D@',so(5,12),'deIz',la(5,24), 'wi',la(5,12), 'h{d', la(5,36)), BL(12)] seq+=[('D@',fa(5,12),'sONz',la(5,24), 'wi',la(5,12), 's{N', do(6,36), 't@g', la(5,12), 'ED', la(5,12), so(5,12), '3', so(5,36)), BL(12)] seq_g+=LaDoFa(48,2)+LaDoFa(48,2)+LaDoFa(24)+[fa(4,24), la(4,48), BK(48), re(5,48), BK(48), faS(5,48)] seq_b+=[fa(3,72),fa(3,24), fa(3,48), faS(3,48)] seq+=[('oU', ti(5,12),la(5,12), 'j{', ti(5,6), la(5,6), so(5,48)), BL(24)] seq_g+=DoReSo(48,2)+DoReSo(48,2)+TiReSo(48,2)+TiReSo(48,2) seq_b+=[so(3,72),so(3,24),so(3,96)] seq+=[('@n',so(5,24),'dol',fa(6,48),'maI',la(5,48),'l@v',ti(5,48)), BL(36)] seq_g+=[fa(5,12),la(4,12),re(5,12),fa(5,60),BK(48),do(5,24),la(4,24)]+Chord3(so,4,re,5,so,5,96,4) seq_b+=[re(4,48),do(4,48),ti(3,48),ti(3,48)] seq+=[('aIm',so(5,12),'hoU',do(6,24),'ldIN',do(6,12),'An',do(6,36),'f3',mi(6,12),'Ev',re(6,12),do(6,12),'3',do(6,36)),BL(48)] seq_g+=[so(4,48),BK(46),mi(5,46),do(5,48),BK(46),so(5,46)]+LaDoFa(48,2)+LaDoFa(48,2) seq_b+=[do(4,48),mi(3,48),fa(3,48),fa(3,24),mi(3,24)] seq+=[('ri',fa(6,24),'tSIN',fa(6,12),'fOr',fa(6,36),'D@',fa(6,12),'l@v',fa(6,36),'D{t',mi(6,12),'simz',do(6,24),'soU',re(6,36),'fAr',re(6,96)), BL(48)] seq_g+=LaReFa(48,2)+LaReFa(48,2)+LaDoFa(48,2)+LaReFa(48,2) seq_b+=[re(3,72),mi(3,24),fa(3,96)] seq_g+=DoReSo(48,2)+DoReSo(48,2)+TiReSo(96,4) seq_b+=[so(3,72),so(3,24),so(3,96)] seq+=[('soU',do(6,24),'aI',ti(5,24),'seI',la(5,24),'@',so(5,12),'lIt',so(5,24),'@l',so(5,24),'prEr',so(5,36)), BL(12)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('@nd',so(5,12),'hoUp',do(6,24),'maI',ti(5,24),'drimz',la(5,24),'wIl',so(5,12),'teIk',so(5,24),'mi',fa(5,24),'DEr',mi(5,36)), BL(24)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,24),'skaIz',fa(6,24),'Ar',mi(6,12),'blu',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,60),'maI',la(5,24),'l@v',ti(5,48)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(48,2)+FaSLaReH(48,2)+TiReSoH(48,2)+TiReSoH(48,2) seq_b+=[faS(3,72),faS(3,24),so(3,72),so(3,24)] seq+=[('oU',do(6,24),'v3',ti(5,24),'siz',la(5,24),'fr@m',so(5,12),'koUst',so(5,36),'u',fa(5,12),'koUst',so(5,36)),BL(12)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('tu',so(5,12),'faInd',do(6,24),'D@',ti(5,12),'pleIs',la(5,36),'aI',so(5,12),'l@v',so(6,24),fa(6,12),'D@',fa(6,12),'moUst',mi(6,36)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,12),'fild',fa(6,36),'zAr',mi(6,12),'grin',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,108)),BL(48)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(48,2)+FaSLaReH(24)+SoTiReH(120,4) seq_b+=[re(4,72),so(3,72),so(3,48)] seq+=[('maI',ti(5,24),'l@v',do(6,168)), BL(36)] seq_g+=MiSoDoH(192,4) seq_b+=[do(3,192)] seq+=[('aI', so(5,12), 'traI', do(6,24),'tu', do(6,12), 'rEd', do(6, 36)), BL(12)] seq+=[('aI',so(5,12), 'goU', re(6,24),'tu', re(6,12), 'w3k',re(6, 36)), BL(12)] seq_g+=DoMiSo(48, 2)+DoMiSo(48, 2)+TiReSo(48,2)+TiReSo(48,2) seq_b+=[do(4,72), do(4,24),so(3,72),so(3,24)] seq+=[('aIm', so(5,12), 'l{f', ti(5,24), 'IN', ti(5,12), 'wID', ti(5,24), 'maI',do(6,24),'frEndz',do(6,48)), BL(48)] seq_g+=TiMiSo(48,2)+TiMiSo(48,2)+LaDoMi(48,2)+LaDoMi(24)+LaDoMi(12)+LaDoMi(12) seq_b+=[mi(3,72),mi(3,24), la(3,96)] seq+=[('b@t', so(5,12), 'aI', la(5,24), 'k{nt', la(5,12),'stAp', la(5,36)),BL(12)] seq+=[('tu',la(5,12),'kip',la(5,24),'maI',la(5,24), 'sElf', la(5,12),'r@m', la(5,24), 'TIN', la(5,24), 'kIN', so(5,36))] seq_g+=LaDoFa(48,2)+LaDoFa(24)+LaDoFa(12)+LaDoFa(12)+LaDoFa(48,2)+LaDoFa(48,2) seq_b+=[fa(3,96),fa(3,72), fa(3,24)] seq+=[BL(12),('oU', ti(5,12),la(5,12), 'noU', ti(5,6), la(5,6), so(5,48)), BL(36)] seq_g+=DoReSo(48,2)+DoReSo(24)+DoReSo(12)+DoReSo(12)+TiReSo(48,2)+TiReSo(24)+TiReSo(12)+TiReSo(12) seq_b+=[so(3,96),so(3,96)] seq+=[('aI',so(5,12),'w@n',do(6,24),'d3',do(6,12),'haU',do(6,36)), BL(12)] seq+=[('aI',so(5,12),'w@n',re(6,24),'d3',re(6,12),'waI',re(6,36)), BL(12)] seq_g+=DoMiSo(48, 2)+DoMiSo(48, 2)+TiReSo(48,2)+TiReSo(48,2) seq_b+=[do(4,72), do(4,24),so(3,72),so(3,24)] seq+=[('aI',mi(6,12), 'w@n', so(6,24), 'd3', so(6,12), 'wEr', so(6,12), mi(6,12), 'DeI', mi(6,12), do(6,12), 'Ar', do(6,48)), BL(48)] seq_g+=TiMiSo(48,2)+TiMiSo(48,2)+LaDoMi(48,2)+LaDoMi(24)+LaDoMi(12)+LaDoMi(12) seq_b+=[mi(3,72),mi(3,24), la(3,48), so(3,48)] seq+=[('D@',so(5,12),'deIz',la(5,24), 'wi',la(5,12), 'h{d', la(5,36)), BL(12)] seq+=[('D@',fa(5,12),'sONz',la(5,24), 'wi',la(5,12), 's{N', do(6,36), 't@g', la(5,12), 'ED', la(5,12), so(5,12), '3', so(5,36)), BL(12)] seq_g+=LaDoFa(48,2)+LaDoFa(48,2)+LaDoFa(24)+[fa(4,24), la(4,48), BK(48), re(5,48), BK(48), faS(5,48)] seq_b+=[fa(3,72),fa(3,24), fa(3,48), faS(3,48)] seq+=[('oU', ti(5,12),la(5,12), 'j{', ti(5,6), la(5,6), so(5,48)), BL(24)] seq_g+=DoReSo(48,2)+DoReSo(48,2)+TiReSo(48,2)+TiReSo(48,2) seq_b+=[so(3,72),so(3,24),so(3,96)] seq+=[('@n',so(5,24),'dol',fa(6,48),'maI',la(5,48),'l@v',ti(5,48)), BL(36)] seq_g+=[fa(5,12),la(4,12),re(5,12),fa(5,60),BK(48),do(5,24),la(4,24)]+Chord3(so,4,re,5,so,5,96,4) seq_b+=[re(4,48),do(4,48),ti(3,48),ti(3,48)] seq+=[('aIm',so(5,12),'hoU',do(6,24),'ldIN',do(6,12),'An',do(6,36),'f3',mi(6,12),'Ev',re(6,12),do(6,12),'3',do(6,36)),BL(48)] seq_g+=[so(4,48),BK(46),mi(5,46),do(5,48),BK(46),so(5,46)]+LaDoFa(48,2)+LaDoFa(48,2) seq_b+=[do(4,48),mi(3,48),fa(3,48),fa(3,24),mi(3,24)] seq+=[('ri',fa(6,24),'tSIN',fa(6,12),'fOr',fa(6,36),'D@',fa(6,12),'l@v',fa(6,36),'D{t',mi(6,12),'simz',do(6,24),'soU',re(6,36),'fAr',re(6,96)), BL(48)] seq_g+=LaReFa(48,2)+LaReFa(48,2)+LaDoFa(48,2)+LaReFa(48,2) seq_b+=[re(3,72),mi(3,24),fa(3,96)] seq_g+=DoReSo(48,2)+DoReSo(48,2)+TiReSo(96,4) seq_b+=[so(3,72),so(3,24),so(3,96)] seq+=[('soU',do(6,24),'aI',ti(5,24),'seI',la(5,24),'@',so(5,12),'lIt',so(5,24),'@l',so(5,24),'prEr',so(5,36)), BL(12)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('@nd',so(5,12),'hoUp',do(6,24),'maI',ti(5,24),'drimz',la(5,24),'wIl',so(5,12),'teIk',so(5,24),'mi',fa(5,24),'DEr',mi(5,36)), BL(24)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,24),'skaIz',fa(6,24),'Ar',mi(6,12),'blu',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,60),'maI',la(5,24),'l@v',ti(5,48)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(48,2)+FaSLaReH(48,2)+TiReSoH(48,2)+TiReSoH(48,2) seq_b+=[faS(3,72),faS(3,24),so(3,72),so(3,24)] seq+=[('oU',do(6,24),'v3',ti(5,24),'siz',la(5,24),'fr@m',so(5,12),'koUst',so(5,36),'u',fa(5,12),'koUst',so(5,36)),BL(12)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('tu',so(5,12),'faInd',do(6,24),'D@',ti(5,12),'pleIs',la(5,36),'aI',so(5,12),'l@v',so(6,24),fa(6,12),'D@',fa(6,12),'moUst',mi(6,36)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,12),'fild',fa(6,36),'zAr',mi(6,12),'grin',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,72)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq+=[('tu',la(5,12),'hoUl',mi(6,24),'dju',re(6,12),'In',do(6,36),'maI',ti(5,12),'Armz',do(6,60)), BL(36)] seq_g+=FaSLaReH(96,4)+SoSTiMiH(48,2)+[ti(5,48), BK(46), mi(6,46)] seq_b+=[re(4,72),re(4,24),mi(4,48), soS(3,48)] seq+=[('tu',la(5,12),'prAm',re(6,24),'@s',do(6,12),'ju',ti(5,24),'maI',la(5,24),'l@v',ti(5,24),la(5,12),so(5,24)), BL(36)] seq_g+=MiLaDoH(48,2)+MiLaDoH(48,2)+[re(5,48),BK(46),la(5,46),re(5,48),BK(46),la(5,46)] seq_b+=[la(3,72),la(3,24),faS(3,72),faS(3,24)] seq+=[('tu',la(5,12),'tEl',mi(6,24),'ju',re(6,12),'fr@m',do(6,36),'D@',ti(5,12),'hArt',do(6,60)), BL(36)] seq_g+=ReSoTi(48,2)+ReSoTi(48,2)+[soS(5,48),mi(5,48),BK(96),mi(6,24),re(6,12),do(6,36),ti(5,24)] seq_b+=[so(3,72),so(3,24),mi(3,48),soS(3,48)] seq+=[('jUr',mi(5,12),'Ol',la(5,24),'aIm',la(5,12),'TIN',la(5,36),'kIN',so(5,12),'Ov',so(5,156)),BL(48)] seq_g+=MiLaDoH(48,2)+MiLaDoH(48,2)+[re(5,48),BK(46),la(5,46),re(5,48),BK(46),la(5,46)] seq_b+=[la(3,72), la(3,24),faS(3,72),faS(3,24)] seq_g+=ReSoDoH(48,2)+ReSoDoH(48,2) seq_g+=[re(5,96), BK(92), so(5,92), BK(90), ti(5,42), la(5,24), ti(5,24)] seq_b+=[so(3,72), re(4,24), so(3,96)] seq+=[BL(192)] seq_g+=[mi(5,96), BK(92), so(5,92), BK(92), do(6,20), do(6,12), do(6,48), do(6,12), so(5,36), ti(5,60), BK(96), do(6,12), re(6,12), re(6,12), re(6,60)] seq_b+=[do(4,96), so(3,96)] seq+=[BL(192-12)] seq_g+=[so(5,84), mi(5,108), BK(192), ti(5,24), ti(5,12), ti(5,24), do(6,24), do(6,60), ti(5,48)] seq_b+=[mi(3,96), la(3,48), so(3,48)] seq+=[('aIm',fa(5,12), 'ri',fa(6,24),'tSIN',fa(6,12),'fOr',fa(6,36),'D@',fa(6,12), 'l@v',fa(6,24),mi(6,12),'D{t',mi(6,12), 'simz',do(6,24),'soU',re(6,36), 'fAr', re(6,72)), BL(24)] seq_g+=DoFaLa(48,2)+DoFaLa(24)+DoFaLa(24)+DoFaLa(48,2)+DoFaLa(24)+DoFaLa(24) seq_b+=[fa(3,96),fa(3,96)] seq+=[('soU',re(6,48),'aI',re(6,24),doS(6,24))] seq_g+=ReSoDoH(48,2)+ReSoDoH(48,2)+ReSoTi(24)+[re(5,12),mi(5,12),faS(5,10),so(5,10),la(5,10),ti(5,9),doS(6,9)] seq_b+=[so(3,96),so(3,24), BL(24), BL(48)] # To D Freqs[:]=FreqsD seq+=[('seI',la(5,24),'@',so(5,12),'lIt',so(5,24),'@l',so(5,24),'prEr',so(5,36)), BL(12)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('@nd',so(5,12),'hoUp',do(6,24),'maI',ti(5,24),'drimz',la(5,24),'wIl',so(5,12),'teIk',so(5,24),'mi',fa(5,24),'DEr',mi(5,36)), BL(24)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,24),'skaIz',fa(6,24),'Ar',mi(6,12),'blu',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,60),'maI',la(5,24),'l@v',ti(5,48)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(48,2)+FaSLaReH(48,2)+TiReSoH(48,2)+TiReSoH(48,2) seq_b+=[faS(3,72),faS(3,24),so(3,72),so(3,24)] seq+=[('oU',do(6,24),'v3',ti(5,24),'siz',la(5,24),'fr@m',so(5,12),'koUst',so(5,36),'u',fa(5,12),'koUst',so(5,36)),BL(12)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('tu',so(5,12),'faInd',do(6,24),'D@',ti(5,12),'pleIs',la(5,36),'aI',so(5,12),'l@v',so(6,24),fa(6,12),'D@',fa(6,12),'moUst',mi(6,36)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,12),'fild',fa(6,36),'zAr',mi(6,12),'grin',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,108)),BL(48)] seq+=[('soU',do(6,24),'aI',ti(5,24))] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(48,2)+FaSLaReH(24)+[so(5,120), BK(116),ti(5,68),BK(64),re(6,64), do(6,24), ti(5,24)] seq_b+=[re(4,72),so(3,72),so(3,48)] seq+=[('seI',la(5,24),'@',so(5,12),'lIt',so(5,24),'@l',so(5,24),'prEr',so(5,36)), BL(12)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('@nd',so(5,12),'hoUp',do(6,24),'maI',ti(5,24),'drimz',la(5,24),'wIl',so(5,12),'teIk',so(5,24),'mi',fa(5,24),'DEr',mi(5,36)), BL(24)] seq_g+=FaLaDoH(48,2)+FaLaDoH(48,2)+MiSoDoH(48,2)+MiSoDoH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,24),'skaIz',fa(6,24),'Ar',mi(6,12),'blu',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,60),'maI',la(5,24),'l@v',ti(5,48)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(48,2)+FaSLaReH(48,2)+TiReSoH(48,2)+TiReSoH(48,2) seq_b+=[faS(3,72),faS(3,24),so(3,72),so(3,24)] seq+=[('oU',do(6,24),'v3',ti(5,24),'siz',la(5,24),'fr@m',so(5,12),'koUst',so(5,36),'u',fa(5,12),'koUst',so(5,36)),BL(12)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,96)] seq+=[('tu',so(5,12),'faInd',do(6,24),'D@',ti(5,12),'pleIs',la(5,36),'aI',so(5,12),'l@v',so(6,24),fa(6,12),'D@',fa(6,12),'moUst',mi(6,36)),BL(24)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),do(4,24)] seq+=[('wEr',mi(6,24),'D@',so(6,12),'fild',fa(6,36),'zAr',mi(6,12),'grin',re(6,36)),BL(12)] seq+=[('tu',do(6,12),'si',mi(6,24),'ju',re(6,12),'w@n',do(6,36),'s@g',mi(6,12),'En',re(6,108)),BL(48)] seq_g+=LaDoFaH(48,2)+LaDoFaH(48,2)+SoDoMiH(48,2)+LaDoMiH(48,2) seq_b+=[fa(3,72),fa(3,24),do(4,72),la(3,24)] seq_g+=FaSLaReH(72,2)+SoTiReH(120,4) seq_b+=[faS(3,48),faS(3,24),so(3,120)] seq+=[('maI',ti(5,24),'l@v',do(6,168)), BL(48)] seq_g+=[so(4,192), BK(188), do(5,188), BK(184), mi(5,184)] seq_b+=[do(3,192)] doc.sing(seq, Teto, track) doc.playNoteSeq(seq_g, Guitar, track_g) doc.playNoteSeq(seq_b, Bass, track_b) doc.setTrackVolume(track_g, 0.5) doc.setTrackVolume(track_b, 0.5) doc.meteor() doc.mixDown('MyLove.wav') ``` ================================================ FILE: docs/meteor/SoreFeetSong.md ================================================
# The Sore Feet Song ## Info * The song is from Anime 蟲師 produced by ARTLAND. * Originally sung by: Ally Kerr * Melody/Lyric by: Ally Kerr * WALTTenglish Z VCCV: http://utau.wikia.com/wiki/WALTT ```python import ScoreDraft from ScoreDraft.Notes import * def miF(octave=5, duration=48): return note(octave,Freqs[3],duration) doc=ScoreDraft.MeteorDocument() singer = ScoreDraft.WALTT_Z_UTAU() singer.setLyricConverter(ScoreDraft.VCCVEnglishConverter) singer.setCZMode() Guitar = ScoreDraft.NylonGuitar() FreqsB=[f*Freqs[11]*0.5 for f in Freqs] Freqs[:]=FreqsB track=doc.newBuf() track_g=doc.newBuf() def Repeat(x,t): ret=[] for i in range(t): ret+=x return ret seq=[BL(192)] seq_g = [so(4,32),re(5,16),so(5,96),BK(96),re(6,32),ti(5,16),do(6,32),ti(5,16),re(5,48),BK(48),so(5,48)] seq+=[BL(192)] seq_g += [fa(4,32),do(5,16),fa(5,96), BK(144), la(5,32), so(5,48), la(5,48), so(5,64), BK(48), do(5,48)] seq+=[BL(192)] seq_g += [do(4,32),so(4,16),do(5,96),BK(96),re(6,32),ti(5,16),do(6,32),ti(5,16),so(4,48),BK(48),so(5,48)] seq+=[BL(192)] seq_g += [so(4,32),re(5,16),so(5,96), BK(144), la(5,32), so(5,48), ti(5,48), so(5,64), BK(48), re(4,48)] seq+=[BL(48)] line= ('I',so(4,48),'w9lk',so(4,48),'ten',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48)] line +=('th8',fa(4,24),'zxnd',so(4,48),'mIls',so(4,72),'ten',so(4,48)) seq_g += [fa(3,32),do(4,16),fa(4,96), do(4,48)] line +=('th8',mi(4,24),'zxnd',so(4,48),'mIls',so(4,72),'t6',so(4,24)) seq_g += [do(4,32),so(4,16),do(5,96), do(4,48)] line +=('sE',ti(4,48),'yx',so(4,48)) seq+=[line, BL(120)] seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144), re(6,32), ti(5,16), do(6,32), ti(5,16), so(5,48)] seq+=[BL(48)] line= ('&nd',so(4,48),'ev',so(4,48),'ri',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48)] line +=('g@sp',fa(4,24),'xv',so(4,48),'breth',so(4,72),'I',so(4,48)) seq_g += [fa(3,32),do(4,16),fa(4,96), do(4,48)] line +=('gr@bd',mi(4,24),'it',so(4,48),'zhust',so(4,72),'t6',so(4,24)) seq_g += [do(4,32),so(4,16),do(5,96), do(4,48)] line +=('fInd',ti(4,48),'yx',so(4,48)) seq+=[line, BL(120)] seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144), re(6,32), ti(5,16), do(6,32), ti(5,16), so(5,48)] seq+=[BL(48)] line= ('I',so(4,48),'klImbd',so(4,48),'up',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144),re(5,48),re(5,48),re(5,48)] line+=('ev',do(5,48),'ri',ti(4,48),'hill',la(4,48),'t6',ti(4,32)) seq_g+=[fa(3,48),do(4,48),fa(4,48),do(4,48), BK(192), so(5,48), so(5,48),so(5,48),so(5,32)] line+=('get',so(4,112)) seq+=[line, BL(32)] line = ('t6', so(4,24), la(4,40)) seq_g+=[mi(5,112), BL(32), mi(5,64), BK(192), do(3,32),so(3,16),do(4,96),so(3,48)] line +=('yx', so(4,96)) seq+=[line, BL(96)] seq_g+=[mi(5,96), BK(96), so(3,32),re(4,16),so(4,96), re(4,48), BK(144), re(6,32), ti(5,16), do(6,32), ti(5,16), so(5,48)] seq+=[BL(48)] line= ('I',so(4,48),'wan',so(4,48),'d3d',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144),re(5,48),re(5,48),re(5,48)] line+=('An',do(5,48),'shent',ti(4,48),'l&nd',la(4,48),'st6',ti(4,32)) seq_g+=[fa(3,48),do(4,48),fa(4,48),do(4,48), BK(192), so(5,48), so(5,48),so(5,48),so(5,32)] line+=('hOd',so(4,112)) seq+=[line, BL(32)] line = ('zhust', so(4,24), la(4,40)) seq_g+=[mi(5,112), BL(32), mi(5,64), BK(192), do(3,32),so(3,16),do(4,96),so(3,48)] line +=('yx', so(4,96)) seq+=[line, BL(96)] seq_g+=[so(3,32),re(4,16),so(4,32),so(4,48),so(4,16), so(4,12),re(4,12),so(3,24), BK(192), mi(5,192)] seq+=[BL(48)] line= ('&nd',fa(4,48),'ev',fa(4,48),'ri',fa(4,48)) seq_g+=[re(3,32),la(3,16),re(4,96),la(3,48)] line+=('s1ng', fa(4,48), 'gx', fa(4,32), 'step',mi(4,48), 'xv', do(4,16), re(4,12),'dhx', do(4,36)) seq_g+=[fa(3,32),do(4,16),fa(4,96),fa(3,48)] line+=('wA',do(4,96), BL(72), 'I',do(4,24)) seq_g+=[do(4,32),so(4,16),do(5,96),BK(96), do(5,32), do(5,48), do(5,48), do(5,16)] line+=('pA',do(4,48),'A', mi(4,48),'A',fa(4,48),'A',mi(4,48)) seq_g+=Repeat([do(4,48),BK(42),so(4,42),BK(36),do(5,36)],4) line+=('Ad',re(4,72)) seq+=[line,BL(24)] line=('ev',fa(4,48),'ri',fa(4,48)) seq_g+=[re(3,24),la(3,24),re(4,48),BL(48),re(4,48)] line+=('s1ng', fa(4,48), 'gxl', so(4,48), 'nIt', la(4,48), '&n', ti(4,24),do(5,168)) seq+=[line, BL(48)] seq_g+=[so(3,48),fa(4,48),la(4,48),do(5,48), BL(192)] line=('dA',ti(4,144), 'A',la(4,48),so(4,144), 'I',so(4,24),la(4,24)) seq_g+=[so(3,192), BK(192), so(4,24),re(4,24),so(3,24),so(4,48),so(3,24),so(4,48)] seq_g+=[so(3,192), BK(192), fa(4,24),re(4,24),so(3,24),fa(4,48),so(3,24),fa(4,48)] line+=('s3ch',so(4,144),'f0r',fa(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), BL(48)] line+=('yx', so(4,120)) seq+=[line, BL(24)] line= ('thro',re(4,48)) seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), BL(48)] line+=('s&nd', ti(4,72),'st0rms', ti(4,72), '&nd', do(5,48)) seq_g+=[so(3,96), BK(96), so(4,24), re(4,24), so(3,24), so(4,24), re(4,24), so(3,24), so(4,24),re(4,24), BK(192), so(5,72), so(5,72), so(5,48)] line+=('hA', ti(4,48), 'zi', la(4,24), 'dans', so(4,60)) seq+=[line, BL(12)] line=('I', so(4,24),la(4,24)) seq_g+=[so(5,48), BK(48), so(3,96), BK(96), fa(4,24), re(4,24), so(3,24), fa(4,24), re(4,24), so(3,24), fa(4,24),re(4,24)] line+=('rEch',so(4,144),'f0r',fa(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), so(4,24), BL(24)] line+=('yx', so(4,144), la(4,48), so(4,144)) seq+=[line, BL(48)] seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), so(4,24), BL(24)] seq_g+=[do(4,192), BK(168), re(4,24), so(4,24),do(5,24),so(4,24),re(4,24), so(3,48), BK(42), do(4,42), BK(36), re(4,36), BK(30), so(4,30) ] seq+=[BL(48)] line= ('I',so(4,48),'st0l',so(4,48),'ten',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48)] line +=('th8',fa(4,24),'zxnd',so(4,48),'p9nd',so(4,72),'ten',so(4,48)) seq_g += [fa(3,32),do(4,16),fa(4,96), do(4,48)] line +=('th8',mi(4,24),'zxnd',so(4,48),'p9nd',so(4,72),'t6',so(4,24)) seq_g += [do(4,32),so(4,16),do(5,96), do(4,48)] line +=('sE',ti(4,48),'yx',so(4,48)) seq+=[line, BL(120)] seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144), re(6,32), ti(5,16), do(6,32), ti(5,16), so(5,48)] seq+=[BL(48)] line= ('I',so(4,48),'rubd',so(4,48),'kxn',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48)] line +=('vE',fa(4,24),'nixn',so(4,48),'st0r',so(4,72),'kas',so(4,24),'I',so(4,24)) seq_g += [fa(3,32),do(4,16),fa(4,96), do(4,48)] line +=('th8t',mi(4,24),'dhAd',so(4,48),'mAk',so(4,72),'it',so(4,24)) seq_g += [do(4,32),so(4,16),do(5,96), do(4,48)] line +=('E',ti(4,48),'zEr',so(4,48)) seq+=[line, BL(120)] seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144), re(6,32), ti(5,16), do(6,32), ti(5,16), so(5,48)] seq+=[BL(48)] line= ('I',so(4,48),'livd',so(4,48),'9f',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144),re(5,48),re(5,48),re(5,48)] line+=('r@ts',do(5,48),'&nd',ti(4,48),'tOds',la(4,32),'&nd', la(4,24), 'I', ti(4,24)) seq_g+=[fa(3,48),do(4,48),fa(4,48),do(4,48), BK(192), so(5,48), so(5,48),so(5,48),so(5,32)] line+=('starv',so(4,112)) seq+=[line, BL(32)] line = ('f0r', so(4,24), la(4,40)) seq_g+=[mi(5,112), BL(32), mi(5,64), BK(192), do(3,32),so(3,16),do(4,96),so(3,48)] line +=('yx', so(4,96)) seq+=[line, BL(96)] seq_g+=[mi(5,96), BK(96), so(3,32),re(4,16),so(4,96), re(4,48), BK(144), re(6,32), ti(5,16), do(6,32), ti(5,16), so(5,48)] seq+=[BL(48)] line= ('I',so(4,48),'f8t',so(4,48),'9f',so(4,48)) seq_g += [so(3,32),re(4,16),so(4,96), re(4,48), BK(144),re(5,48),re(5,48),re(5,48)] line+=('zhI',do(5,48),'xnt',ti(4,48),'bAr',la(4,32),'&nd',la(4,24),'I',ti(4,24)) seq_g+=[fa(3,48),do(4,48),fa(4,48),do(4,48), BK(192), so(5,48), so(5,48),so(5,48),so(5,32)] line+=('kild',so(4,112)) seq+=[line, BL(32)] line = ('dhem', so(4,24), la(4,40)) seq_g+=[mi(5,112), BL(32), mi(5,64), BK(192), do(3,32),so(3,16),do(4,96),so(3,48)] line +=('to', so(4,96)) seq+=[line, BL(96)] seq_g+=[so(3,32),re(4,16),so(4,32),so(4,48),so(4,16), so(4,12),re(4,12),so(3,24), BK(192), mi(5,192)] seq+=[BL(48)] line= ('&nd',fa(4,48),'ev',fa(4,48),'ri',fa(4,48)) seq_g+=[re(3,32),la(3,16),re(4,96),la(3,48)] line+=('s1ng', fa(4,48), 'gx', fa(4,32), 'step',mi(4,48), 'xv', do(4,16), re(4,12),'dhx', do(4,36)) seq_g+=[fa(3,32),do(4,16),fa(4,96),fa(3,48)] line+=('wA',do(4,96), BL(72), 'I',do(4,24)) seq_g+=[do(4,32),so(4,16),do(5,96),BK(96), do(5,32), do(5,48), do(5,48), do(5,16)] line+=('pA',do(4,48),'A', mi(4,48),'A',fa(4,48),'A',mi(4,48)) seq_g+=Repeat([do(4,48),BK(42),so(4,42),BK(36),do(5,36)],4) line+=('Ad',re(4,72)) seq+=[line,BL(24)] line=('ev',fa(4,48),'ri',fa(4,48)) seq_g+=[re(3,24),la(3,24),re(4,48),BL(48),re(4,48)] line+=('s1ng', fa(4,48), 'gxl', so(4,48), 'nIt', la(4,48), '&n', ti(4,24),do(5,168)) seq+=[line, BL(48)] seq_g+=[so(3,48),fa(4,48),la(4,48),do(5,48), BL(192)] line=('dA',ti(4,144), 'A',la(4,48),so(4,144), 'I',so(4,24),la(4,24)) seq_g+=[so(3,192), BK(192), so(4,24),re(4,24),so(3,24),so(4,48),so(3,24),so(4,48)] seq_g+=[so(3,192), BK(192), fa(4,24),re(4,24),so(3,24),fa(4,48),so(3,24),fa(4,48)] line+=('s3ch',so(4,144),'f0r',fa(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), BL(48)] line+=('yx', so(4,120)) seq+=[line, BL(24)] line= ('thro',re(4,48)) seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), BL(48)] line+=('s&nd', ti(4,72),'st0rms', ti(4,72), '&nd', do(5,48)) seq_g+=[so(3,96), BK(96), so(4,24), re(4,24), so(3,24), so(4,24), re(4,24), so(3,24), so(4,24),re(4,24), BK(192), so(5,72), so(5,72), so(5,48)] line+=('hA', ti(4,48), 'zi', la(4,24), 'dans', so(4,60)) seq+=[line, BL(12)] line=('I', so(4,24),la(4,24)) seq_g+=[so(5,48), BK(48), so(3,96), BK(96), fa(4,24), re(4,24), so(3,24), fa(4,24), re(4,24), so(3,24), fa(4,24),re(4,24)] line+=('rEch',so(4,144),'f0r',fa(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), so(4,24), BL(24)] line+=('yx', so(4,120)) seq+=[line, BL(24)] line=('Im', ti(4,24),do(5,24)) seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), so(4,24), BL(24)] line+=('tIrd', ti(4,72),'&nd', ti(4,72), 'Im', do(5,48)) seq_g+=[so(3,96), BK(96), so(4,24), re(4,24), so(3,24), so(4,24), re(4,24), so(3,24), so(4,24),re(4,24), BK(192), so(5,72), so(5,72), so(5,48)] line+=('wEk', re(5,72), 'but', do(5,60)) seq+=[line, BL(12)] line=('Im', ti(4,48)) seq_g+=[so(5,48), BK(48), so(3,96), BK(96), fa(4,24), re(4,24), so(3,24), fa(4,24), re(4,24), so(3,24), fa(4,24),re(4,24)] line+=('strang',so(4,144),'f0r',so(4,24),la(4,24)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), so(4,24), BL(24)] line+=('yx', so(4,120)) seq+=[line, BL(24)] line=('I', ti(4,24),do(5,24)) seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), so(4,24), BL(24)] line+=('wan', ti(4,72),'t6', ti(4,72), 'gO', do(5,48)) seq_g+=[so(3,96), BK(96), so(4,24), re(4,24), so(3,24), so(4,24), re(4,24), so(3,24), so(4,24),re(4,24), BK(192), so(5,72), so(5,72), so(5,48)] line+=('hOm', re(5,72), 'but', do(5,60)) seq+=[line, BL(12)] line=('mI', ti(4,48)) seq_g+=[so(5,48), BK(48), so(3,96), BK(96), fa(4,24), re(4,24), so(3,24), fa(4,24), re(4,24), so(3,24), fa(4,24),re(4,24)] line+=('luv',so(4,96),'gets',so(4,48),'mi',la(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), so(4,24), BL(24)] line+=('thro', so(4,120)) seq+=[line, BL(24)] line=('la', ti(4,24),do(5,24)) seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), so(4,24), BL(24)] line+=('la', ti(4,72),'la', ti(4,72), 'la', do(5,48)) seq_g+=[so(3,96), BK(96), so(4,24), re(4,24), so(3,24), so(4,24), re(4,24), so(3,24), so(4,24),re(4,24), BK(192), so(5,72), so(5,72), so(5,48)] line+=('la', re(5,72), 'la', do(5,60)) seq+=[line, BL(12)] line=('la', ti(4,48)) seq_g+=[so(5,48), BK(48), so(3,96), BK(96), fa(4,24), re(4,24), so(3,24), fa(4,24), re(4,24), so(3,24), fa(4,24),re(4,24)] line+=('la',so(4,96),'la',so(4,48),'la',la(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), so(4,24), BL(24)] line+=('la', so(4,120)) seq+=[line, BL(24)] line=('la', ti(4,24),do(5,24)) seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), so(4,24), BL(24)] line+=('la', ti(4,72),'la', ti(4,72), 'la', do(5,48)) seq_g+=[so(3,96), BK(96), so(4,24), re(4,24), so(3,24), so(4,24), re(4,24), so(3,24), so(4,24),re(4,24), BK(192), so(5,72), so(5,72), so(5,48)] line+=('la', re(5,72), 'la', do(5,60)) seq+=[line, BL(12)] line=('la', ti(4,48)) seq_g+=[so(5,48), BK(48), so(3,96), BK(96), fa(4,24), re(4,24), so(3,24), fa(4,24), re(4,24), so(3,24), fa(4,24),re(4,24)] line+=('la',so(4,96),'la',so(4,48),'la',la(4,48)) seq_g+=[do(4,192), BK(168), mi(4,24), so(4,24),do(5,24),so(4,24),mi(4,24), so(4,24), BL(24)] line+=('la', so(4,144)) seq+=[line, BL(24)] seq_g+=[do(4,192), BK(168), miF(4,24), so(4,24),do(5,24),so(4,24),miF(4,24), so(3,96), BK(90), do(4,90), BK(84), re(4,84), BK(78), so(4,78)] #seq+=[line, BL(48)] #print(ScoreDraft.TellDuration(seq)) #print(ScoreDraft.TellDuration(seq_g)) doc.setTempo(140) doc.sing(seq, singer, track) doc.playNoteSeq(seq_g,Guitar, track_g) #doc.setTrackVolume(track_g, 0.5) doc.meteor() doc.mixDown('SoreFeetSong.wav') ``` ================================================ FILE: docs/meteor/TaLang.md ================================================
# 踏浪 ## Info * Originally sung by: 沈雁 * Melody by: 庄奴 * Lyric by: 古月 * Video published earlier on Bilibili: [https://www.bilibili.com/video/av19520577](https://www.bilibili.com/video/av19520577) * 趙英子 VoiceBank [http://tsuro.lofter.com/choueiko](http://tsuro.lofter.com/choueiko) ```python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.MeteorDocument() doc.setTempo(72) ZhaoYingzi = ScoreDraft.ZhaoYingzi_UTAU() ZhaoYingzi.setLyricConverter(ScoreDraft.CVVCChineseConverter) Guitar=ScoreDraft.NylonGuitar() Bass=ScoreDraft.Bass() Ocarina=ScoreDraft.Ocarina() BassDrum=ScoreDraft.BassDrum() Snare=ScoreDraft.Snare() ClosedHitHat=ScoreDraft.ClosedHitHat() Tom1=ScoreDraft.Tom1() Tom2=ScoreDraft.Tom2() Tom3=ScoreDraft.Tom3() Tom4=ScoreDraft.Tom4() perc_list=[BassDrum,Snare,ClosedHitHat,Tom1,Tom2,Tom3,Tom4] def dong(duration=48): return (0,duration) def cha(duration=48): return (1,duration) def chi(duration=48): return (2,duration) def tong1(duration=48): return (3,duration) def tong2(duration=48): return (4,duration) def tong3(duration=48): return (5,duration) def tong4(duration=48): return (6,duration) Seashore=ScoreDraft.Seashore() effect_list=[Seashore] track=doc.newBuf() track_g=doc.newBuf() track_b=doc.newBuf() track_o=doc.newBuf() track_p=doc.newBuf() track_effect=doc.newBuf() def faS(octave=5, duration=48): return note(octave,Freqs[6],duration) def soS(octave=5, duration=48): return note(octave,Freqs[8],duration) seq=[BL(192)] seq_g=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_o=[la(5,24), la(5,12), ti(5,12), do(6,24), ti(5,24), la(5, 48), mi(5,48)] seq_e=[(-1, 144), (0,192*2)] seq+=[BL(192)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_o+=[la(5,24), la(5,12), ti(5,12), do(6,24), ti(5,24), la(5, 96)] seq+=[BL(192)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_o+=[la(5,24), la(5,12), ti(5,12), do(6,24), ti(5,24), la(5, 48), mi(5,48)] seq_e+=[(0,192*2)] seq+=[BL(192)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), do(5,48), BK(46), mi(5,46), BK(44), la(5,44), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_o+=[la(5,24), la(5,12), ti(5,12), do(6,24), ti(5,24), la(5, 96)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq+=[('xiao', la(4,24), 'xiao', la(4,12), 'di', do(5,12), 'yi', re(5,24), 'pian', mi(5,24), 'yun', re(5,12), mi(5,24),re(5,12), 'ya',re(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), fa(5,12), la(5,24), fa(5,24) ] seq+=[('man', la(4,24), 'man', la(4,12), 'di', do(5,12), 'zou', re(5,24), 'guo', mi(5,24), 'lai', re(5,12), mi(5,72)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24)] seq+=[('qing', la(4,24), 'ni', la(4,12), do(5,12), 'xie', re(5,24), 'xie', mi(5,24), 'jiao', re(5,12), mi(5,24),re(5,12), 'ya',re(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), faS(5,12), la(5,24), fa(5,24) ] seq+=[('zan', mi(5,12), re(5,12), 'shi', do(5,12), re(5,12), 'ting', do(5,24), 'xia', ti(4,24), 'lai', la(4,72)), BL(24)] seq_g+=[soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] progress_g=ScoreDraft.TellDuration(seq_g) progress_o=ScoreDraft.TellDuration(seq_o) line=('shan',la(5,12), so(5,12), 'shang', mi(5,12),'di',mi(5,12), 'shan',la(5,12), so(5,12), 'hua', mi(5,24)) line+=('kai',so(5,12), la(5,24), so(5,12), 'ya', mi(5,24), so(5,12),la(5,12)) seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24),la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_o+=[BL(progress_g-progress_o), la(6,48),mi(6,48)] seq_o+=[so(6,24),mi(6,12),re(6,12),mi(6,48)] line+=('wo', so(5,12), mi(5,12), 'cai', mi(5,12), 'dao', re(5,12), 'shan', do(5,24), 'shang', so(5,12), mi(5,12), 'lai', mi(5,72)) seq+=[line, BL(24)] seq_g+=[so(4,96), BK(72), do(5,12), mi(5,12), so(5,24), mi(5,24), soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24)] seq_o+=[so(6,24),mi(6,12),re(6,12),do(6,24),re(6,12),so(6,12)] miFa=[mi(6,6),fa(6,6)] miFaX2=miFa+miFa miFaX4=miFaX2+miFaX2 seq_o+=miFaX4+[mi(6,48)] seq+=[('yuan',la(4,24),'lai',la(4,12),do(5,12),'ni',re(5,24),'ye',mi(5,12),'shi',fa(5,12),'shang', re(5,12),mi(5,24),re(5,12),'shan',re(5,36)),BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), faS(5,12), la(5,24), fa(5,24) ] seq_o+=[la(5,48), mi(6,48), la(5,12), mi(6,12), la(5,12), mi(6,12), re(6,48)] seq+=[('kan',mi(5,12),re(5,12),'na',do(5,12),re(5,12),'shan',do(5,24),'hua',ti(4,24),'kai',la(4,72)),BL(24)] seq_g+=[soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_o+=[do(6,24),re(6,12),mi(6,12),re(6,12),do(6,12),ti(5,24)] laTi=[la(5,6),ti(5,6)] laTiX2=laTi+laTi laTiX4=laTiX2+laTiX2 seq_o+=laTiX4+[la(5,48)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] progress=ScoreDraft.TellDuration(seq_g) seq_b=[BL(progress-96), mi(3,48), la(3,48)] seq_p=[BL(progress-48), tong4(12), tong3(12), tong2(12), tong1(12)] perc_repeat=[dong(24), chi(24), cha(24), chi(24),dong(24), chi(24), cha(24), chi(24)] seq+=[('xiao', la(4,24), 'xiao', la(4,12), 'di', do(5,12), 'yi', re(5,24), 'zhen', mi(5,24), 'feng', re(5,12), mi(5,24),re(5,12), 'ya',re(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), fa(5,12), la(5,24), fa(5,24) ] seq_b+=[la(3,96), fa(3,24), re(3,48), fa(3,24)] seq_p+=perc_repeat seq+=[('man', la(4,24), 'man', la(4,12), 'di', do(5,12), 'zou', re(5,24), 'guo', mi(5,24), 'lai', re(5,12), mi(5,72)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24)] seq_b+=[la(3,96), soS(3,24), mi(3,48), soS(3,24)] seq_p+=perc_repeat seq+=[('qing', la(4,24), 'ni', la(4,12), do(5,12), 'xie', re(5,24), 'xie', mi(5,24), 'jiao', re(5,12), mi(5,24),re(5,12), 'ya',re(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), faS(5,12), la(5,24), fa(5,24) ] seq_b+=[la(3,96), faS(3,24), re(3,48), faS(3,24)] seq_p+=perc_repeat seq+=[('zan', mi(5,12), re(5,12), 'shi', do(5,12), re(5,12), 'ting', do(5,24), 'xia', ti(4,24), 'lai', la(4,72)), BL(24)] seq_g+=[soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[mi(4,48), ti(3,48), la(3,96)] seq_p+=[dong(24), chi(24), cha(24), chi(24),dong(24), chi(24), tong4(12), tong3(12), tong2(12), tong1(12)] progress_g=ScoreDraft.TellDuration(seq_g) progress_o=ScoreDraft.TellDuration(seq_o) line=('hai',la(5,12), so(5,12), 'shang', mi(5,12),'di',mi(5,12), 'lang',la(5,12), so(5,12), 'hua', mi(5,24)) line+=('kai',so(5,12), la(5,24), so(5,12), 'ya', mi(5,24), so(5,12),la(5,12)) seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24),la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[la(3,48), mi(3,48), la(3,48), mi(3,48)] seq_p+=perc_repeat seq_o+=[BL(progress_g-progress_o), la(6,48),mi(6,48)] seq_o+=[so(6,24),mi(6,12),re(6,12),mi(6,48)] line+=('wo', so(5,12), mi(5,12), 'cai', mi(5,12), 'dao', re(5,12), 'hai', do(5,24), 'bian', so(5,12), mi(5,12), 'lai', mi(5,72)) seq+=[line, BL(24)] seq_g+=[so(4,96), BK(72), do(5,12), mi(5,12), so(5,24), mi(5,24), soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24)] seq_b+=[do(4,48), so(3,48), mi(3,24), soS(3,48), mi(3,24)] seq_p+=perc_repeat seq_o+=[so(6,24),mi(6,12),re(6,12),do(6,24),re(6,12),so(6,12)] seq_o+=miFaX4+[mi(6,48)] seq+=[('yuan',la(4,24),'lai',la(4,12),do(5,12),'ni',re(5,24),'ye',mi(5,12),'ai',fa(5,12),'lang', re(5,12),mi(5,24),re(5,12),'hua',re(5,36)),BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), faS(5,12), la(5,24), fa(5,24) ] seq_b+=[la(3,48), mi(3,48), la(3,48), re(3,48)] seq_p+=perc_repeat seq_o+=[la(5,48), mi(6,48), la(5,12), mi(6,12), la(5,12), mi(6,12), re(6,48)] seq+=[('cai',mi(5,12),re(5,12),'dao',do(5,12),re(5,12),'hai',do(5,24),'bian',ti(4,24),'lai',la(4,72)),BL(24)] seq_g+=[soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[soS(3,48), mi(3,48), la(3,24), mi(3,48), la(3,24)] seq_p+=[dong(24), chi(24), cha(24), chi(24),dong(24), chi(24), tong4(12), tong3(12), tong2(12), tong1(12)] seq_o+=[do(6,24),re(6,12),mi(6,12),re(6,12),do(6,12),ti(5,24)] seq_o+=laTiX4+[la(5,48)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[la(3,48), mi(3,48), la(3,48), mi(3,48)] seq_p+=perc_repeat seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_b+=[la(3,48), mi(3,48), la(3,96)] seq_p+=perc_repeat seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[la(3,48), mi(3,48), la(3,48), mi(3,48)] seq_p+=perc_repeat seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_b+=[la(3,48), mi(3,48), la(3,96)] seq_p+=[dong(24), chi(24), cha(24), chi(24),dong(24), chi(24), tong4(12), tong3(12), tong2(12), tong1(12)] seq+=[('xiao', la(4,24), 'xiao', la(4,12), 'di', do(5,12), 'yi', re(5,24), 'pian', mi(5,24), 'yun', re(5,12), mi(5,24),re(5,12), 'ya',re(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), fa(5,12), la(5,24), fa(5,24) ] seq_b+=[la(3,96), fa(3,24), re(3,48), fa(3,24)] seq_p+=perc_repeat seq+=[('man', la(4,24), 'man', la(4,12), 'di', do(5,12), 'zou', re(5,24), 'guo', mi(5,24), 'lai', re(5,12), mi(5,72)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24)] seq_b+=[la(3,96), soS(3,24), mi(3,48), soS(3,24)] seq_p+=perc_repeat seq+=[('qing', la(4,24), 'ni', la(4,12), do(5,12), 'xie', re(5,24), 'xie', mi(5,24), 'jiao', re(5,12), mi(5,24),re(5,12), 'ya',re(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), faS(5,12), la(5,24), fa(5,24) ] seq_b+=[la(3,96), faS(3,24), re(3,48), faS(3,24)] seq_p+=perc_repeat seq+=[('zan', mi(5,12), re(5,12), 'shi', do(5,12), re(5,12), 'ting', do(5,24), 'xia', ti(4,24), 'lai', la(4,72)), BL(24)] seq_g+=[soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[mi(4,48), ti(3,48), la(3,96)] seq_p+=[dong(24), chi(24), cha(24), chi(24),dong(24), chi(24), tong4(12), tong3(12), tong2(12), tong1(12)] progress_g=ScoreDraft.TellDuration(seq_g) progress_o=ScoreDraft.TellDuration(seq_o) line=('shan',la(5,12), so(5,12), 'shang', mi(5,12),'di',mi(5,12), 'shan',la(5,12), so(5,12), 'hua', mi(5,24)) line+=('kai',so(5,12), la(5,24), so(5,12), 'ya', mi(5,24), so(5,12),la(5,12)) seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24),la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[la(3,48), mi(3,48), la(3,48), mi(3,48)] seq_p+=perc_repeat seq_o+=[BL(progress_g-progress_o), la(6,48),mi(6,48)] seq_o+=[so(6,24),mi(6,12),re(6,12),mi(6,48)] line+=('wo', so(5,12), mi(5,12), 'cai', mi(5,12), 'dao', re(5,12), 'shan', do(5,24), 'shang', so(5,12), mi(5,12), 'lai', mi(5,72)) seq+=[line, BL(24)] seq_g+=[so(4,96), BK(72), do(5,12), mi(5,12), so(5,24), mi(5,24), soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24)] seq_b+=[do(4,48), so(3,48), mi(3,24), soS(3,48), mi(3,24)] seq_p+=perc_repeat seq_o+=[so(6,24),mi(6,12),re(6,12),do(6,24),re(6,12),so(6,12)] seq_o+=miFaX4+[mi(6,48)] seq+=[('yuan',la(4,24),'lai',la(4,12),do(5,12),'ni',re(5,24),'ye',mi(5,12),'shi',fa(5,12),'shang', re(5,12),mi(5,24),re(5,12),'shan',re(5,36)),BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), re(5,12), faS(5,12), la(5,24), fa(5,24) ] seq_b+=[la(3,48), mi(3,48), la(3,48), re(3,48)] seq_p+=perc_repeat seq_o+=[la(5,48), mi(6,48), la(5,12), mi(6,12), la(5,12), mi(6,12), re(6,48)] seq+=[('kan',mi(5,12),re(5,12),'na',do(5,12),re(5,12),'shan',do(5,24),'hua',ti(4,24),'kai',la(4,72)),BL(24)] seq_g+=[soS(4,96), BK(72), ti(4,12), mi(5,12), soS(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[soS(3,48), mi(3,48), la(3,24), mi(3,48), la(3,24)] seq_p+=[dong(24), chi(24), cha(24), chi(24),dong(24), chi(24), tong4(12), tong3(12), tong2(12), tong1(12)] seq_o+=[do(6,24),re(6,12),mi(6,12),re(6,12),do(6,12),ti(5,24)] seq_o+=laTiX4+[la(5,48)] seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[la(3,48), mi(3,48), la(3,48), mi(3,48)] seq_p+=perc_repeat seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_b+=[la(3,48), mi(3,48), la(3,96)] seq_p+=perc_repeat seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 48), 'la', mi(5,36)), BL(12)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24)] seq_b+=[la(3,48), mi(3,48), la(3,48), mi(3,48)] seq_p+=perc_repeat seq+=[('la', la(5,24), 'la', la(5,12), 'la', ti(5,12), 'la', do(6,24), 'la', ti(5,24), 'la', la(5, 72)), BL(24)] seq_g+=[la(4,96), BK(72), do(5,12), mi(5,12), la(5,24), mi(5,24), la(4,96), BK(72), do(5,12), mi(5,12), do(5,48), BK(46), mi(5,46), BK(44), la(5,44)] seq_b+=[la(3,48), mi(3,48), la(3,96)] seq_p+=perc_repeat doc.sing(seq, ZhaoYingzi, track) doc.playNoteSeq(seq_g, Guitar, track_g) doc.playNoteSeq(seq_b, Bass, track_b) doc.playNoteSeq(seq_o, Ocarina, track_o) doc.playBeatSeq(seq_p, perc_list, track_p) doc.playBeatSeq(seq_e, effect_list, track_effect) doc.setTrackVolume(track_g, 0.5) doc.setTrackVolume(track_b, 0.5) doc.setTrackVolume(track_o, 0.5) doc.setTrackVolume(track_p, 0.5) doc.setTrackVolume(track_effect, 0.5) doc.meteor() doc.mixDown('TaLang.wav') ``` ================================================ FILE: docs/meteor/WuYa.md ================================================
# 无涯 ## Info * The song is from the Anime "Hitori no Shita:The Outcast Season 2" produced by Tencent Animation. * Original sung by: 醉雪 * Melody by: 钱襄 * Lyric by: 张汇泉 * Video published earlier on Bilibili: [https://www.bilibili.com/video/av20843105](https://www.bilibili.com/video/av20843105) * GePing voice-bank: http://utau.vocalover.com/ * 三色あやか, CVVCChinese:http://seesaawiki.jp/sanshoku/ ```python import ScoreDraft Freqs=[1.0, 9.0/8.0, 81.0/64.0, 4.0/3.0, 3.0/2.0, 27.0/16.0, 243.0/128.0] def note(octave, freq, duration): return (freq*(2.0**(octave-5.0)), duration) def do(octave=5, duration=48): return note(octave,Freqs[0],duration) def re(octave=5, duration=48): return note(octave,Freqs[1],duration) def mi(octave=5, duration=48): return note(octave,Freqs[2],duration) def fa(octave=5, duration=48): return note(octave,Freqs[3],duration) def so(octave=5, duration=48): return note(octave,Freqs[4],duration) def la(octave=5, duration=48): return note(octave,Freqs[5],duration) def ti(octave=5, duration=48): return note(octave,Freqs[6],duration) def BL(duration=48): return (-1.0, duration) def BK(duration=48): return (-1.0, -duration) FreqsC=Freqs[:] # FreqsF=[f*Freqs[5] for f in Freqs] FreqsF=[f*Freqs[3] for f in Freqs] Freqs[:]=FreqsF doc=ScoreDraft.MeteorDocument() doc.setTempo(120) GePing = ScoreDraft.GePing_UTAU() Ayaka = ScoreDraft.Ayaka_UTAU() Ayaka.setLyricConverter(ScoreDraft.CVVCChineseConverter) GuitarMute=ScoreDraft.RockMute() Guitar=ScoreDraft.AlansGuitar() Bass=ScoreDraft.Bass() Piano=ScoreDraft.Piano() BassDrum=ScoreDraft.BassDrum() Snare=ScoreDraft.Snare() perc_list=[BassDrum,Snare] def dong(duration=48): return (0,duration) def cha(duration=48): return (1,duration) def Bl(duration=48): return (-1,duration) track=doc.newBuf() track_gm=doc.newBuf() track_g=doc.newBuf() track_b=doc.newBuf() track_p=doc.newBuf() track_pi=doc.newBuf() def Chord(elems, duration, delay=0): ret=[] for elem in elems: ret+=[elem[0](elem[1], duration)] duration-=delay ret+=[BK(duration)] ret+=[BL(duration)] return ret def Repeat(x,t): ret=[] for i in range(t): ret+=x return ret seq_gm=Repeat( Repeat(Chord([(la,3), (mi,4), (la,4) ], 24),4)+Repeat(Chord([(do,4), (so,4), (do, 5)], 24),4) + Repeat(Chord([(re,4), (la,4), (re,5) ], 24),4)+Repeat(Chord([(mi,4), (ti,4), (mi, 5)], 24),4) ,2) seq_b=Repeat([la(2,96), do(3,96), re(3,96), mi(3,96)],2) seq_p=Repeat([dong(),cha()],8) seq_gm+=Repeat(Chord([(fa,4), (do,5), (fa,5)],12),4)+[BL(24)]+ Repeat(Chord([(mi,4), (ti,4), (mi,5)],12),4)+[BL(24)] seq_b+=[BL(144)] seq_p+=Repeat(Repeat([cha(12)],4)+[Bl(24)],2) seq=[BL(ScoreDraft.TellDuration(seq_gm))] seq+=[('meng',la(4,24),'li',la(4,24),'bu',la(4,24), 'zhi',la(4,24), 'liu',la(4,48), 'zhuan',so(4,24), 'liao', mi(4,24))] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('duo',la(4,24),'shao',la(4,48),'nian',re(5,96)), BL(24)] seq_gm+=Repeat(Chord([(re,4), (so,4), (la,4), (re,5) ], 24),8) seq_b+=Repeat([re(3,24),re(3,48),re(3,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('wang',mi(5,48), 'que', mi(5,24), re(5,24), 'qing', la(4,24), 'si', la(4,24), mi(5,48) )] seq_gm+=Repeat(Chord([(mi,4), (la,4), (ti,4), (mi,5) ], 24),8) seq_b+=Repeat([mi(3,24),mi(3,48),mi(3,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('chen',re(5,36),mi(5,12),re(5,24),'nian',so(4,72)), BL(48)] seq_gm+=Repeat(Chord([(re,4), (so,4), (la,4), (re,5) ], 24),8) seq_b+=Repeat([re(3,24),re(3,48),re(3,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('hui', la(4,48), 'mou', la(4,24), 'yi', la(4,48), 'pian', la(4,48)), BL(24)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) Freqs[:]=FreqsC seq+=[('wang', do(6,48), 'shi', ti(5,24), la(5,24), 'you', la(5,48), 'fu', so(5,24),la(5,24) )] seq_gm+=Repeat(Chord([(do,5), (fa,5), (so,5), (do,6) ], 24),8) seq_b+=Repeat([do(4,24),do(4,48),do(4,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('xian', la(5,144)), BL(48)] seq_g=[BL(ScoreDraft.TellDuration(seq_gm))] seq_g+=Chord([(la,4), (mi,5), (la,5),(re,6)], 96)+Chord([(do,5), (so,5), (do,6), (fa,6)], 96) seq_gm+=Repeat(Chord([(la,4), (re,5), (mi,5), (la,5) ], 24),4)+Repeat(Chord([(do,5), (fa,5), (so,5), (do,6) ], 24),4) seq_b+=[la(3,24),la(3,48),la(3,24),do(4,24),do(4,48),do(4,24)] seq_p+=Repeat([dong(),cha()],2) seq+=[BL(192)] seq_g+=Repeat(Chord([(re,5), (la,5), (re,6), (so,6)], 24),3)+ Chord([(mi,5), (ti,5), (mi,6), (la,6)], 120) seq_gm+=Repeat(Chord([(re,5), (so,5), (la,5), (re,6) ], 24),4)+Repeat(Chord([(mi,5), (la,5), (ti,5), (mi,6) ], 24),4) seq_b+=[re(4,24),re(4,48),re(4,24),mi(4,24),mi(4,48),mi(4,24)] seq_p+=Repeat([dong(),cha()],2) Freqs[:]=FreqsF seq+=[('zui',la(5,24), 'yan',la(5,48)), BL(24), ('xiao',la(5,24),'kan',la(5,48), 'chen', so(5,12), la(5,12))] seq_g+=Repeat(Repeat(Chord([(re,5), (mi,5), (la,5)],24),2)+[so(5,24), BK(12), la(5,12), la(4,24)],2) seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('shi',so(5,12),la(5,36),so(5,24), 'jian', so(5,96)), BL(24)] seq_g+=Repeat(Chord([(do,5), (re,5), (so,5)],24),2)+[mi(5,24), so(5,24), do(5,48), re(5,48)] seq_gm+=Repeat(Chord([(so,3), (do,4), (re,4), (so,4) ], 24),8) seq_b+=Repeat([so(2,24),so(2,48),so(2,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('he',so(5,24),la(5,24),'chu',so(5,24), mi(5,24), 'shi', mi(5,48), 'tao', re(5,24),mi(5,24))] seq_g+=Repeat(Chord([(re,5), (mi,5), (la,5)],24),2)+[so(5,24),la(5,24),mi(5,48),re(5,48)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=[la(2,24),la(2,48),la(2,24), mi(3,48), re(3,48)] seq_p+=Repeat([dong(),cha()],2) seq+=[('yuan',re(5,24),mi(5,120)),BL(48)] seq_g+=[mi(5,96), so(5,48),la(5,48)] seq_gm+=Repeat(Chord([(mi,4), (la,4), (ti,4), (mi,5) ], 24),8) seq_b+=Repeat([mi(3,24),mi(3,48),mi(3,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('qing', re(5,48), 'feng', mi(5,24), 'ji', re(5,48), 'du',mi(5,48)),BL(24)] seq_g+=[re(5,48),mi(5,48),so(5,48),la(5,48)] seq_gm+=Repeat(Chord([(re,4), (so,4), (la,4), (re,5) ], 24),8) seq_b+=Repeat([re(3,24),re(3,48),re(3,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('shui', mi(5,12), so(5,36), 'yu', mi(5,48), 'wo', re(5,24), ti(4,24), 'liu', ti(4,24),la(4,24))] seq_g+=[so(5,48),mi(5,48),re(5,48),so(5,48)] seq_gm+=Repeat(Chord([(mi,4), (la,4), (ti,4), (mi,5) ], 24),8) seq_b+=Repeat([mi(3,24),mi(3,48),mi(3,24)],2) seq_p+=Repeat([dong(),cha()],2) Freqs[:]=FreqsC seq+=[('lian', re(5,144)), BL(48)] seq_g+=Chord([(re,4), (la,4), (re,5),(so,5)], 96)+Chord([(mi,4), (ti,4), (mi,5), (la,5)], 96) seq_gm+=Repeat(Chord([(re,4), (so,4), (la,4), (re,5) ], 24),4)+Repeat(Chord([(mi,4), (la,4), (ti,4), (mi,5) ], 24),4) seq_b+=[re(3,24),re(3,48),re(3,24),mi(3,24),mi(3,48),mi(3,24)] seq_p+=Repeat([dong(),cha()],2) seq+=[BL(192)] seq_g+=Repeat(Chord([(so,4), (re,5), (so,5), (do,6)], 24),3)+ Chord([(la,4), (mi,5), (la,5), (re,6)], 120) seq_gm+=Repeat(Chord([(so,4), (do,5), (re,4), (so,5) ], 24),4)+Repeat(Chord([(la,4), (re,5), (mi,5), (la,5) ], 24),4) seq_b+=[so(3,24),so(3,48),so(3,24),la(3,24),la(3,48),la(3,24)] seq_p+=Repeat([dong(),cha()],2) Freqs[:]=FreqsF seq+=[('yuan', re(5,12), mi(5,36),re(5,24), 'qi',re(5,72)), BL(48) ] seq_pi=[BL(ScoreDraft.TellDuration(seq_gm))] seq_pi+=Chord([(mi,4), (la,4), (ti,4), (mi,5) ], 72)+Chord([(re,4), (so,4), (la,4), (re,5) ], 72)+[BL(48) ] seq_gm+=Repeat(Chord([(mi,3), (la,3), (ti,3), (mi,4) ], 24),3)+Repeat(Chord([(re,3), (so,3), (la,3), (re,4) ], 24),5) seq_b+=[mi(2,24),mi(2,48),re(2,48),re(2,24),re(2,24),re(2,24)] seq_p+=Repeat([dong(),cha()],2) seq+=[('yuan', re(5,12), mi(5,36),la(4,24), 'mie',la(4,72)), BL(48) ] seq_pi+=Chord([(la,3), (re,4), (mi,4), (la,4) ], 72)+Chord([(re,4), (so,4), (la,4), (re,5) ], 72)+[BL(48) ] seq_gm+=Repeat(Chord([(la,2), (re,3), (mi,3), (la,3) ], 24),3)+Repeat(Chord([(re,3), (so,3), (la,3), (re,4) ], 24),5) seq_b+=[la(1,24),la(1,48),re(2,48),re(2,24),re(2,24),re(2,24)] seq_p+=Repeat([dong(),cha()],2) Freqs[:]=FreqsC seq+=[('yi', so(5,48), 'mu', la(5,48), 'mu', la(5,24), 'chong', la(5,12), ti(5,24), la(5,12))] seq_pi+=Chord([(re,4), (so,4), (la,4), (re,5)], 48)+[BL(48)]+Chord([(mi,4), (la,4), (ti,4), (mi,5)], 48)+Chord([(so,4), (do,5), (re,5), (so,5)], 48) seq_gm+=Repeat(Chord([(re,3), (so,3), (la,3), (re,4)], 24),4)+Repeat(Chord([(mi,3), (la,3), (ti,3), (mi,4)], 24),2)+Repeat(Chord([(so,3), (do,4), (re,4), (so,4)], 24),2) seq_b+=[re(2,24),re(2,48),re(2,24),mi(2,48),so(2,48)] seq_p+=Repeat([dong(),cha()],2) seq+=[('yan', la(5,144)), BL(72)] seq_pi+=Chord([(la,4), (re,5), (mi,5), (la,5) ], 96)+[BL(96)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) seq+=[('hua', la(5,48),so(5,24), 'xie',so(5,72)), BL(48) ] seq_pi+=Chord([(mi,4), (la,4), (ti,4), (mi,5)],72)+Chord([(so,4), (do,5), (re,5), (so,5) ], 72)+[BL(48)] seq_gm+=Repeat(Chord([(mi,3), (la,3), (ti,3), (mi,4) ], 24),3)+Repeat(Chord([(so,3), (do,4), (re,4), (so,4) ], 24),5) seq_b+=[mi(2,24),mi(2,48),so(2,48),so(2,24),so(2,24),so(2,24)] seq_p+=Repeat([dong(),cha()],2) seq+=[('hua', la(5,48),do(6,24), 'kai',do(6,72)), BL(48) ] seq_pi+=Chord([(la,4), (re,5), (mi,5), (la,5) ], 72)+Chord([(do,5), (fa,5), (so,5), (do,6) ], 72)+[BL(48)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),3)+Repeat(Chord([(do,4), (fa,4), (so,4), (do,5) ], 24),5) seq_b+=[la(2,24),la(2,48),do(3,48),do(3,24),do(3,24),do(3,24)] seq_p+=Repeat([dong(),cha()],2) seq+=[('yi', re(6,48), 'nian', re(6,48), 'nian', do(6,24), 'geng', re(6,24), do(6,24))] seq_pi+=Chord([(re,4), (so,4), (la,4), (re,5)], 48)+[BL(48)]+Chord([(so,4), (do,5), (re,5), (so,5)], 48)+Chord([(la,4), (re,5), (mi,5), (la,5)], 48) seq_gm+=Repeat(Chord([(re,3), (so,3), (la,3), (re,4)], 24),4)+Repeat(Chord([(so,3), (do,4), (re,4), (so,4)], 24),2)+Repeat(Chord([(la,3), (re,4), (mi,4), (la,4)], 24),2) seq_b+=[re(2,24),re(2,48),re(2,24),so(2,48),la(2,48)] seq_p+=Repeat([dong(),cha()],2) seq+=[('die', re(6,24), mi(6,24), re(6,24), mi(6,24),re(6,24), mi(6,24),re(6,24), mi(6,24)), BL(24)] the_chord=[(ti,4), (mi,5), (la,5), (ti,5)] seq_pi+=Chord(the_chord, 36)+Chord(the_chord, 12)+Repeat(Chord(the_chord, 24),2)+Repeat(Chord(the_chord, 12),4)+Repeat(Chord(the_chord, 24),2) seq_gm+=Repeat(Chord([(ti,3), (mi,4), (la,4), (ti,4)], 24),8) seq_b+=[ti(2,36),ti(2,12),ti(2,24),ti(2,24),ti(2,12),ti(2,12),ti(2,12),ti(2,12),ti(2,24),ti(2,24)] seq_p+=[dong(36), dong(12),dong(24),dong(24), cha(12),cha(12),cha(12),cha(12),cha(24),cha(24)] doc.sing(seq, GePing, track) line= ("zheng", re(6,24), "yue", do(6,48), "li", re(6,24), "cai", mi(6,36), so(6,12), "hua", mi(6,24), la(5,24)) seq_pi+=[la(4,96),BK(96), re(5,72), do(5,12),re(5,12), la(4,96), BK(96), mi(5,36), so(5,12), mi(5,24),la(4,24)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line+=("wu", re(6,24), "you", do(6,48), "hua", re(6,24), "cai", mi(6,24), do(6,12), re(6,12), mi(6,24), BL(24)) seq = [line] seq_pi+=[la(4,96),BK(96), re(5,72), do(5,12),re(5,12), la(4,96), BK(96), mi(5,24), do(5,12), re(5,12),mi(5,48)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line= ("er", mi(6,12), so(6,12), "yue", la(6,48), "jian", do(7,24), "cai", la(6, 48), "hua", so(6,24), mi(6,24)) seq_pi+=[re(5,96), BK(96), la(5,72), so(5,12), so(5,12), re(5,96), BK(96), so(5,24),mi(5,24),re(5,24),mi(5,24)] seq_gm+=Repeat(Chord([(re,4), (so,4), (la,4), (re,5) ], 24),8) seq_b+=Repeat([re(3,24),re(3,48),re(3,24)],2) seq_p+=Repeat([dong(),cha()],2) line+= ("hua", la(6,24), "you", mi(6,48), "zheng", re(6,12), mi(6,12), "kai", do(6,24), BL(24)) seq += [line] line=("er", do(6,12), re(6,12), "yue", mi(6,12), so(6,12)) seq_pi+=[la(4,96),BK(96), re(5,36), mi(5,12),re(5,24), do(5,24), la(4,12),do(5,12),la(4,12),so(4,12),la(4,48)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line+=("jian", mi(6,48), "cai", re(6,24), "hua", do(6,24),"hua", la(5,24), "you", do(6,48), "zheng", la(5,12), do(6,12)) seq_pi+=[la(4,96),BK(96), mi(5,72), re(5,12),do(5,12), la(4,24),do(5,48),do(4,24)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line+=("kai", la(5,96), BL(96)) seq += [line] seq_pi+=Repeat(Chord([(la,4), (re,5), (mi,5)],24)+Chord([(la,4), (re,5), (mi,5)],12)+Chord([(la,4), (re,5), (mi,5)],12)+Chord([(la,4), (re,5), (mi,5)],24)+Chord([(la,4), (re,5), (mi,5)],24),2) seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=[la(2,36),la(2,12),la(2,24),la(2,24),la(2,12),la(2,12),la(2,12),la(2,12),la(2,24),la(2,24)] seq_p+=[dong(36), dong(12),dong(24),dong(24), cha(12),cha(12),cha(12),cha(12),cha(24),cha(24)] line= ("san", re(6,24), "yue", do(6,48), "li", re(6,24), "tao", mi(6,36), so(6,12), "hua", mi(6,24), la(5,24)) seq_pi+=[la(4,96),BK(96), re(5,72), do(5,12),re(5,12), la(4,96), BK(96), mi(5,36), so(5,12), mi(5,24),la(4,24)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line+=("hong", re(6,24), "you", do(6,48), "si", re(6,24), "hai", mi(6,24), do(6,12), re(6,12), mi(6,24), BL(24)) seq += [line] seq_pi+=[la(4,96),BK(96), re(5,72), do(5,12),re(5,12), la(4,96), BK(96), mi(5,24), do(5,12), re(5,12),mi(5,48)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line= ("si", mi(6,12), so(6,12), "yue", la(6,48), "jian", do(7,24), "pu", la(6, 48), "tao", so(6,24), mi(6,24)) seq_pi+=[re(5,96), BK(96), la(5,72), so(5,12), so(5,12), re(5,96), BK(96), so(5,24),mi(5,24),re(5,24),mi(5,24)] seq_gm+=Repeat(Chord([(re,4), (so,4), (la,4), (re,5) ], 24),8) seq_b+=Repeat([re(3,24),re(3,48),re(3,24)],2) seq_p+=Repeat([dong(),cha()],2) line+= ("jia", la(6,24), "you", mi(6,48), "shang", re(6,12), mi(6,12), "cai", do(6,24), BL(24)) seq += [line] line=("si", do(6,12), re(6,12), "yue", mi(6,12), so(6,12)) seq_pi+=[la(4,96),BK(96), re(5,36), mi(5,12),re(5,24), do(5,24), la(4,12),do(5,12),la(4,12),so(4,12),la(4,48)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line+=("jian", mi(6,48), "pu", re(6,24), "tao", do(6,24),"jia", la(5,24), "you", do(6,48), "shang", la(5,12), do(6,12)) seq_pi+=[la(4,96),BK(96), mi(5,72), re(5,12),do(5,12), la(4,24),do(5,48),do(4,24)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_p+=Repeat([dong(),cha()],2) line+=("cai", la(5,96), BL(96)) seq += [line] seq_g+=[BL(ScoreDraft.TellDuration(seq_gm)-ScoreDraft.TellDuration(seq_g))] seq_g+=[BL(144), do(6,12), re(6,12), mi(6,12), so(6,12)] seq_pi+=Repeat(Chord([(la,4), (re,5), (mi,5)],24)+Chord([(la,4), (re,5), (mi,5)],12)+Chord([(la,4), (re,5), (mi,5)],12)+Chord([(la,4), (re,5), (mi,5)],24)+Chord([(la,4), (re,5), (mi,5)],24),2) seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=[la(2,36),la(2,12),la(2,24),la(2,24),la(2,12),la(2,12),la(2,12),la(2,12),la(2,24),la(2,24)] seq_p+=[dong(36), dong(12),dong(24),dong(24), cha(12),cha(12),cha(12),cha(12),cha(24),cha(24)] seq_g+=[mi(6,48), re(6,24), do(6,24), la(5,24), do(6,48), la(5,12), do(6,12)] seq_pi+=[la(4,96),BK(96), mi(5,72), re(5,12),do(5,12), la(4,24),do(5,48),do(4,24)] seq_gm+=Repeat(Chord([(la,3), (re,4), (mi,4), (la,4) ], 24),8) seq_b+=Repeat([la(2,24),la(2,48),la(2,24)],2) seq_g+=[la(5,96)] seq_pi+=Chord([(la,4), (re,5), (mi,5)],96) seq_gm+=Chord([(la,3), (re,4), (mi,4), (la,4) ], 96) seq_b+=[la(2,96)] doc.sing(seq, Ayaka, track) doc.playNoteSeq(seq_gm, GuitarMute, track_gm) doc.playNoteSeq(seq_g,Guitar, track_g) doc.playNoteSeq(seq_pi,Piano, track_pi) doc.playNoteSeq(seq_b,Bass, track_b) doc.playBeatSeq(seq_p, perc_list, track_p) doc.setTrackVolume(track_gm, 0.5) doc.setTrackVolume(track_g, 0.5) doc.setTrackVolume(track_pi, 0.5) doc.setTrackVolume(track_b, 0.5) doc.setTrackVolume(track_p, 0.5) doc.meteor() doc.mixDown('WuYa.wav') ``` ================================================ FILE: docs/meteor/meteor.js ================================================ var blackPos=[1, 2, 4, 5, 6]; var whitePitchs=[0, 2, 4, 5, 7, 9, 11]; var blackPitchs=[1, 3, 6, 8, 10]; var keyPos = [0.5, 1.0, 1.5, 2.0, 2.5, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5]; var s_ColorBank = ["#418CF0","#FCB441","#DF3A02","#056492","#BFBFBF","#1A3B69","#FFE382","#129CDD","#CA6B4B","#005CDB","#F3D288","#506381","#F1B9A8","#E0830A","#7893BE"]; InStream = function(buffer) { this.offset = 0; this.view = new DataView(buffer); }; InStream.prototype.GetInt32=function() { var data = this.view.getInt32(this.offset,true); this.offset+=4; return data; } InStream.prototype.GetUint32=function() { var data = this.view.getUint32(this.offset,true); this.offset+=4; return data; } InStream.prototype.GetFloat32=function() { var data = this.view.getFloat32(this.offset,true); this.offset+=4; return data; } InStream.prototype.GetUint8=function() { var data = this.view.getUint8(this.offset,true); this.offset+=1; return data; } function Utf8ArrayToStr(array) { var out, i, len, c; var char2, char3; out = ""; len = array.length; i = 0; while(i < len) { c = array[i++]; switch(c >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: // 0xxxxxxx out += String.fromCharCode(c); break; case 12: case 13: // 110x xxxx 10xx xxxx char2 = array[i++]; out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); break; case 14: // 1110 xxxx 10xx xxxx 10xx xxxx char2 = array[i++]; char3 = array[i++]; out += String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)); break; } } return out; } InStream.prototype.GetString=function(len) { var utf8Arr=new Array(); for (var pos=0; pos= s_ColorBank.length) bankRef = 0; } } for (var singing of this.singings) { if (this.SingerColorMap[singing.singerId]==undefined) { this.SingerColorMap[singing.singerId]=s_ColorBank[bankRef]; bankRef++; if (bankRef >= s_ColorBank.length) bankRef = 0; } } for (var note of this.notes) { if (this.InstColorMap[note.instrumentId]==undefined) { this.InstColorMap[note.instrumentId]=s_ColorBank[bankRef]; bankRef++; if (bankRef >= s_ColorBank.length) bankRef = 0; } } }; Meteor.prototype.draw_key = function(left, right, top, bottom, lineWidth, isBlack=false) { if (isBlack) { this.canvas.fillStyle = '#000000'; this.canvas.strokeStyle ='#FFFFFF'; } else { this.canvas.fillStyle = '#FFFFFF'; this.canvas.strokeStyle ='#000000'; } this.canvas.lineWidth=lineWidth; this.canvas.beginPath(); this.canvas.moveTo(left + this.cornerSize, top); this.canvas.lineTo(right - this.cornerSize, top); this.canvas.lineTo(right, top + this.cornerSize); this.canvas.lineTo(right, bottom - this.cornerSize); this.canvas.lineTo(right -this.cornerSize, bottom); this.canvas.lineTo(left + this.cornerSize, bottom); this.canvas.lineTo(left, bottom - this.cornerSize); this.canvas.lineTo(left, top + this.cornerSize); this.canvas.lineTo(left + this.cornerSize, top); this.canvas.closePath(); this.canvas.fill(); this.canvas.stroke(); }; Meteor.prototype.draw_flash = function(centerx, centery, radius, color, alpha) { var gradient = this.canvas.createRadialGradient(centerx, centery, 0.0, centerx, centery, radius); gradient.addColorStop(0,color); gradient.addColorStop(1,"#000000"); this.canvas.arc(centerx, centery, radius, 0, 2 * Math.PI); this.canvas.fillStyle = gradient; this.canvas.globalAlpha = alpha; this.canvas.fill(); this.canvas.globalAlpha = 1.0; }; function GetIntervalId(sublists, v) { if (v=sublists.subLists.length) id = sublists.subLists.length -1; return id; }; Meteor.prototype.draw = function(currentTime) { this.canvas.fillStyle = "#000000"; this.canvas.fillRect(0, 0, this.canvas.canvas.width, this.canvas.canvas.height); var note_inTime = currentTime; var note_intervalId = GetIntervalId(this.notes_sublists, note_inTime); var note_outTime = note_inTime - this.showTime; var note_intervalId_min = GetIntervalId(this.notes_sublists, note_outTime); /// draw meteors this.canvas.globalCompositeOperation="lighter"; // notes if (this.notes_sublists.subLists.length>0) { var visiableNotes=new Set(); for (var i = note_intervalId_min; i <= note_intervalId; i++) { var sublist= this.notes_sublists.subLists[i]; for (var j = 0; j < sublist.length; j++) { var note = this.notes[sublist[j]]; if (note.start note_outTime) visiableNotes.add(note); } } for (var note of visiableNotes) { var startY = this.canvas.canvas.height- this.whiteKeyHeight- (note.start - note_inTime) / -this.showTime* (this.canvas.canvas.height - this.whiteKeyHeight); var endY = this.canvas.canvas.height- this.whiteKeyHeight- (note.end - note_inTime) / -this.showTime* (this.canvas.canvas.height - this.whiteKeyHeight); var pitch = note.pitch; var octave = 0; while (pitch < 0) { pitch += 12; octave--; } while (pitch >= 12) { pitch -= 12; octave++; } var x = this.canvas.canvas.width*0.5 + (octave*7.0 + keyPos[pitch])*this.whiteKeyWidth; var color=this.InstColorMap[note.instrumentId]; this.canvas.beginPath(); this.canvas.moveTo(x, startY); this.canvas.lineTo(x + this.meteorHalfWidth, startY+this.meteorHalfWidth); this.canvas.lineTo(x, endY); this.canvas.lineTo(x - this.meteorHalfWidth, startY+this.meteorHalfWidth); this.canvas.closePath(); var gradient = this.canvas.createLinearGradient(x, startY, x, endY); gradient.addColorStop(0,color); gradient.addColorStop(1,"#000000"); this.canvas.fillStyle = gradient; this.canvas.fill(); } } // beats if (this.beats_sublists.subLists.length>0) { var beat_intervalId = GetIntervalId(this.beats_sublists, note_inTime); var sublist= this.beats_sublists.subLists[beat_intervalId]; for (var i = 0; i < sublist.length; i++) { var beat = this.beats[sublist[i]]; var start = beat.start; var end = beat.end; // limting percussion flash time if (end - start > this.percussion_flash_limit) end = start + this.percussion_flash_limit; if (note_inTime >= start && note_inTime <= end) { var centerx = beat.centerX*this.canvas.canvas.width; var centery = beat.centerY*(this.canvas.canvas.height - this.whiteKeyHeight); var radius = this.canvas.canvas.width*this.percussion_flash_size_factor; var color=this.PercColorMap[beat.percId]; var alpha = (end - note_inTime) / (end - start); this.draw_flash(centerx, centery, radius, color, alpha); } } } // singing if (this.singing_sublists.subLists.length>0) { var singing_intervalId = GetIntervalId(this.singing_sublists, note_inTime); var singing_intervalId_min = GetIntervalId(this.singing_sublists, note_outTime); var visiableNotes=new Set(); for (var i = singing_intervalId_min; i <= singing_intervalId; i++) { var sublist= this.singing_sublists.subLists[i]; for (var j = 0; j < sublist.length; j++) { var note = this.singings[sublist[j]]; if (note.start note_outTime) visiableNotes.add(note); } } var pixelPerPitch = this.whiteKeyWidth*7.0 / 12.0; for (var note of visiableNotes) { var startY = this.canvas.canvas.height- this.whiteKeyHeight- (note.start - note_inTime) / -this.showTime* (this.canvas.canvas.height - this.whiteKeyHeight); var endY = this.canvas.canvas.height- this.whiteKeyHeight- (note.end - note_inTime) / -this.showTime* (this.canvas.canvas.height - this.whiteKeyHeight); var color=this.SingerColorMap[note.singerId]; var num_pitches = note.pitch.length; this.canvas.beginPath(); if (0=0; i--) { var x=note.pitch[i]*pixelPerPitch+this.canvas.canvas.width*0.5+this.whiteKeyWidth*0.5; var k=i/(num_pitches - 1); var y=startY*(1.0 - k) + endY*k; this.canvas.lineTo(x+this.singing_half_width, y); } this.canvas.closePath(); var gradient = this.canvas.createLinearGradient(x, startY, x, endY); gradient.addColorStop(0,color); gradient.addColorStop(1,"#000000"); this.canvas.fillStyle = gradient; this.canvas.fill(); var x=note.pitch[0]*pixelPerPitch+this.canvas.canvas.width*0.5; this.canvas.fillStyle=color; this.canvas.font=this.fontSize.toFixed(0)+"px sans-serif"; this.canvas.fillText(note.lyric,x+this.singing_half_width,startY); } } /// draw keyboard this.canvas.globalCompositeOperation="source-atop"; var center=this.canvas.canvas.width*0.5; var octaveWidth = this.whiteKeyWidth*7.0; var minOctave = -Math.ceil(center/octaveWidth); var maxOctave = Math.floor(center/octaveWidth); var numKeys = (maxOctave - minOctave + 1) * 12; var indexShift = -minOctave * 12; var pressed = new Array(numKeys); for (var i=0;i0) { var sublist= this.notes_sublists.subLists[note_intervalId]; for (var i = 0; i < sublist.length; i++) { var note = this.notes[sublist[i]]; var start = note.start; var end = note.end; end -= (end-start)*0.1; if (note_inTime >= start && note_inTime <= end) { var index = note.pitch + indexShift; if (index >= 0 && index < numKeys) { pressed[index] = true; } } } } for (var i = minOctave; center + i*octaveWidth < this.canvas.canvas.width; i++) { var octaveLeft = center + i*octaveWidth; for (var j = 0; j < 7; j++) { var index = whitePitchs[j] + i * 12 + indexShift; var keyPressed = pressed[index]; var left = octaveLeft + j*this.whiteKeyWidth; var right = left + this.whiteKeyWidth; var bottom = keyPressed ? this.canvas.canvas.height- this.whiteKeyPressedDelta : this.canvas.canvas.height; var top = this.canvas.canvas.height- this.whiteKeyHeight; this.draw_key(left, right, top, bottom, keyPressed ? this.pressedLineWidth : 1.0); } for (var j = 0; j < 5; j++) { var index = blackPitchs[j] + i * 12 + indexShift; var keyPressed = pressed[index]; var keyCenter = octaveLeft + blackPos[j] * this.whiteKeyWidth; var left = keyCenter - this.blackKeyWidth / 2.0; var right = keyCenter + this.blackKeyWidth / 2.0; var bottom = keyPressed ? this.canvas.canvas.height - this.whiteKeyHeight + this.blackKeyHeight - this.blackKeyPressedDelta : this.canvas.canvas.height - this.whiteKeyHeight + this.blackKeyHeight; var top = this.canvas.canvas.height - this.whiteKeyHeight; this.draw_key( left, right, top, bottom, keyPressed ? this.pressedLineWidth : 1.0, true); } } } Meteor.prototype.animationLoop = function() { var that = this; requestAnimationFrame( function() { that.animationLoop() }); if (this.audio!=undefined) this.draw(this.audio.currentTime); else { this.draw((performance.now()-this.startTime)*0.001); if (this.capturer!=undefined) { this.capturer.capture(this.canvas.canvas); } } }; ================================================ FILE: docs/meteor/ouchi.md ================================================
# この素晴らしい世界に祝福を!2 ED/おうちに帰りたい ## Info * The song is from Anime この素晴らしい世界に祝福を!2 produced by Studio DEEN. * Originally sung by: 雨宮天, 高橋李依, 茅野愛衣 * Melody/Lyric by:  佐藤良成 * Video published earlier on Bilibili: [https://www.bilibili.com/video/av19520577](https://www.bilibili.com/video/av19520577) * 呗音デフォ子 comes with the software UTAU * 三色あやか 連続音V2.0: [https://bowlroll.net/file/69898](https://bowlroll.net/file/69898) ```python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.MeteorDocument() uta= ScoreDraft.uta_UTAU() Ayaka= ScoreDraft.Ayaka2_UTAU() Ayaka.setLyricConverter(ScoreDraft.JPVCVConverter) uta.tune('pan -0.5') Ayaka.tune('pan 0.5') # All instrument samples from https://freewavesamples.com/ guitar = ScoreDraft.JazzGuitar() bass = ScoreDraft.Bass() harmonica = ScoreDraft.Harmonica() BassDrum=ScoreDraft.BassDrum() ClosedHitHat = ScoreDraft.ClosedHitHat() perc_list= [BassDrum, ClosedHitHat] def dong(duration=48): return (0,duration) def chi(duration=48): return (1,duration) def faS(octave=5, duration=48): return note(octave,Freqs[6],duration) def soS(octave=5, duration=48): return note(octave,Freqs[8],duration) track=doc.newBuf() track_g=doc.newBuf() track_b=doc.newBuf() track_h=doc.newBuf() track_p=doc.newBuf() drum_repeat = [dong(24), chi(24), dong(24), chi(24), dong(24), chi(24), dong(24), chi(24)] seq_guitar = [ do(7, 96), ti(6,48), la(6,24), so(6,24), BK(192)] seq_guitar += [ do(5, 96), BK(72), mi(6,24), so(6,24), so(5,24), mi(4, 96), BK(72), ti(5,24), mi(6,24), mi(5,24) ] seq_bass = [do(4, 96), mi(3,96)] seq_drum = [] seq_drum += drum_repeat seq_guitar += [la(6,24), do(7,48), la(6,24), so(6,96), BK(192)] seq_guitar += [fa(5,96), BK(48), do(6,48), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica = [BL(192*2), do(7,24), la(6,24), so(6,24), mi(6,24), re(6,24), do(6,24), mi(6,48)] seq_guitar += [fa(5,48), do(6,48), mi(5,48), mi(4,48)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [do(6,48), do(6,24), la(5,24), do(6,96)] seq_guitar += [re(5,48), so(4,48), do(5,96), BK(72), mi(5,12), so(5,12), do(6,48)] seq_bass += [re(4, 48), so(3,48), do(4,96)] seq_drum += drum_repeat doc.sing([BL(192*4)], uta, track) seq= [('な', so(4,24), 'に', do(5,24), 'も', do(5,24), 'い', re(5,24), 'わ', mi(5,24), 'ず', so(5,24)), BL(24)] seq+= [('に', so(5,24), 'い', la(5,24), 'え', do(6,24), 'うぉ', do(6,24), 'で', la(5,24), 'て', so(5,48)), BL(48)] seq+= [('こ', la(5,24), 'ん', do(6,24), 'な', do(6,24), 'と', la(5,24), 'こ', so(5,24), 'ま', so(5,24), 'で', mi(5,36)), BL(12)] seq+= [('き', re(5,24), 'た', do(5,24), 'け', re(5,24), 'れ', mi(5,24), 'ど', re(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(96), fa(5,36), do(6,60), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), la(5,48), so(4,96), BK(72), ti(4,12), re(5,12), so(5,24), re(5,24)] seq_bass += [ re(4, 96), so(3,96)] seq_drum += drum_repeat seq+= [('ひ', so(4,24), 'ぐ', do(5,24), 'れ', do(5,24), 'と', re(5,24), 'と', mi(5,24), 'も', so(5,24)), BL(24)] seq+= [('に', so(5,24), 'な', la(5,24), 'き', do(6,24), 'む', do(6,24), 'し', la(5,24), 'が', so(5,48)), BL(48)] seq+= [('こ', la(5,24), 'こ', do(6,24), 'ろ', do(6,24), 'ぼ', la(5,24), 'そ', so(5,24), 'い', so(5,24), 'と', mi(5,36)), BL(12)] seq+= [('べ', re(5,24), 'そ', mi(5,24), 'うぉ', mi(5,24), 'か', re(5,24), 'く', do(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,36), do(6,60), mi(5,48), BK(48), so(5,48), do(5,48), BK(48), so(5,48), BK(48), do(6,48) ] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,36), BK(36), la(5,36), ti(4, 60), BK(48), so(5,48), do(5,96), BK(72), mi(5,12), so(5,12), do(6,48)] seq_bass += [re(4, 48), so(3,48), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('あ', so(4,24), 'か', do(5,24), 'く', do(5,24), 'そ', re(5,24), 'ま', mi(5,24), 'る', so(5,24)), BL(24)] seq+= [('ま', so(5,24), 'ち', la(5,24), 'の', do(6,24), 'そ', do(6,24), 'ら', la(5,24), 'うぉ', so(5,48)), BL(48)] seq+= [('か', la(5,24), 'ら', do(6,24), 'す', do(6,24), 'が', la(5,24), 'な', so(5,24), 'い', so(5,24), 'て', mi(5,36)), BL(12)] seq+= [('い', re(5,24), 'き', do(5,24), 'す', re(5,24), 'ぎ', mi(5,24), 'る', re(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(96), fa(5,36), do(6,60), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), la(5,48), so(4,96), BK(72), ti(4,12), re(5,12), so(5,24), re(5,24)] seq_bass += [ re(4, 96), so(3,96)] seq_drum += drum_repeat seq+= [('み', so(4,24), 'ち', do(5,24), 'に', do(5,24), 'の', re(5,24), 'び', mi(5,24), 'る', so(5,24)), BL(24)] seq+= [('な', so(5,24), 'が', la(5,24), 'い', do(6,24), 'か', do(6,24), 'げ', la(5,24), 'が', so(5,48)), BL(48)] seq+= [('は', la(5,24), 'や', do(6,24), 'く', do(6,24), 'か', la(5,24), 'え', so(5,24), 'ろ', so(5,24), 'と', mi(5,36)), BL(12)] seq+= [('そ', re(5,24), 'で', mi(5,24), 'うぉ', mi(5,24), 'ひ', re(5,24), 'く', do(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,36), do(6,60), mi(5,48), BK(48), so(5,48), do(5,48), BK(48), so(5,48), BK(48), do(6,48) ] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,36), BK(36), la(5,36), ti(4, 60), BK(48), so(5,48), do(5,96), BK(72), mi(5,12), so(5,12), do(6,48)] seq_bass += [re(4, 48), so(3,48), do(4,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq = [('お', la(5,24), 'さ', do(6,48), 'か', la(5,24), 'な', do(6,48), 'うぉ', la(5,36)), BL(12)] seq +=[('や', so(5,24), 'く', mi(5,24), 'に', so(5,24), 'お', la(5,24), 'い', so(5,48), BL(48)) ] seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), la(5,12), do(6,48), BK(48), mi(6,48), la(5,96), BK(72), do(6,24), mi(6,48)] seq_bass += [fa(3,96), la(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [mi(4,48), BK(48), so(5,48), ti(5,48), do(5,96), BK(72), re(5,12), mi(5,12), so(5,24), mi(5,24)] seq_bass += [mi(3,96), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq =[('ば', la(5,24), 'ん', do(6,48), 'ご', la(5,24), 'は', do(6,24), 'ん', do(6,24), 'の', la(5,36)), BL(12)] seq +=[('い', so(5,24), 'い', mi(5,24), 'に', re(5,24), 'お', re(5,24), 'い', re(5,48), BL(48)) ] seq_harmonica += [BL(192)] seq_guitar += [fa(5,96), BK(60), la(5,12), do(6,48), BK(48), mi(6,48), faS(5,96), BK(72), do(6,24), mi(6,48)] seq_bass += [fa(3,96), faS(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [so(5,48), BK(48), ti(5,48), re(5,48), BK(48), so(5,48), so(4,24), so(5,12), re(5,12), so(4,48)] seq_bass += [re(4,96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq= [('お', so(4,24), 'な', do(5,24), 'か', do(5,24), 'の', re(5,24), 'む', mi(5,24), 'し', so(5,24)), BL(24)] seq+= [('も', so(5,24), 'な', la(5,24), 'き', do(6,24), 'だ', do(6,24), 'し', la(5,24), 'た', so(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('い', la(5,24), 'じ', do(6,24), 'うぉ', do(6,24), 'は', la(5,24), 'る', so(5,24), 'の', so(5,24), 'も', mi(5,36)), BL(12)] seq+= [('あ', re(5,24), 'き', do(5,24), 'て', re(5,24), 'ひ', mi(5,24), 'た', re(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(96), fa(5,36), do(6,60), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), la(5,48), so(4,96), BK(72), ti(4,12), re(5,12), so(5,24), re(5,24)] seq_bass += [ re(4, 96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq= [('い', so(4,24), 'ま', do(5,24), 'す', do(5,24), 'ぐ', re(5,24), 'ご', mi(5,24), 'め', so(5,12), 'ん', so(5,12)), BL(24)] seq+= [('と', so(5,24), 'あ', la(5,24), 'や', do(6,24), 'ま', do(6,24), 'あ', re(6,24), 'て', mi(6,36)), BL(12), ('あ', mi(6,24), re(6,24))] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,12), la(6,48), mi(4,48), BK(48), mi(6,48), BK(48), soS(6,48), ti(4,48), BK(48), re(6,48), BK(48), so(6,48)] seq_bass += [fa(3, 96), mi(3,48), re(3,48)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('は', do(6,24), 'や', la(5,24), 'く', do(6,24), 'お', la(5,24), 'う', so(5,24), 'ち', mi(5,24), 'に', do(6,36)), BL(12)] seq+= [('か', re(5,24), 'え', mi(5,24), 'り', mi(5,24), 'た', re(5,24), 'い', do(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ fa(5, 96), BK(60), do(6,12), mi(6,48), mi(5,48), BK(48), ti(5,48), BK(48), re(6,48), la(4,48), BK(48), so(5,48), BK(48), do(6,48), BK(48), mi(6,48)] seq_bass += [fa(3, 96), mi(3,48), la(3,48)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), BK(48), la(5,48), so(4,48), do(5,96), BK(72), mi(5,24), do(5,48), BK(48), do(6,48)] seq_bass += [re(3,48), so(3,48), do(4,96)] seq_drum += drum_repeat seq_harmonica += [do(7,24), la(6,24), so(6,24), mi(6,24), re(6,24), do(6,24), mi(6,48)] seq_guitar += [ fa(5,48), do(6,48), mi(5,48), mi(4,48)] seq_bass += [fa(3, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [do(6,48), do(6,24), la(5,24), do(6,96)] seq_guitar += [re(5,48), so(4,48), do(5,96), BK(96), mi(5,96), BK(96), so(5,96)] seq_bass += [so(3, 96), do(4,96)] seq_drum += drum_repeat doc.sing(seq+[BK(192*2)], Ayaka, track) doc.sing(seq+[BL(192*2)], uta, track) seq= [('い', so(4,24), 'く', do(5,24), 'あ', do(5,24), 'て', re(5,24), 'の', mi(5,24), 'な', so(5,12), 'い', so(5,12)), BL(24)] seq+= [('ぼ', so(5,24), 'く', la(5,24), 'の', do(6,24), 'ま', do(6,24), 'え', la(5,24), 'うぉ', so(5,48)), BL(48)] seq+= [('こ', la(5,24), 'ど', do(6,24), 'も', do(6,24), 'が', la(5,24), 'ひ', so(5,24), 'と', so(5,24), 'り', mi(5,36)), BL(12)] seq+= [('い', re(5,24), 'き', do(5,24), 'す', re(5,24), 'ぎ', mi(5,24), 'る', re(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(96), fa(5,36), do(6,60), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), la(5,48), so(4,96), BK(72), ti(4,12), re(5,12), so(5,24), re(5,24)] seq_bass += [ re(4, 96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('は', so(4,24), 'な', do(5,24), 'うぉ', do(5,24), 'す', re(5,24), 'す', mi(5,24), 'り', so(5,24)), BL(24)] seq+= [('しゃ', so(5,24), 'く', la(5,24), 'り', do(6,24), 'あ', do(6,24), 'げ', la(5,24), 'て', so(5,48)), BL(48)] seq+= [('わ', la(5,24), 'き', do(6,24), 'め', do(6,24), 'も', la(5,24), 'ふ', so(5,24), 'ら', so(5,24), 'ず', mi(5,36)), BL(12)] seq+= [('は', re(5,24), 'し', mi(5,24), 'い', mi(5,24), 'て', re(5,24), 'く', do(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,36), do(6,60), mi(5,48), BK(48), so(5,48), do(5,48), BK(48), so(5,48), BK(48), do(6,48) ] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,36), BK(36), la(5,36), ti(4, 60), BK(48), so(5,48), do(5,96), BK(72), mi(5,12), so(5,12), do(6,48)] seq_bass += [re(4, 48), so(3,48), do(4,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq = [('や', la(5,24), 'み', do(6,48), 'に', la(5,24), 'き', do(6,48), 'え', la(5,36)), BL(12)] seq +=[('て', so(5,24), 'く', mi(5,24), 'せ', so(5,24), 'な', la(5,24), 'か', so(5,48), BL(48)) ] seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), la(5,12), do(6,48), BK(48), mi(6,48), la(5,96), BK(72), do(6,24), mi(6,48)] seq_bass += [fa(3,96), la(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [mi(4,48), BK(48), so(5,48), ti(5,48), do(5,96), BK(72), re(5,12), mi(5,12), so(5,24), mi(5,24)] seq_bass += [mi(3,96), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) line=('あ', la(5,24), 'の', do(6,48), 'ひ', la(5,24), 'の', do(6,48), 'ぼ', la(5,24), 'く', do(6,24)) line+=('に', re(6,24), 'に', do(6,24), 'て', re(6,24), 'い', mi(6,24), 'る', re(6,48), BL(48)) seq =[line] seq_harmonica += [BL(192)] seq_guitar += [fa(5,96), BK(60), la(5,12), do(6,48), BK(48), mi(6,48), faS(5,96), BK(72), do(6,24), mi(6,48)] seq_bass += [fa(3,96), faS(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [so(5,48), BK(48), ti(5,48), re(5,48), BK(48), so(5,48), so(4,24), so(5,12), re(5,12), so(4,48)] seq_bass += [re(4,96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq= [('は', so(4,24), 'し', do(5,24), 'れ', do(5,24), 'は', re(5,24), 'し', mi(5,24), 'れ', so(5,24)), BL(24)] seq+= [('な', so(5,24), 'み', la(5,24), 'だ', do(6,24), 'ふ', do(6,24), 'い', la(5,24), 'て', so(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('か', la(5,24), 'て', do(6,24), 'た', do(6,24), 'お', la(5,24), 'つ', so(5,24), 'き', so(5,24), 'さ', mi(5,18), 'ん', mi(5,18)), BL(12)] seq+= [('お', re(5,24), 'い', do(5,24), 'か', re(5,24), 'け', mi(5,24), 'て', re(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(96), fa(5,36), do(6,60), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), la(5,48), so(4,96), BK(72), ti(4,12), re(5,12), so(5,24), re(5,24)] seq_bass += [ re(4, 96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq= [('い', so(4,24), 'ま', do(5,24), 'す', do(5,24), 'ぐ', re(5,24), 'ご', mi(5,24), 'め', so(5,12), 'ん', so(5,12)), BL(24)] seq+= [('と', so(5,24), 'あ', la(5,24), 'や', do(6,24), 'ま', do(6,24), 'れ', re(6,24), 'ば', mi(6,36)), BL(12), ('あ', mi(6,24), re(6,24))] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,12), la(6,48), mi(4,48), BK(48), mi(6,48), BK(48), soS(6,48), ti(4,48), BK(48), re(6,48), BK(48), so(6,48)] seq_bass += [fa(3, 96), mi(3,48), re(3,48)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('ば', do(6,24), 'ん', la(5,24), 'ご', do(6,24), 'は', la(5,24), 'ん', so(5,24), 'に', mi(5,24), 'わ', do(6,36)), BL(12)] seq+= [('ま', re(5,24), 'に', mi(5,24), 'あ', mi(5,24), 'う', re(5,24), 'さ', do(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ fa(5, 96), BK(60), do(6,12), mi(6,48), mi(5,48), BK(48), ti(5,48), BK(48), re(6,48), la(4,48), BK(48), so(5,48), BK(48), do(6,48), BK(48), mi(6,48)] seq_bass += [fa(3, 96), mi(3,48), la(3,48)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), BK(48), la(5,48), so(4,48), do(5,96), BK(72), mi(5,24), do(5,48), BK(48), do(6,48)] seq_bass += [re(3,48), so(3,48), do(4,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [do(7,24), la(6,24), so(6,24), mi(6,24), re(6,24), do(6,24), mi(6,48),BK(192)] seq_guitar += [ fa(5,48), do(6,48), mi(5,48), mi(4,48)] seq_bass += [fa(3, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [do(6,48), do(6,24), la(5,24), do(6,96),BK(192)] seq_guitar += [re(5,48), so(4,48), do(5,96), BK(96), mi(5,96), BK(96), so(5,96)] seq_bass += [so(3, 96), do(4,96)] seq_drum += drum_repeat doc.sing(seq+[BK(192*2)], Ayaka, track) doc.sing(seq+[BL(192*2)], uta, track) seq = [('お', la(5,24), 'さ', do(6,48), 'か', la(5,24), 'な', do(6,48), 'うぉ', la(5,36)), BL(12)] seq +=[('や', so(5,24), 'く', mi(5,24), 'に', so(5,24), 'お', la(5,24), 'い', so(5,48), BL(48)) ] seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), la(5,12), do(6,48), BK(48), mi(6,48), la(5,96), BK(72), do(6,24), mi(6,48)] seq_bass += [fa(3,96), la(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [mi(4,48), BK(48), so(5,48), ti(5,48), do(5,96), BK(72), re(5,12), mi(5,12), so(5,24), mi(5,24)] seq_bass += [mi(3,96), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq =[('ば', la(5,24), 'ん', do(6,48), 'ご', la(5,24), 'は', do(6,24), 'ん', do(6,24), 'の', la(5,36)), BL(12)] seq +=[('い', so(5,24), 'い', mi(5,24), 'に', re(5,24), 'お', re(5,24), 'い', re(5,48), BL(48)) ] seq_harmonica += [BL(192)] seq_guitar += [fa(5,96), BK(60), la(5,12), do(6,48), BK(48), mi(6,48), faS(5,96), BK(72), do(6,24), mi(6,48)] seq_bass += [fa(3,96), faS(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [so(5,48), BK(48), ti(5,48), re(5,48), BK(48), so(5,48), so(4,24), so(5,12), re(5,12), so(4,48)] seq_bass += [re(4,96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq= [('お', so(4,24), 'な', do(5,24), 'か', do(5,24), 'の', re(5,24), 'む', mi(5,24), 'し', so(5,24)), BL(24)] seq+= [('も', so(5,24), 'な', la(5,24), 'き', do(6,24), 'だ', do(6,24), 'し', la(5,24), 'た', so(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,60), do(5,96), BK(72), so(5,12), do(6,12), mi(6,24), so(5,24)] seq_bass += [fa(3, 96), do(4,96)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('い', la(5,24), 'じ', do(6,24), 'うぉ', do(6,24), 'は', la(5,24), 'る', so(5,24), 'の', so(5,24), 'も', mi(5,36)), BL(12)] seq+= [('あ', re(5,24), 'き', do(5,24), 'て', re(5,24), 'ひ', mi(5,24), 'た', re(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(96), fa(5,36), do(6,60), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), la(5,48), so(4,96), BK(72), ti(4,12), re(5,12), so(5,24), re(5,24)] seq_bass += [ re(4, 96), so(3,96)] seq_drum += drum_repeat doc.sing(seq, Ayaka, track) seq= [('い', so(4,24), 'ま', do(5,24), 'す', do(5,24), 'ぐ', re(5,24), 'ご', mi(5,24), 'め', so(5,12), 'ん', so(5,12)), BL(24)] seq+= [('と', so(5,24), 'あ', la(5,24), 'や', do(6,24), 'ま', do(6,24), 'あ', re(6,24), 'て', mi(6,36)), BL(12), ('あ', mi(6,24), re(6,24))] seq_harmonica += [BL(192)] seq_guitar += [ do(5, 96), BK(60), mi(5,12), so(5,48), mi(4,96), BK(60), mi(5,12), so(5,48), BK(48), ti(5,48)] seq_bass += [do(4, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ fa(5,96), BK(60), do(6,12), la(6,48), mi(4,48), BK(48), mi(6,48), BK(48), soS(6,48), ti(4,48), BK(48), re(6,48), BK(48), so(6,48)] seq_bass += [fa(3, 96), mi(3,48), re(3,48)] seq_drum += drum_repeat doc.sing(seq, uta, track) seq= [('は', do(6,24), 'や', la(5,24), 'く', do(6,24), 'お', la(5,24), 'う', so(5,24), 'ち', mi(5,24), 'に', do(6,36)), BL(12)] seq+= [('か', re(5,24), 'え', mi(5,24), 'り', mi(5,24), 'た', re(5,24), 'い', do(5,48)), BL(48)] seq_harmonica += [BL(192)] seq_guitar += [ fa(5, 96), BK(60), do(6,12), mi(6,48), mi(5,48), BK(48), ti(5,48), BK(48), re(6,48), la(4,48), BK(48), so(5,48), BK(48), do(6,48), BK(48), mi(6,48)] seq_bass += [fa(3, 96), mi(3,48), la(3,48)] seq_drum += drum_repeat seq_harmonica += [BL(192)] seq_guitar += [ re(5,48), BK(48), la(5,48), so(4,48), do(5,96), BK(72), mi(5,24), do(5,48), BK(48), do(6,48)] seq_bass += [re(3,48), so(3,48), do(4,96)] seq_drum += drum_repeat seq_harmonica += [do(7,24), la(6,24), so(6,24), mi(6,24), re(6,24), do(6,24), mi(6,48)] seq_guitar += [ fa(5,48), do(6,48), mi(5,48), mi(4,48)] seq_bass += [fa(3, 96), mi(3,96)] seq_drum += drum_repeat seq_harmonica += [do(6,48), do(6,24), la(5,24), do(6,96)] seq_guitar += [re(5,48), so(4,48), do(5,96), BK(96), mi(5,96), BK(96), so(5,96)] seq_bass += [so(3, 96), do(4,96)] seq_drum += drum_repeat doc.sing(seq+[BK(192*2)], Ayaka, track) doc.sing(seq+[BL(192*2)], uta, track) doc.playNoteSeq(seq_harmonica, harmonica, track_h) doc.playNoteSeq(seq_guitar, guitar, track_g) doc.playNoteSeq(seq_bass, bass, track_b) doc.playBeatSeq(seq_drum, perc_list, track_p) doc.setTrackVolume(track_h, 0.5) doc.setTrackVolume(track_g, 0.5) doc.setTrackVolume(track_b, 0.5) doc.setTrackVolume(track_p, 0.5) doc.setTrackPan(track_h, 0.2) doc.setTrackPan(track_g, -0.2) doc.setTrackPan(track_b, 0.2) doc.setTrackPan(track_p, -0.2) doc.meteor() doc.mixDown('ouchi ni kaeritai.wav') ``` ================================================ FILE: docs/meteor/tiktok.md ================================================
# Tik Tok ## Info * Originally sung by: Ke$ha * Melody/Lyric by: Ke$ha, Lukasz Gottwald, Benny Blanco * CZloid voicebank: [http://utau.wiki/utau:czloid](http://utau.wiki/utau:czloid) ```python import ScoreDraft from ScoreDraft.Notes import * doc=ScoreDraft.MeteorDocument() doc.setTempo(110) singer = ScoreDraft.CZloid_UTAU() singer.setLyricConverter(ScoreDraft.VCCVEnglishConverter) singer.setCZMode() Guitar=ScoreDraft.CleanGuitar() BassDrum=ScoreDraft.BassDrum() Snare=ScoreDraft.Snare() Clap=ScoreDraft.Clap() perc_list=[BassDrum,Snare, Clap] def dong(duration=48): return (0,duration) def cha(duration=48): return (1,duration) def pia(duration=48): return (2,duration) track=doc.newBuf() track_g=doc.newBuf() track_p=doc.newBuf() def Chord(elems, duration, delay=0): ret=[] for elem in elems: ret+=[elem[0](elem[1], duration)] duration-=delay ret+=[BK(duration)] ret+=[BL(duration)] return ret def FaLaDo(duration): return Chord([(fa,4), (la,4), (do,5), (fa,5) ], duration) def SoTiRe(duration): return Chord([(so,4), (ti,4), (re,5), (so,5) ], duration) def LaDoMi(duration): return Chord([(la,4), (do,5), (mi,5), (la,5) ], duration) def ReFaLaDo(duration): return Chord([(re,4), (fa,4), (la,4), (do,5)], duration) FreqsC=Freqs[:] FreqsF=[f*Freqs[5] for f in Freqs] Freqs[:]=FreqsF seq_g = FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq =[BL(192)] seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq +=[BL(192)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq +=[BL(192)] seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq +=[BL(192)] line = ('wA', la(4,24)+do(5,0),'kup', do(5,24), 'in', la(4,24), 'dhx', la(4,24)) line +=('m0r', mi(4,24)+fa(4,0), 'n1ng', fa(4,24)+la(4,0), 'fE', fa(4,24)+mi(4,0), 'l1ng', mi(4,24)+re(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) line +=('lIk', fa(4,36)+so(4,0), 'pE', so(4,36), 'did', la(4,36)+so(4,0)) seq += [ line, BL(4) ] line =('p6t', so(4,16)+mi(4,0), 'mI', mi(4,16),re(4,0), 'gla', so(4,24), 'ses', mi(4,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) line +=('an', fa(4,24)+do(5,0), 'Im', la(4,24)+mi(4,0), '8', fa(4,24)+mi(4,0), 'dhx', fa(4,24)+mi(4,0), 'd0r', fa(4,24)+mi(4,0)) line +=('Im', fa(4,24)+do(5,0), 'g0r', la(4,24)+fa(4,0), 'na', mi(4,24)+do(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) line +=('hit', ti(4,36)+so(4,0), 'dhi', fa(4,36)+re(4,0), 'si', so(4,24), 'ti', mi(4,24)+do(4,0)) seq += [line] line = ('bE',la(4,24)+do(5,0),'f0r',do(5,24), 'I', do(4,24)+mi(4,0)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) line += ('lEv', fa(4,36)+do(5,0)) seq += [line, BL(12)] line = ('brush', la(4,24)+do(5,0), 'mI', do(5,24), 'tEth', la(4,36)+fa(4,0)) seq += [line, BL(12)] line = ('with', fa(4,24)+mi(4,0), 'x', mi(4,24),do(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) line += ('ba', re(4,24)+so(4,0), 't9l', so(4,24), 'xv', so(4,24), 'j@k',la(4,36)+mi(4,0)) seq += [line, BL(12)] line = ('k0rz', so(4,24)+mi(4,0), 'wen', mi(4,24), 'I', mi(4,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) line += ('lEv', fa(4,36)+do(5,0)) seq += [line, BL(12)] line = ('f0r', la(4,24), 'thx', la(4,24), 'nIt', la(4,24)+do(4,0), 'I', do(4,24)+la(4,0), 'ent', la(4,36)+do(4,0)) seq += [line, BL(12)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) line = ('ku', la(4,24)+do(4,0), 'm1ng', mi(4,48)+do(4,0), 'b@k', la(4,36)+do(4,0)) seq_g+=[BL(192)] seq += [line, BL(12)] line = ('Im', do(4,24)+la(4,0), 't9l', mi(4,24)+do(4,0), 'k1ng', mi(4,24)+do(4,0)) p_skip=ScoreDraft.TellDuration(seq_g) perc_loop=[dong(48), pia(24), dong(48), BL(24), pia(48)] line +=('pe',fa(4,12), 'di', fa(4,12), 'ky3r', fa(4,24)+do(5,0)) line +=('an',la(4,24)+fa(4,0), '8r', fa(4,24)+do(4,0), 'tOs', fa(4,48)+do(4,0), 'tOs', fa(4,36)+do(4,0)) seq += [line,BL(12)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p =[BL(p_skip)]+perc_loop line =('trI',fa(4,12), 'y1ng', fa(4,12), 'an', fa(4,24)+do(5,0)) line +=('9l',la(4,24)+fa(4,0), '8r', fa(4,24)+do(4,0), 'klOth', fa(4,48)+do(4,0), 'klOth', fa(4,36)+do(4,0)) seq += [line] seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line =('bQs',fa(4,12), 'blO', fa(4,24), '1ng', fa(4,24)+do(5,0)) line +=('up',la(4,24)+fa(4,0), '8r', fa(4,24)+do(4,0), 'f9ns', fa(4,48)+do(4,0), 'f9ns', fa(4,48)+do(4,0)) seq += [line, BL(120)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p +=perc_loop line = ('drap',la(4,24)+do(4,0), 'ta',la(4,24)+do(4,0), 'p1ng', mi(4,24)+do(4,0)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line += ('plA',fa(4,12), 'y1ng', fa(4,12), '8r', fa(4,24)+do(5,0)) line += ('fA', la(4,12)+so(4,0), 'vx', so(4,12)+fa(4,0), 'rit', fa(4,24)+do(4,0), 'sE', fa(4,48)+do(4,0), 'dEs', fa(4,36)+do(4,0)) seq += [line, BL(12)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p +=perc_loop line =('p6',fa(4,12), 'l1ng', fa(4,12), 'up', fa(4,24)+do(5,0)) line +=('t6',la(4,24)+fa(4,0), 'dhx', fa(4,24)+do(4,0), 'par', fa(4,48)+do(4,0), 'tis', fa(4,36)+do(4,0)) seq += [line, BL(12)] seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line =('trIng',fa(4,12),'t6', fa(4,12), 'get', fa(4,24)+do(5,0)) line +=('li',la(4,12)+so(4,0), 't9l', so(4,12)+fa(4,0), 'bit', fa(4,24)+do(4,0), 'tip', fa(4,48)+do(4,0)) seq += [line, BL(48)] seq_g += ReFaLaDo(36)+ReFaLaDo(36)+ReFaLaDo(24)+[BL(72)]+ReFaLaDo(24) seq_p +=perc_loop seq += [('sE', fa(4,48)+do(4,0)), BL(96)] line = ('dant', do(5,24), re(5,24)) seq_g +=[BL(48)]+ SoTiRe(48)+ SoTiRe(48)+ SoTiRe(48) seq_p +=[BL(144), cha(24), cha(24)] perc_loop=[dong(),cha(), dong(), cha()] line += ('stap', do(5,48), 'mAk', do(5,24), 'it', do(5,24), 'pap', do(5,36)) seq += [line, BL(12)] line = ('dE', do(5,24), 'jA', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('blO', do(5,12), re(5,12), 'mI', do(5,24), 'spE', do(5,24), 'k3s', do(5,24), 'up', do(5,36)) seq += [line, BL(12)] line = ('t6', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('nIt', do(5,48), 'Im', do(5,24), 'a', do(5,24), 'fIt', do(5,36)) seq += [line, BL(12)] line = ('til', do(5,24), 'wE', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('sE', do(5,12), re(5,12), 'dhx', do(5,24), 'sun', ti(4,24), la(4,24), 'lIt', la(4,36)) seq += [line, BL(12)] line = ('tik', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('tak', do(5,48), 'an', do(5,24), 'dhx', do(5,24), 'klak', do(5,36)) seq += [line, BL(12)] line = ('bu', do(5,24), 'dhx', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line += ('par', do(5,24), 'ti', do(5,24), 'dant', do(5,48), 'stap', do(5,24), la(4,24), 'nO', la(4,48)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,48)) seq += [line, BL(48)] seq_g += ReFaLaDo(36)+ReFaLaDo(36)+ReFaLaDo(24)+[BL(72)]+ReFaLaDo(24) seq_p +=perc_loop line = ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,36)) seq += [line, BL(12)] line = ('dant', do(5,24), re(5,24)) seq_g +=LaDoMi(36)+LaDoMi(36)+SoTiRe(48)+SoTiRe(36)+SoTiRe(36) seq_p +=perc_loop line += ('stap', do(5,48), 'mAk', do(5,24), 'it', do(5,24), 'pap', do(5,36)) seq += [line, BL(12)] line = ('dE', do(5,24), 'jA', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('blO', do(5,12), re(5,12), 'mI', do(5,24), 'spE', do(5,24), 'k3s', do(5,24), 'up', do(5,36)) seq += [line, BL(12)] line = ('t6', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('nIt', do(5,48), 'Im', do(5,24), 'a', do(5,24), 'fIt', do(5,36)) seq += [line, BL(12)] line = ('til', do(5,24), 'wE', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('sE', do(5,12), re(5,12), 'dhx', do(5,24), 'sun', ti(4,24), la(4,24), 'lIt', la(4,36)) seq += [line, BL(12)] line = ('tik', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('tak', do(5,48), 'an', do(5,24), 'dhx', do(5,24), 'klak', do(5,36)) seq += [line, BL(12)] line = ('bu', do(5,24), 'dhx', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line += ('par', do(5,24), 'ti', do(5,24), 'dant', do(5,48), 'stap', do(5,24), la(4,24), 'nO', la(4,48)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,48)) seq += [line, BL(48)] seq_g += ReFaLaDo(36)+ReFaLaDo(36)+ReFaLaDo(24)+[BL(72)]+ReFaLaDo(24) seq_p +=perc_loop line = ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,24)) line += ('ent', so(4,24)+ti(4,0), 'gat', re(4,24)+so(4,0), 'a', so(4,24)+re(4,0)) seq_g +=LaDoMi(36)+LaDoMi(36)+SoTiRe(48)+SoTiRe(36)+SoTiRe(36) seq_p +=perc_loop perc_loop=[dong(), dong(),dong(), dong()] line +=('ke3r',fa(4,36)+la(4,0)) seq += [line, BL(12)] line = ('in', la(4,24), 'dhx', la(4,24), 'w0rld',la(4,36)+fa(4,0)) seq += [line, BL(12)] line =('but', fa(4,24)+do(4,0), 'gat', fa(4,24)+do(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p +=perc_loop line +=('plen',re(4,24)+so(4,0), 'ti', so(4,24), 'xv', so(4,24), 'bEr', ti(4,36)+re(4,0)) seq += [line,BL(12)] line = ('ent', la(4,24)+do(5,0), 'gat', mi(4,24)+la(4,0), 'nO', mi(4,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line += ('ma', la(4,24), 'ni', la(4,24), 'in', fa(4,24)+do(4,0), 'mI', fa(4,24)+do(4,0), 'pa', la(4,24), 'ket', la(4,24), 'but', la(4,24)+fa(4,0), 'Im', fa(4,24)+do(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p +=perc_loop line +=('9l',ti(3,24)+re(4,0), 're', re(4,24)+so(4,0), 'di', so(4,24)+re(4,0), 'hEr', ti(4,36)+re(4,0)) seq += [line,BL(12)] line = ('@nd', la(4,24)+do(5,0), 'n8', mi(4,24)+la(4,0), 'dhx', do(4,24)+mi(4,0)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line +=('dyO',la(4,24)+do(5,0), 'sa', do(5,24), 'lIn',fa(4,24)+la(4,0), '1ng', la(4,24), 'up', fa(4,36)+la(4,0)) seq += [line,BL(12)] line =('k0rz',la(4,24)+fa(4,0), 'dhA', fa(4,24)+mi(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p +=perc_loop line+=('hEr', so(4,24)+ti(4,0), 'wE', re(4,24)+so(4,0), 'gats', so(4,48)+ti(4,0), 'w@', la(4,24), 'g3r', la(4,24)+mi(4,0)) line+=('but',la(4,24)+fa(4,0), 'wE', fa(4,24)+mi(4,0)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line+=('ki',fa(4,24)+re(4,0), 'kAm', fa(4,24)+la(4,0), 't6', la(4,24), 'dhx', la(4,24), 'k3rb', la(4,24)+fa(4,0)) line+=('un',fa(4,24)+re(4,0), 'les', la(4,24)+fa(4,0), 'dhA', fa(4,24)+re(4,0)) seq_g += ReFaLaDo(36)+ReFaLaDo(36)+ReFaLaDo(24)+[BL(72)]+ReFaLaDo(24) seq_p +=perc_loop line+=('l6k', fa(4,24)+la(4,0), 'lIk', fa(4,24)+la(4,0), 'mIk', fa(4,24)+la(4,0), 'j@', la(4,24)+fa(4,0), 'g3r', fa(4,24)+re(4,0)) seq += [line] line=('Im', do(4,24)+mi(4,0), 't9l', la(4,12), 'k1ng', la(4,12), 'b8t', mi(4,24)+la(4,0)) seq_g += [BL(192)] seq_p += [BL(192)] perc_loop=[dong(48), pia(24), dong(48), BL(24), pia(48)] line +=('ev',fa(4,12), 'ri', fa(4,12), 'ba', fa(4,12)+la(4,0), 'di', la(4,12)+do(5,0)) line +=('ge',la(4,24)+fa(4,0), 't1ng', fa(4,24)+do(4,0), 'krunk', fa(4,48)+do(4,0), 'krunk', fa(4,36)+do(4,0)) seq += [line,BL(12)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p += perc_loop line =('bQs',fa(4,24), 'trI', fa(4,12)+do(5,0), 't6', do(5,12)) line +=('tuch',la(4,24)+fa(4,0), 'mI', fa(4,24)+do(4,0), 'junk', fa(4,48)+do(4,0), 'junk', fa(4,24)+do(4,0)) seq += [line] line =('ga', fa(4,12)+la(4,0), 'na', la(4,12)+do(4,0)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line +=('sm@k',la(4,12), 'him', la(4,12)+fa(4,0), 'if', fa(4,12), 'hi', la(4,12)+fa(4,0), 'ge', fa(4,12)+la(4,0), 't1ng', la(4,12) ) line +=('to', la(4,24)+fa(4,0), 'drunk', fa(4,48)+do(4,0), 'drunk', fa(4,48)+do(4,0)) seq += [line, BL(120)] seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p +=perc_loop line = ('n8',la(4,24)+do(4,0), 'n8',la(4,24)+do(4,0), 'wE', la(4,24)+do(4,0)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line +=('gO',fa(4,12), 'in', fa(4,12), 'til', fa(4,12)+la(4,0), 'dhA', la(4,12)+do(5,0)) line +=('kik',la(4,24)+fa(4,0), 'us', fa(4,24)+do(4,0), '8t', fa(4,48)+do(4,0), '8t', fa(4,24)+do(4,0)) seq += [line] line =('0r', fa(4,12)+la(4,0), 'dhx', la(4,12)+do(4,0)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(24) seq_p += perc_loop line +=('px',fa(4,24), 'lEs', fa(4,24)+do(5,0)) line +=('shut',la(4,24)+fa(4,0), 'us', fa(4,24)+do(4,0), 'd8n', fa(4,48)+do(4,0), 'd8n', fa(4,36)+do(4,0)) seq += [line, BL(12)] seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(36)+LaDoMi(36) seq_p +=perc_loop line =('px',fa(4,24), 'lEs', fa(4,24)+do(5,0)) line +=('shut',la(4,24)+fa(4,0), 'us', fa(4,24)+do(4,0), 'd8n', fa(4,48)+do(4,0), 'd8n', fa(4,36)+do(4,0)) seq += [line, BL(12)] seq_g += [BL(192)] seq_p +=[dong(12), dong(12),dong(24), BL(96), pia(48)] line =('px',fa(4,24), 'px', fa(4,24)) line +=('shut',la(4,24)+fa(4,0), 'us', fa(4,24)+do(4,0)) seq += [line, BL(48)] line =('dant', do(5,24), re(5,24)) seq_g += [BL(192)] seq_p +=[dong(12), dong(12),dong(24), BL(96), pia(48)] perc_loop=[dong(),cha(), dong(), cha()] line += ('stap', do(5,48), 'mAk', do(5,24), 'it', do(5,24), 'pap', do(5,36)) seq += [line, BL(12)] line = ('dE', do(5,24), 'jA', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('blO', do(5,12), re(5,12), 'mI', do(5,24), 'spE', do(5,24), 'k3s', do(5,24), 'up', do(5,36)) seq += [line, BL(12)] line = ('t6', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('nIt', do(5,48), 'Im', do(5,24), 'a', do(5,24), 'fIt', do(5,36)) seq += [line, BL(12)] line = ('til', do(5,24), 'wE', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('sE', do(5,12), re(5,12), 'dhx', do(5,24), 'sun', ti(4,24), la(4,24), 'lIt', la(4,36)) seq += [line, BL(12)] line = ('tik', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('tak', do(5,48), 'an', do(5,24), 'dhx', do(5,24), 'klak', do(5,36)) seq += [line, BL(12)] line = ('bu', do(5,24), 'dhx', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line += ('par', do(5,24), 'ti', do(5,24), 'dant', do(5,48), 'stap', do(5,24), la(4,24), 'nO', la(4,48)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,48)) seq += [line, BL(48)] seq_g += ReFaLaDo(36)+ReFaLaDo(36)+ReFaLaDo(24)+[BL(72)]+ReFaLaDo(24) seq_p +=perc_loop line = ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,36)) seq += [line, BL(12)] line = ('dant', do(5,24), re(5,24)) seq_g +=LaDoMi(36)+LaDoMi(36)+SoTiRe(48)+SoTiRe(36)+SoTiRe(36) seq_p +=perc_loop line += ('stap', do(5,48), 'mAk', do(5,24), 'it', do(5,24), 'pap', do(5,36)) seq += [line, BL(12)] line = ('dE', do(5,24), 'jA', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('blO', do(5,12), re(5,12), 'mI', do(5,24), 'spE', do(5,24), 'k3s', do(5,24), 'up', do(5,36)) seq += [line, BL(12)] line = ('t6', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('nIt', do(5,48), 'Im', do(5,24), 'a', do(5,24), 'fIt', do(5,36)) seq += [line, BL(12)] line = ('til', do(5,24), 'wE', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line +=('sE', do(5,12), re(5,12), 'dhx', do(5,24), 'sun', ti(4,24), la(4,24), 'lIt', la(4,36)) seq += [line, BL(12)] line = ('tik', do(5,24), re(5,24)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('tak', do(5,48), 'an', do(5,24), 'dhx', do(5,24), 'klak', do(5,36)) seq += [line, BL(12)] line = ('bu', do(5,24), 'dhx', do(5,24)) seq_g += FaLaDo(36)+FaLaDo(36)+FaLaDo(24)+[BL(72)]+FaLaDo(12)+FaLaDo(12) seq_p +=perc_loop line += ('par', do(5,24), 'ti', do(5,24), 'dant', do(5,48), 'stap', do(5,24), la(4,24), 'nO', la(4,48)) seq_g += SoTiRe(36)+SoTiRe(36)+LaDoMi(48)+LaDoMi(24)+LaDoMi(48) seq_p +=perc_loop line += ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,48)) seq += [line, BL(48)] seq_g += ReFaLaDo(36)+ReFaLaDo(36)+ReFaLaDo(24)+[BL(72)]+ReFaLaDo(24) seq_p +=perc_loop line = ('O', la(4,36), 'O', la(4,36), 'O', la(4,24), 'O', mi(5,48)) seq += [line, BL(48)] seq_g +=LaDoMi(36)+LaDoMi(36)+SoTiRe(48)+SoTiRe(36)+SoTiRe(36) seq_p +=[dong(),cha(), cha(12), cha(12),cha(12),cha(12), cha()] doc.sing(seq, singer,track) doc.playNoteSeq(seq_g, Guitar, track_g) doc.playBeatSeq(seq_p, perc_list, track_p) doc.setTrackVolume(track_g, 0.5) doc.meteor() doc.mixDown('tiktok.wav') ``` ================================================ FILE: python/CMakeLists.txt ================================================ cmake_minimum_required (VERSION 3.0) set(PYTHON ScoreDraft/__init__.py ScoreDraft/ScoreDraftCore.py ScoreDraft/Catalog.py ScoreDraft/Initializers.py ScoreDraft/Instrument.py ScoreDraft/Percussion.py ScoreDraft/Singer.py ScoreDraft/SimpleInstruments.py ScoreDraft/KarplusStrong.py ScoreDraft/BasicSamplers.py ScoreDraft/SoundFont2.py ScoreDraft/VoiceSampler.py ScoreDraft/UTAUUtils.py ScoreDraft/UtauDraft.py ScoreDraft/RapChinese.py ScoreDraft/CVVCChineseConverter.py ScoreDraft/XiaYYConverter.py ScoreDraft/JPVCVConverter.py ScoreDraft/TsuroVCVConverter.py ScoreDraft/TTEnglishConverter.py ScoreDraft/VCCVEnglishConverter.py ScoreDraft/TTLyricSet.data ScoreDraft/VCCVLyricSet.data ScoreDraft/Document.py ScoreDraft/Notes.py ScoreDraft/MIDIWriter.py ScoreDraft/PCMPlayer.py ScoreDraft/Meteor.py ScoreDraft/MusicXMLDocument.py ScoreDraft/YAMLDocument.py ) set(PYTHON_MX ScoreDraft/musicxml/__init__.py ScoreDraft/musicxml/musicxml.py ScoreDraft/musicxml/xlink.py ScoreDraft/musicxml/xml.py ) install(FILES ${PYTHON} DESTINATION ScoreDraft) install(FILES ${PYTHON_MX} DESTINATION ScoreDraft/musicxml) install(FILES setup.py README.md DESTINATION .) ================================================ FILE: python/README.md ================================================ ScoreDraft ================ [ScoreDraft](https://github.com/fynv/ScoreDraft) is a music/singing synthesizer that provides a Python based score authoring interface. ================================================ FILE: python/ScoreDraft/BasicSamplers.py ================================================ import os from cffi import FFI ffi = FFI() ffi.cdef(""" void* SampleCreate(unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v); void* InstrumentSampleCreate(unsigned origin_sample_rate, unsigned chn, void* ptr_f32_buf, float max_v, float origin_freq); void SampleDestroy(void *ptr); void PercussionGenerate(void* ptr_wavbuf, void* ptr_sample, float fduration); void InstrumentSingleGenerate(void* ptr_wavbuf, void* ptr_sample, float freq, float fduration); void InstrumentMultiGenerate(void* ptr_wavbuf, void* ptr_sample_lst, float freq, float fduration); """) if os.name == 'nt': fn_shared_lib = 'BasicSamplers.dll' elif os.name == "posix": fn_shared_lib = 'libBasicSamplers.so' path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) from .ScoreDraftCore import F32Buf class Sample: def __init__(self, origin_sample_rate, channel_num, f32buf, max_value = -1.0): self.m_buf = f32buf self.m_cptr = Native.SampleCreate(origin_sample_rate, channel_num, f32buf.m_cptr, max_value) def __del__(self): Native.SampleDestroy(self.m_cptr) class InstrumentSample(Sample): def __init__(self, origin_sample_rate, channel_num, f32buf, max_value = -1.0, origin_freq = -1.0): self.m_buf = f32buf self.m_cptr = Native.InstrumentSampleCreate(origin_sample_rate, channel_num, f32buf.m_cptr, max_value, origin_freq) import wave def loadSample(filename, is_instrument): wavS16=bytes() nChn = 1 nFrames = 0 framerate = 44100 origin_freq = -1.0 with wave.open(filename, mode='rb') as wavFile: nFrames =wavFile.getnframes() nChn = wavFile.getnchannels() wavS16=wavFile.readframes(nFrames) framerate = wavFile.getframerate() f32buf = F32Buf.from_s16(wavS16) if is_instrument: freq_fn = filename[0:len(filename)-4]+".freq" if os.path.isfile(freq_fn): with open(freq_fn, "r") as f: origin_freq= float(f.readline()) return InstrumentSample(framerate, nChn, f32buf, origin_freq = origin_freq) else: return Sample(framerate, nChn, f32buf) Samples_Percussion = {} def GetSample_Percussion(fn): if not (fn in Samples_Percussion): Samples_Percussion[fn] = loadSample(fn, False) return Samples_Percussion[fn] Samples_Single = {} def GetSample_Single(fn): if not (fn in Samples_Single): Samples_Single[fn] = loadSample(fn, True) return Samples_Single[fn] Samples_Multi = {} def GetSamples_Multi(path): if not (path in Samples_Multi): samples = [] if os.path.isdir(path): for item in os.listdir(path): fn = path+'/'+item if os.path.isfile(fn) and item.endswith(".wav"): samples+=[loadSample(fn, True)] Samples_Multi[path] = samples return Samples_Multi[path] from .ScoreDraftCore import ObjArray, WavBuffer from .Instrument import Instrument from .Percussion import Percussion from .Catalog import Catalog Catalog['Engines'] += ['InstrumentSampler_Single - Instrument'] Catalog['Engines'] += ['InstrumentSampler_Multi - Instrument'] Catalog['Engines'] += ['PercussionSampler - Percussion'] class EnginePercussionSampler: def __init__(self, sample): self.sample=sample def tune(self, cmd): pass def generateWave(self, fduration, sampleRate): wav = F32Buf(0) wav_buf = WavBuffer(sampleRate, 1, wav) Native.PercussionGenerate(wav_buf.m_cptr, self.sample.m_cptr, fduration) return wav_buf class EngineInstrumentSampler_Single: def __init__(self, sample): self.sample=sample def tune(self, cmd): pass def generateWave(self, freq, fduration, sampleRate): wav = F32Buf(0) wav_buf = WavBuffer(sampleRate, 1, wav) Native.InstrumentSingleGenerate(wav_buf.m_cptr, self.sample.m_cptr, freq, fduration) return wav_buf class EngineInstrumentSampler_Multi: def __init__(self, samples): self.samples = samples self.sample_lst = ObjArray(self.samples) def tune(self, cmd): pass def generateWave(self, freq, fduration, sampleRate): wav = F32Buf(0) wav_buf = WavBuffer(sampleRate, 1, wav) Native.InstrumentMultiGenerate(wav_buf.m_cptr, self.sample_lst.m_cptr, freq, fduration) return wav_buf class PercussionSampler(Percussion): def __init__(self, wavPath): Percussion.__init__(self) sample = GetSample_Percussion(wavPath) self.engine = EnginePercussionSampler(sample) class InstrumentSampler_Single(Instrument): def __init__(self, wavPath): Instrument.__init__(self) sample = GetSample_Single(wavPath) self.engine = EngineInstrumentSampler_Single(sample) class InstrumentSampler_Multi(Instrument): def __init__(self, folderPath): Instrument.__init__(self) samples = GetSamples_Multi(folderPath) self.engine = EngineInstrumentSampler_Multi(samples) ================================================ FILE: python/ScoreDraft/CVVCChineseConverter.py ================================================ def getCV(CVLyric): vowels= ["a","e","i","o","u","v"] min_i=len(CVLyric) for c in vowels: i=CVLyric.find(c) if i>-1 and i=1: if cmd_len>1 and cmd_split[0]=='volume': self.volume=float(cmd_split[1]) return True if cmd_len>1 and cmd_split[0]=='pan': self.pan=float(cmd_split[1]) return True return False def EnginePlayNote(self, engine, buf, freq, fduration): wavBuf=engine.generateWave(freq,fduration, buf.getSampleRate()) if wavBuf!=None: wavBuf.set_volume(self.volume) wavBuf.set_pan(self.pan) buf.writeBlend(wavBuf) buf.moveCursor(fduration) def PlayNoteA(self,engine, buf, note, tempoMap, tempoMapOffset, refFreq): pos1 = tempoMapOffset pos2 = pos1 + note[1] fduration = abs(GetTempoMap(tempoMap, pos2)- GetTempoMap(tempoMap, pos1)) if note[0]<0.0: if note[1]>0.0: buf.moveCursor(fduration) elif note[1]<0.0: buf.moveCursor(-fduration) return freq = refFreq*note[0] self.EnginePlayNote (engine, buf, freq, fduration) def PlayNoteB(self, engine, buf, note, tempo, refFreq): fduration=abs(note[1]*60000)/(tempo*48) if note[0]<0.0: if note[1]>0.0: buf.moveCursor(fduration) elif note[1]<0.0: buf.moveCursor(-fduration) return freq = refFreq*note[0] self.EnginePlayNote (engine, buf, freq, fduration) def PlaySequence(self, engine, buf, seq, tempo, refFreq): using_tempo_map= (type(tempo)== list) tempo_map=[] if using_tempo_map: cursor = buf.getCursor() if tempo[0][0] == 0: cursor= tempo[0][1] buf.setCursor(cursor) else: ctrlPnt=(0, cursor) tempo_map+=[ctrlPnt] for ctrlPnt in tempo: tempo_map+=[ctrlPnt] beatPos=0 for item in seq: if isinstance(item, (list, tuple)): _item = item[0] if type(_item) == str: # singing tupleSize=len(item) j=0 while j0: v= vowels[i-1] ret+=[(v+' '+LyricForEachSyllable[i], 1.0, True)] return ret ================================================ FILE: python/ScoreDraft/KarplusStrong.py ================================================ import os from cffi import FFI ffi = FFI() ffi.cdef(""" void KarplusStrongGenerate(void* ptr_wavbuf, float freq, float fduration, float cut_freq, float loop_gain, float sustain_gain); """) if os.name == 'nt': fn_shared_lib = 'KarplusStrong.dll' elif os.name == "posix": fn_shared_lib = 'libKarplusStrong.so' path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) from .Instrument import Instrument from .ScoreDraftCore import F32Buf from .ScoreDraftCore import WavBuffer from .Catalog import Catalog Catalog['Engines'] += ['KarplusStrongInstrument - Instrument'] class EngineKarplusStrong: def __init__(self): self.cut_freq=10000.0 self.loop_gain=0.99 self.sustain_gain=0.8 def tune(self, cmd): pass def generateWave(self, freq, fduration, sampleRate): wav = F32Buf(0) wav_buf = WavBuffer(sampleRate, 1, wav) Native.KarplusStrongGenerate(wav_buf.m_cptr, freq,fduration, self.cut_freq, self.loop_gain, self.sustain_gain) return wav_buf class KarplusStrongInstrument(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EngineKarplusStrong() def setCutFrequency(self, cut_freq): # This is the cut-frequency of the feedback filter for pitch 261.626Hz self.engine.cut_freq = cut_freq def setLoopGain(self, loop_gain): self.engine.loop_gain = loop_gain def setSustainGain(self, sustain_gain): self.engine.sustain_gain = sustain_gain ================================================ FILE: python/ScoreDraft/MIDIWriter.py ================================================ import os from cffi import FFI from .ScoreDraftCore import ObjArray ffi = FFI() ffi.cdef(""" void* NoteCreate(float freq_rel, int duration); void NoteDestroy(void* ptr); void* WriteToMidi(void* ptr_seq_list, unsigned tempo, float refFreq, const char* fileName); """) if os.name == 'nt': fn_shared_lib = 'MIDIWriter.dll' fs_encoding = "mbcs" elif os.name == "posix": fn_shared_lib = 'libMIDIWriter.so' fs_encoding = "utf-8" path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) class Note: def __init__(self, freq_rel, duration): self.m_cptr = Native.NoteCreate(freq_rel, duration) def __del__(self): Native.NoteDestroy(self.m_cptr) def WriteNoteSequencesToMidi(seqList, tempo, refFreq, fileName): ''' Write a list of note sequences to a MIDI file. seqList -- a list of note sequences. tempo -- an integer indicating tempo in beats/minute. refFreq -- a float indicating reference frequency in Hz. fileName -- a string. ''' obj_seq_list = ObjArray([ObjArray([Note(note[0], note[1]) for note in seq]) for seq in seqList]) Native.WriteToMidi(obj_seq_list.m_cptr, tempo, refFreq, fileName.encode(fs_encoding)) ================================================ FILE: python/ScoreDraft/Meteor.py ================================================ import os from cffi import FFI from .ScoreDraftCore import ObjArray ffi = FFI() ffi.cdef(""" void* CtrlPntCreate(double freq, double fduration); void CtrlPntDestroy(void* ptr); void* SyllableCreate(const char* lyric, void* ptr_lst_ctrl_pnts); void SyllableDestroy(void* ptr); void EventDestroy(void* ptr); void EventSetOffset(void* ptr, float offset); void* EventInstCreate(unsigned instrument_id, double freq, float fduration); void* EventPercCreate(unsigned instrument_id, float fduration); void* EventSingCreate(unsigned instrument_id, void* ptr_syllable_list); void* MeteorCreate0(); void* MeteorCreate(void* ptr_event_list); void MeteorDestroy(void* ptr); void MeteorSaveToFile(void* ptr, const char* filename); void MeteorLoadFromFile(void* ptr, const char* filename); void MeteorPlay(void* ptr_meteor, void* ptr_track); void* Base64Create(void* ptr_meteor); void Base64Destroy(void* ptr); const char* Base64Get(void* ptr); """) if os.name == 'nt': fn_shared_lib = 'Meteor.dll' fs_encoding = "mbcs" elif os.name == "posix": fn_shared_lib = 'libMeteor.so' fs_encoding = "utf-8" path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) class CtrlPnt: def __init__(self, freq, fduration): self.m_cptr = Native.CtrlPntCreate(freq, fduration) def __del__(self): Native.CtrlPntDestroy(self.m_cptr) class Syllable: def __init__(self, lyric, ctrl_pnts): obj_ctrl_pnts = ObjArray(ctrl_pnts) self.m_cptr = Native.SyllableCreate(lyric.encode('utf-8'), obj_ctrl_pnts.m_cptr) def __del__(self): Native.SyllableDestroy(self.m_cptr) class Event: def __del__(self): Native.EventDestroy(self.m_cptr) def set_offset(self, offset): Native.EventSetOffset(self.m_cptr, offset) class EventInst(Event): def __init__(self, instrument_id, freq, fduration): self.m_cptr = Native.EventInstCreate(instrument_id, freq, fduration) class EventPerc(Event): def __init__(self, instrument_id, fduration): self.m_cptr = Native.EventPercCreate(instrument_id, fduration) class EventSing(Event): def __init__(self, instrument_id, syllable_list): obj_syllable_list = ObjArray(syllable_list) self.m_cptr = Native.EventSingCreate(instrument_id, obj_syllable_list.m_cptr) class Meteor: def __init__(self, event_list = None): if event_list is None: self.m_cptr = Native.MeteorCreate0() else: obj_event_list = ObjArray(event_list) self.m_cptr = Native.MeteorCreate(obj_event_list.m_cptr) def __del__(self): Native.MeteorDestroy(self.m_cptr) def save_to_file(self, filename): Native.MeteorSaveToFile(self.m_cptr, filename.encode(fs_encoding)) def load_from_file(self, filename): Native.MeteorLoadFromFile(self.m_cptr, filename.encode(fs_encoding)) def to_base64(self): p_b64 = Native.Base64Create(self.m_cptr) b64 = ffi.string(Native.Base64Get(p_b64)).decode('utf-8') Native.Base64Destroy(p_b64) return b64 def MeteorPlay(meteor, track): Native.MeteorPlay(meteor.m_cptr, track.m_cptr) from .ScoreDraftCore import TrackBuffer from .ScoreDraftCore import MixTrackBufferList from .ScoreDraftCore import WriteTrackBufferToWav from .Instrument import Instrument from .Percussion import Percussion from .Singer import Singer import math EventType_Inst=0 EventType_Perc=1 EventType_Sing=2 class DummyTrackBuffer(TrackBuffer): def __init__ (self, eventList, chn=-1): TrackBuffer.__init__(self, chn) self.eventList=eventList def writeBlend(self, wavBuf): TrackBuffer.writeBlend(self,wavBuf) if hasattr(wavBuf, 'event'): event = wavBuf.event event.set_offset(self.getCursor()) self.eventList += [event] class DummyInstrumentEngine: def __init__(self, inst_id, engine, isGMDrum): self.inst_id=inst_id self.engine = engine self.isGMDrum = isGMDrum def tune(self, cmd): return self.engine.tune(cmd) def generateWave(self, freq, fduration, sampleRate): wavBuf=self.engine.generateWave(freq, fduration, sampleRate) if not self.isGMDrum: event = EventInst(self.inst_id, freq, fduration) else: midiPitch = int(math.log(freq/261.626)*12.0 / math.log(2.0) + 0.5) + 60; if midiPitch<0: midiPitch = 0 elif midiPitch>127: midiPitch = 127 event = EventPerc(midiPitch, fduration) wavBuf.event = event return wavBuf class DummyInstrument(Instrument): def __init__(self, inst_id, inst): self.shell = inst.shell self.engine= DummyInstrumentEngine(inst_id, inst.engine, inst.isGMDrum()) class DummyInstrumentCreator: def __init__(self): self.count=0 self.map={} def Create(self, inst): if not inst in self.map: self.map[inst] = DummyInstrument(self.count, inst) self.count+=1 return self.map[inst] class DummyPercussionEngine: def __init__(self, inst_id, engine): self.inst_id=inst_id self.engine=engine def tune(self, cmd): return self.engine.tune(cmd) def generateWave(self, fduration, sampleRate): wavBuf=self.engine.generateWave(fduration, sampleRate) event = EventPerc(self.inst_id, fduration) wavBuf.event = event return wavBuf class DummyPercussion(Percussion): def __init__(self, inst_id, perc): self.shell = perc.shell self.engine= DummyPercussionEngine(inst_id, perc.engine) class DummyPercussionCreator: def __init__(self): self.count=0 self.map={} def Create(self, perc): if not perc in self.map: self.map[perc] = DummyPercussion(self.count, perc) self.count+=1 return self.map[perc] class DummySingerEngine: def __init__(self, inst_id, engine): self.inst_id=inst_id self.engine=engine def tune(self, cmd): return self.engine.tune(cmd) def generateWave(self, syllableList, sampleRate): wavBuf=self.engine.generateWave(syllableList, sampleRate) syllable_obj_list = [Syllable(syllable['lyric'], [CtrlPnt(ctrl_pnt[0], ctrl_pnt[1]) for ctrl_pnt in syllable['ctrlPnts']]) for syllable in syllableList] event = EventSing(self.inst_id, syllable_obj_list) wavBuf.event = event return wavBuf class DummySinger(Singer): def __init__(self, inst_id, singer): self.shell = singer.shell self.engine= DummySingerEngine(inst_id, singer.engine) class DummySingerCreator: def __init__(self): self.count=0 self.map={} def Create(self, singer): if not singer in self.map: self.map[singer] = DummySinger(self.count, singer) self.count+=1 return self.map[singer] class Document: def __init__ (self): self.bufferList=[] self.tempo=80 self.refFreq=261.626 self.eventList=[] self.instCreator=DummyInstrumentCreator() self.percCreator=DummyPercussionCreator() self.singerCreator=DummySingerCreator() def getBuffer(self, bufferIndex): return self.bufferList[bufferIndex] def getTempo(self): return self.tempo def setTempo(self,tempo): self.tempo=tempo def getReferenceFrequency(self): return self.refFreq def setReferenceFrequency(self,refFreq): self.refFreq=refFreq def newBuf(self, chn=-1): buf=DummyTrackBuffer(self.eventList,chn) self.bufferList.append(buf) return len(self.bufferList)-1 def setTrackVolume(self, bufferIndex, volume): self.bufferList[bufferIndex].setVolume(volume) def setTrackPan(self, bufferIndex, pan): self.bufferList[bufferIndex].setPan(pan) def playNoteSeq(self, seq, instrument, bufferIndex=-1): dummyInst = self.instCreator.Create(instrument) if bufferIndex==-1: bufferIndex= self.newBuf() buf=self.bufferList[bufferIndex] dummyInst.play(buf, seq, self.tempo, self.refFreq) return bufferIndex def playBeatSeq(self, seq, percList, bufferIndex=-1): dummyPercList =[self.percCreator.Create(perc) for perc in percList] if bufferIndex==-1: bufferIndex= self.newBuf() buf=self.bufferList[bufferIndex] Percussion.play(dummyPercList, buf, seq, self.tempo) return bufferIndex def sing(self, seq, singer, bufferIndex=-1): dummySinger = self.singerCreator.Create(singer) if bufferIndex==-1: bufferIndex= self.newBuf() buf=self.bufferList[bufferIndex] dummySinger.sing( buf, seq, self.tempo, self.refFreq) return bufferIndex def trackToWav(self, bufferIndex, filename): WriteTrackBufferToWav(self.bufferList[bufferIndex], filename) def mix(self, targetBuf): MixTrackBufferList(targetBuf,self.bufferList) def mixDown(self,filename,chn=-1): targetBuf=TrackBuffer(chn) self.mix(targetBuf) WriteTrackBufferToWav(targetBuf, filename) def meteor(self,chn=-1): targetBuf=TrackBuffer(chn) self.mix(targetBuf) meteor = Meteor(self.eventList) MeteorPlay(meteor, targetBuf) def saveToFile(self,filename): meteor = Meteor(self.eventList) meteor.save_to_file(filename) ================================================ FILE: python/ScoreDraft/MusicXMLDocument.py ================================================ from .musicxml import ScorePartwise from xsdata.formats.dataclass.parsers import XmlParser try: from .Meteor import Document except: from .Document import Document import ly.musicxml def _find_tempo(score): for part in score.part: for measure in part.measure: direction = measure.direction if len(direction)>0: sound = direction[0].sound if not sound is None and not sound.tempo is None: return int(sound.tempo) return 120 _stepIdxs = { 'C': 0.0, 'D': 2.0, 'E': 4.0, 'F': 5.0, 'G': 7.0, 'A': 9.0, 'B': 11.0, } def _part_to_seq(part): attrtib = part.measure[0].attributes[0] divisions = int(attrtib.divisions) if 48 % divisions != 0: print('ScoreDraft cannot handle divisions: %d' % divisions) return [] seq = [] duration = 0 for measure in part.measure: for note in measure.note: if duration>0 and len(note.chord)>0: seq += [(-1.0, -duration)] freq = -1.0 if len(note.rest)<1 and len(note.pitch)>0: pitch = note.pitch[0] octave = float(pitch.octave) step_idx = _stepIdxs[pitch.step.name] if not pitch.alter is None: step_idx += float(pitch.alter) step_idx += (octave - 4.0)*12.0 freq = 2.0**(step_idx/12.0) duration = int(note.duration[0] * 48 / divisions) seq += [(freq, duration)] return seq class MusicXMLDocument(Document): def __init__(self, str_xml): Document.__init__(self) parser = XmlParser() self.score = parser.from_string(str_xml, ScorePartwise) self.tempo = _find_tempo(self.score) def playXML(self, instruments): for i in range(len(self.score.part)): j = i if j >= len(instruments): j = len(instruments) - 1 part = self.score.part[i] seq = _part_to_seq(part) self.playNoteSeq(seq, instruments[j]) def from_music_xml(filename): with open(filename, 'r') as file: return MusicXMLDocument(file.read()) def from_lilypond(filename): with open(filename, 'r') as file: e = ly.musicxml.writer() e.parse_text(file.read()) xml = e.musicxml() return MusicXMLDocument(xml.tostring().decode('utf-8')) ================================================ FILE: python/ScoreDraft/Notes.py ================================================ Freqs=[2.0**(v/12.0) for v in range(12)] fC=1.0 fCS=Freqs[1] fDb=Freqs[1] fD=Freqs[2] fDS=Freqs[3] fEb=Freqs[3] fE=Freqs[4] fF=Freqs[5] fFS=Freqs[6] fGb=Freqs[6] fG=Freqs[7] fGS=Freqs[8] fAb=Freqs[8] fA=Freqs[9] fAS=Freqs[10] fBb=Freqs[10] fB=Freqs[11] def note(octave, freq, duration): return (freq*(2.0**(octave-5.0)), duration) def do(octave=5, duration=48): return note(octave,Freqs[0],duration) def set_do(freq): Freqs[0]=freq def re(octave=5, duration=48): return note(octave,Freqs[2],duration) def set_re(freq): Freqs[2]=freq def mi(octave=5, duration=48): return note(octave,Freqs[4],duration) def set_mi(freq): Freqs[4]=freq def fa(octave=5, duration=48): return note(octave,Freqs[5],duration) def set_fa(freq): Freqs[5]=freq def so(octave=5, duration=48): return note(octave,Freqs[7],duration) def set_so(freq): Freqs[7]=freq def la(octave=5, duration=48): return note(octave,Freqs[9],duration) def set_la(freq): Freqs[9]=freq def ti(octave=5, duration=48): return note(octave,Freqs[11],duration) def set_ti(freq): Freqs[11]=freq def BL(duration=48): return (-1.0, duration) def BK(duration=48): return (-1.0, -duration) ================================================ FILE: python/ScoreDraft/PCMPlayer.py ================================================ import os import threading from cffi import FFI ffi = FFI() ffi.cdef(""" void* PCMPlayerCreate(double sample_rate, unsigned ui); void PCMPlayerDestroy(void* ptr); void PlayTrack(void* ptr, void* ptr_track); float GetRemainingTime(void* ptr); void MainLoop(void* ptr); """) if os.name == 'nt': fn_shared_lib = 'PCMPlayer.dll' elif os.name == "posix": fn_shared_lib = 'libPCMPlayer.so' path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) class PCMPlayer: def __init__(self, sample_rate = 44100.0, ui = False): self.m_cptr = Native.PCMPlayerCreate(sample_rate, ui) def __del__(self): Native.PCMPlayerDestroy(self.m_cptr) def play_track(self, track): Native.PlayTrack(self.m_cptr, track.m_cptr) def remaining_time(self): return Native.GetRemainingTime(self.m_cptr) def main_loop(self): Native.MainLoop(self.m_cptr) class AsyncUIPCMPlayer: def __init__(self, sample_rate = 44100.0): self.player = None self.player_ready = threading.Event() def _ui_thread(self): self.player = PCMPlayer(ui = True) self.player_ready.set() self.player.main_loop() self.player = None def play_track(self, track): if self.player is None: threading.Thread(target = self._ui_thread).start() self.player_ready.wait() self.player_ready.clear() self.player.play_track(track) def remaining_time(self): if self.player is None: return 0.0 return self.player.remaining_time() ================================================ FILE: python/ScoreDraft/Percussion.py ================================================ import numbers def isNumber(x): return isinstance(x, numbers.Number) def GetTempoMap(tMap, beat48): for i in range(1,len(tMap)): if beat48 < tMap[i][0] or i == len(tMap)-1: return (beat48-tMap[i-1][0])/(tMap[i][0]-tMap[i-1][0])*(tMap[i][1]-tMap[i-1][1])+tMap[i-1][1] return 0 class PercussionShell: def __init__(self): self.volume=1.0 self.pan=0.0 def tune(self,cmd): cmd_split= cmd.split(' ') cmd_len=len(cmd_split) if cmd_len>=1: if cmd_len>1 and cmd_split[0]=='volume': self.volume=float(cmd_split[1]) return True if cmd_len>1 and cmd_split[0]=='pan': self.pan=float(cmd_split[1]) return True return False def EnginePlayBeat(self, engine, buf, fduration): wavBuf=engine.generateWave(fduration, buf.getSampleRate()) if wavBuf!=None: wavBuf.set_volume(self.volume) wavBuf.set_pan(self.pan) buf.writeBlend(wavBuf) buf.moveCursor(fduration) def PlayBeatA(self, engine, buf, duration, tempoMap, tempoMapOffset): pos1 = tempoMapOffset pos2 = pos1 + duration fduration = GetTempoMap(tempoMap, pos2)- GetTempoMap(tempoMap, pos1) self.EnginePlayBeat (engine, buf, fduration) def PlayBeatB(self, engine, buf, duration, tempo): fduration=abs(duration*60000)/(tempo*48) self.EnginePlayBeat (engine, buf, fduration) @staticmethod def PlaySilenceA(buf, duration, tempoMap, tempoMapOffset): buf.setCursor(GetTempoMap(tempoMap, tempoMapOffset+duration)) @staticmethod def PlayBackspaceA(buf, duration, tempoMap, tempoMapOffset): buf.setCursor(GetTempoMap(tempoMap, tempoMapOffset-duration)) @staticmethod def PlaySilenceB(buf, duration, tempo): fduration=duration*60000/(tempo*48) buf.moveCursor(fduration) @staticmethod def PlayBackspaceB(buf, duration, tempo): fduration=duration*60000/(tempo*48) buf.moveCursor(-fduration) def PlaySequence(perc_list, buf, seq, tempo): using_tempo_map= (type(tempo)== list) tempo_map=[] if using_tempo_map: cursor = buf.getCursor() if tempo[0][0] == 0: cursor= tempo[0][1] buf.setCursor(cursor) else: ctrlPnt=(0, cursor) tempo_map+=[ctrlPnt] for ctrlPnt in tempo: tempo_map+=[ctrlPnt] beatPos=0 for item in seq: percId = item[0] operation = item[1] if isNumber(operation): duration = operation if using_tempo_map: if percId >= 0: perc_list[percId].shell.PlayBeatA(perc_list[percId].engine, buf, duration, tempo_map, beatPos) elif duration >=0: PercussionShell.PlaySilenceA(buf, duration, tempo_map, beatPos) else: PercussionShell.PlayBackspaceA(buf, -duration, tempo_map, beatPos) else: if percId >= 0: perc_list[percId].shell.PlayBeatB(perc_list[percId].engine, buf, duration, tempo) elif duration >=0: PercussionShell.PlaySilenceB(buf, duration, tempo) else: PercussionShell.PlayBackspaceB(buf, -duration, tempo) beatPos+=duration elif type(operation)== str: perc_list[percId].tune(operation) class Percussion: def __init__(self): self.shell=PercussionShell() @staticmethod def play(percList, buf, seq, tempo=80.0): PlaySequence(percList, buf, seq, tempo) def tune(self,cmd): if not self.shell.tune(cmd): self.engine.tune(cmd) def setBeatVolume(self,volume): self.shell.volume=volume def setBeatPan(self,pan): self.shell.pan=pan ================================================ FILE: python/ScoreDraft/RapChinese.py ================================================ baseFreq=1.0 def SetRapBaseFreq(freq): global baseFreq baseFreq=freq def CRap(lyric, tone, duration=48): if tone <= 1: return (lyric, duration, baseFreq, baseFreq) elif tone == 2: return (lyric, duration, baseFreq*0.7, baseFreq) elif tone == 3: return (lyric, duration, baseFreq*0.5, baseFreq*0.75) elif tone == 4: return (lyric, duration, baseFreq, baseFreq*0.5) else: return (lyric, duration, baseFreq*0.75, baseFreq*0.55) ================================================ FILE: python/ScoreDraft/ScoreDraftCore.py ================================================ import os from cffi import FFI ffi = FFI() ffi.cdef(""" // general void* PtrArrayCreate(unsigned long long size, const void** ptrs); void PtrArrayDestroy(void* ptr_arr); // F32Buf void* F32BufCreate(unsigned long long size, float value); void F32BufDestroy(void* ptr); float* F32BufData(void* ptr); int F32BufSize(void* ptr); void F32BufToS16(void* ptr, short* dst, float amplitude); void F32BufFromS16(void* ptr, const short* data, unsigned long long size); float F32BufMaxValue(void* ptr); void F32BufMix(void* ptr, void* ptr_lst); void* WavBufferCreate(float sampleRate, unsigned channelNum, void* ptr_data, unsigned alignPos, float volume, float pan); void WavBufferDestroy(void *ptr); float WavBufferGetSampleRate(void* ptr); unsigned WavBufferGetChannelNum(void *ptr); unsigned long long WavBufferGetSampleNum(void *ptr); unsigned WavBufferGetAlignPos(void* ptr); void WavBufferSetAlignPos(void* ptr, unsigned alignPos); float WavBufferGetVolume(void* ptr); void WavBufferSetVolume(void* ptr, float volume); float WavBufferGetPan(void* ptr); void WavBufferSetPan(void* ptr, float pan); void* TrackBufferCreate(unsigned chn); void TrackBufferDestroy(void* ptr); void TrackBufferSetVolume(void* ptr, float volume); float TrackBufferGetVolume(void* ptr); void TrackBufferSetPan(void* ptr, float pan); float TrackBufferGetPan(void* ptr); unsigned TrackBufferGetNumberOfSamples(void* ptr); unsigned TrackBufferGetAlignPos(void* ptr); float TrackBufferGetCursor(void* ptr); void TrackBufferSetCursor(void* ptr, float cursor); void TrackBufferMoveCursor(void* ptr, float cursor_delta); void MixTrackBufferList(void* ptr, void* ptr_list); void WriteTrackBufferToWav(void* ptr, const char* fn); void ReadTrackBufferFromWav(void* ptr, const char* fn); void TrackBufferWriteBlend(void* ptr, void* ptr_wav_buf); """) if os.name == 'nt': fn_shared_lib = 'ScoreDraftCore.dll' fs_encoding = "mbcs" elif os.name == "posix": fn_shared_lib = 'libScoreDraftCore.so' fs_encoding = "utf-8" path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) class ObjArray: def __init__(self, arr): self.m_arr = arr c_ptrs = [obj.m_cptr for obj in arr] self.m_cptr = Native.PtrArrayCreate(len(c_ptrs), c_ptrs) def __del__(self): Native.PtrArrayDestroy(self.m_cptr) class F32Buf: def __init__(self, size, value = 0.0): self.m_cptr = Native.F32BufCreate(size, value) def __del__(self): Native.F32BufDestroy(self.m_cptr) def data(self): return Native.F32BufData(self.m_cptr) def size(self): return Native.F32BufSize(self.m_cptr) def to_s16(self, amplitude): _size = self.size() s16 = bytearray(_size*2) ptr_s16 = ffi.from_buffer('short[]', s16) Native.F32BufToS16(self.m_cptr, ptr_s16, amplitude) return bytes(s16) @classmethod def from_s16(cls, s16): f32 = cls(0) ptr_s16 = ffi.from_buffer('const short[]', s16) Native.F32BufFromS16(f32.m_cptr, ptr_s16, len(s16)//2) return f32 def max_value(self): return Native.F32BufMaxValue(self.m_cptr) @classmethod def mix(cls, lst_bufs): f32 = cls() obj_lst = ObjArray(lst_bufs); Native.F32BufMix(f32.m_cptr, obj_lst.m_cptr) return f32 class WavBuffer: def __init__(self, sampleRate, channelNum, data, alignPos = 0, volume = 1.0, pan = 0.0): self.m_data = data self.m_cptr = Native.WavBufferCreate(sampleRate, channelNum, data.m_cptr, alignPos, volume, pan) def __del__(self): Native.WavBufferDestroy(self.m_cptr) def get_sample_rate(self): return Native.WavBufferGetSampleRate(self.m_cptr) def get_channel_num(self): return Native.WavBufferGetChannelNum(self.m_cptr) def get_sample_num(self): return Native.WavBufferGetSampleNum(self.m_cptr) def get_align_pos(self): return Native.WavBufferGetAlignPos(self.m_cptr) def set_align_pos(self, alignPos): Native.WavBufferSetAlignPos(self.m_cptr, alignPos) def get_volume(self): return Native.WavBufferGetVolume(self.m_cptr) def set_volume(self, volume): Native.WavBufferSetVolume(self.m_cptr, volume) def get_pan(self): return Native.WavBufferGetPan(self.m_cptr) def set_pan(self, pan): Native.WavBufferSetPan(self.m_cptr, pan) defaultNumOfChannels=2 def setDefaultNumberOfChannels(defChn): if defChn<1: defChn=1 elif defChn>2: defChn=2 global defaultNumOfChannels defaultNumOfChannels=defChn class TrackBuffer: ''' Basic data structure storing waveform. The content can either be generated by "play" and "sing" calls or by mixing track-buffer into a new one ''' def __init__ (self, chn=-1): ''' chn is the number of channels, which can be 1 or 2 ''' if chn==-1: chn=defaultNumOfChannels if chn<1: chn=1 elif chn>2: chn=2 self.m_cptr = Native.TrackBufferCreate(chn) def __del__(self): Native.TrackBufferDestroy(self.m_cptr) def getSampleRate(self): return 44100 # currently we always use a sample rate 44100.0 def setVolume(self,volume): ''' Set the volume of the track. This value is used as a weight when mixing tracks. volume -- a float value, in range [0.0,1.0] ''' Native.TrackBufferSetVolume(self.m_cptr, volume) def getVolume(self): ''' Get the volume of the track. This value is used as a weight when mixing tracks. Returned value is a float ''' return Native.TrackBufferGetVolume(self.m_cptr) def setPan(self, pan): ''' Set the panning of the track. This value is used when mixing tracks. pan -- a float value, in range [-1.0,1.0] ''' Native.TrackBufferSetPan(self.m_cptr, pan) def getPan(self): ''' Get the panning of the track. This value is used when mixing tracks. Returned value is a float ''' return Native.TrackBufferGetPan(self.m_cptr) def getNumberOfSamples(self): ''' Get the number of PCM samples of the buffer. Returned value is an integer ''' return Native.TrackBufferGetNumberOfSamples(self.m_cptr) def getNumberOfChannles(self): ''' Get the number of Channels of the buffer. Returned value is an integer ''' return Native.TrackBufferGetNumberOfChannels(self.m_cptr) def getAlignPosition(self): ''' Get the align position of the buffer The postion will be used as the logical original point when mixed with other track buffers The unit is in number of samples Returned value is an integer ''' return Native.TrackBufferGetAlignPos(self.m_cptr) def getCursor(self): ''' Get the cursor position of the buffer. The unit is in milliseconds. Returned value is a float ''' return Native.TrackBufferGetCursor(self.m_cptr) def setCursor(self, cursor): ''' Set the curosr position of the buffer. The unit is in milliseconds. cursor -- a float value, cursor >= 0.0 ''' Native.TrackBufferSetCursor(self.m_cptr, cursor) def moveCursor(self, cursor_delta): ''' Set the curosr position of the buffer to current position + cursor_delta. The unit is in milliseconds. cursor_delta -- a float value ''' Native.TrackBufferMoveCursor(self.m_cptr, cursor_delta) def writeBlend(self, wavBuf): ''' Write and blend a WavBuffer into current trackbuffer. Cursor will not be moved. Need another call to move the cursor. ''' Native.TrackBufferWriteBlend(self.m_cptr, wavBuf.m_cptr) def MixTrackBufferList (targetbuf, bufferList): ''' Function used to mix a list of track-buffers into another one targetbuf -- an instance of TrackBuffer to contain the result bufferList -- a list a track-buffers ''' arr = ObjArray(bufferList) Native.MixTrackBufferList(targetbuf.m_cptr, arr.m_cptr) def WriteTrackBufferToWav(buf, filename): ''' Function used to write a track-buffer to a .wav file. buf -- an instance of TrackBuffer filename -- a string ''' Native.WriteTrackBufferToWav(buf.m_cptr, filename.encode(fs_encoding)) def ReadTrackBufferFromWav(buf, filename): ''' Function used to read a track-buffer from a .wav file. buf -- an instance of TrackBuffer filename -- a string ''' Native.ReadTrackBufferFromWav(buf.m_cptr, filename.encode(fs_encoding)) ================================================ FILE: python/ScoreDraft/SimpleInstruments.py ================================================ import os from cffi import FFI ffi = FFI() ffi.cdef(""" void GeneratePureSin(void* ptr_wavbuf, float freq, float fduration); void GenerateSquare(void* ptr_wavbuf, float freq, float fduration); void GenerateTriangle(void* ptr_wavbuf, float freq, float fduration); void GenerateSawtooth(void* ptr_wavbuf, float freq, float fduration); void GenerateNaivePiano(void* ptr_wavbuf, float freq, float fduration); void GenerateBottleBlow(void* ptr_wavbuf, float freq, float fduration); """) if os.name == 'nt': fn_shared_lib = 'SimpleInstruments.dll' elif os.name == "posix": fn_shared_lib = 'libSimpleInstruments.so' path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) from .Instrument import Instrument from .ScoreDraftCore import F32Buf from .ScoreDraftCore import WavBuffer class Engine: def __init__(self, generator): self.generator= generator def tune(self, cmd): pass def generateWave(self, freq, fduration, sampleRate): wav = F32Buf(0) wav_buf = WavBuffer(sampleRate, 1, wav) self.generator(wav_buf.m_cptr, freq, fduration) return wav_buf def EnginePureSin(): return Engine(Native.GeneratePureSin) def EngineSquare(): return Engine(Native.GenerateSquare) def EngineTriangle(): return Engine(Native.GenerateTriangle) def EngineSawtooth(): return Engine(Native.GenerateSawtooth) def EngineNaivePiano(): return Engine(Native.GenerateNaivePiano) def EngineBottleBlow(): return Engine(Native.GenerateBottleBlow) class PureSin(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EnginePureSin() class Square(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EngineSquare() class Triangle(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EngineTriangle() class Sawtooth(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EngineSawtooth() class NaivePiano(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EngineNaivePiano() class BottleBlow(Instrument): def __init__(self): Instrument.__init__(self) self.engine = EngineBottleBlow() ================================================ FILE: python/ScoreDraft/Singer.py ================================================ import numbers def isNumber(x): return isinstance(x, numbers.Number) def GetTempoMap(tMap, beat48): for i in range(1,len(tMap)): if beat48 < tMap[i][0] or i == len(tMap)-1: return (beat48-tMap[i-1][0])/(tMap[i][0]-tMap[i-1][0])*(tMap[i][1]-tMap[i-1][1])+tMap[i-1][1] return 0 class SingerShell: def __init__(self): self.default_lyric='a' self.volume=1.0 self.pan=0.0 def tune(self,cmd): cmd_split= cmd.split(' ') cmd_len=len(cmd_split) if cmd_len>=1: if cmd_len>1 and cmd_split[0]=='default_lyric': self.default_lyric=cmd_split[1] return True if cmd_len>1 and cmd_split[0]=='volume': self.volume=float(cmd_split[1]) return True if cmd_len>1 and cmd_split[0]=='pan': self.pan=float(cmd_split[1]) return True return False def EngineSingSyllables(self,engine, buf, syllableList,totalDuration): wavBuf=engine.generateWave(syllableList, buf.getSampleRate()) if wavBuf!=None: wavBuf.set_volume(self.volume) wavBuf.set_pan(self.pan) buf.writeBlend(wavBuf) buf.moveCursor(totalDuration) def SingSyllablesA(self,engine, buf, syllables, tempoMap, tempoMapOffset, refFreq): syllableList=[] totalDuration = 0 beatPos = tempoMapOffset for syllable in syllables: ctrlPnts=[] for aCtrlPnt in syllable['ctrlPnts']: pos1=beatPos pos2 = pos1 + aCtrlPnt[1] fduration = abs(GetTempoMap(tempoMap, pos2)- GetTempoMap(tempoMap, pos1)) if aCtrlPnt[0]<0: if len(syllableList)>0 or len(ctrlPnts)>0: if len(ctrlPnts)>0: _syllable = { 'lyric': syllable['lyric'], 'ctrlPnts' : ctrlPnts } syllableList+=[_syllable] self.EngineSingSyllables(engine, buf, syllableList, totalDuration) ctrlPnts=[] syllableList=[] totalDuration = 0 if aCtrlPnt[1]>0: buf.moveCursor(fduration) elif aCtrlPnt[1]<0: buf.moveCursor(-fduration) continue freq= refFreq*aCtrlPnt[0] ctrlPnts+=[(freq, fduration)] totalDuration+=fduration beatPos = pos2; if len(ctrlPnts)>0: _syllable = { 'lyric': syllable['lyric'], 'ctrlPnts' : ctrlPnts } syllableList+=[_syllable] if len(syllableList)>0: self.EngineSingSyllables(engine, buf, syllableList, totalDuration) def SingSyllablesB(self, engine, buf, syllables, tempo, refFreq): syllableList=[] totalDuration = 0 for syllable in syllables: ctrlPnts=[] for aCtrlPnt in syllable['ctrlPnts']: fduration=abs(aCtrlPnt[1]*60000)/(tempo*48) if aCtrlPnt[0]<0: if len(syllableList) or len(ctrlPnts)>0: if len(ctrlPnts)>0: _syllable = { 'lyric': syllable['lyric'], 'ctrlPnts' : ctrlPnts } syllableList+=[_syllable] self.EngineSingSyllables(engine, buf, syllableList, totalDuration) ctrlPnts=[] syllableList=[] totalDuration = 0 if aCtrlPnt[1]>0: buf.moveCursor(fduration) elif aCtrlPnt[1]<0: buf.moveCursor(-fduration) continue freq= refFreq*aCtrlPnt[0] ctrlPnts+=[(freq, fduration)] totalDuration+=fduration if len(ctrlPnts)>0: _syllable = { 'lyric': syllable['lyric'], 'ctrlPnts' : ctrlPnts } syllableList+=[_syllable] if len(syllableList)>0: self.EngineSingSyllables(engine, buf, syllableList, totalDuration) def SingSequence(self,engine, buf, seq, tempo, refFreq): using_tempo_map= (type(tempo)== list) tempo_map=[] if using_tempo_map: cursor = buf.getCursor() if tempo[0][0] == 0: cursor= tempo[0][1] buf.setCursor(cursor) else: ctrlPnt=(0, cursor) tempo_map+=[ctrlPnt] for ctrlPnt in tempo: tempo_map+=[ctrlPnt] beatPos=0 for item in seq: if isinstance(item, (list, tuple)): _item = item[0] if type(_item) == str: # singing totalDuration = 0 syllables=[] tupleSize=len(item) j=0 while j 0 and lastCtrlPnt[1]>0: ctrlPnt=(lastCtrlPnt[0], 0) syllable['ctrlPnts']+=[ctrlPnt] j+=1 syllables+=[syllable] elif isNumber(_item): # singing rap syllable={'lyric': lyric, 'ctrlPnts':[]} duration = item[j] j+=1 freq1 = item[j] j+=1 freq2 = item[j] j+=1 if freq1 > 0 and freq2>0: syllable['ctrlPnts']+=[(freq1, duration), (freq2, 0)] else: syllable['ctrlPnts']+=[(-1, duration)] totalDuration += duration syllables+=[syllable] if len(syllables)>0: if using_tempo_map: self.SingSyllablesA(engine,buf, syllables, tempo_map, beatPos, refFreq) else: self.SingSyllablesB(engine,buf, syllables, tempo, refFreq) beatPos+=totalDuration elif isNumber(_item): # note syllable={'lyric': self.default_lyric, 'ctrlPnts':[(item[0],item[1])]} if item[0]>0: syllable['ctrlPnts']+=[(item[0],0)] if using_tempo_map: self.SingSyllablesA(engine,buf, [syllable], tempo_map, beatPos, refFreq) else: self.SingSyllablesB(engine,buf, [syllable], tempo, refFreq) beatPos+=item[1] elif type(item)== str: if not self.tune(engine,item): engine.tune(item) class Singer: def __init__(self): self.shell=SingerShell() def sing(self, buf, seq, tempo=80, refFreq=261.626): self.shell.SingSequence(self.engine, buf, seq, tempo,refFreq) def tune(self,cmd): if not self.shell.tune(cmd): self.engine.tune(cmd) def setDefaultLyric(self,defaultLyric): self.shell.default_lyric=defaultLyric def setNoteVolume(self,volume): self.shell.volume=volume def setNotePan(self,pan): self.shell.pan=pan ================================================ FILE: python/ScoreDraft/SoundFont2.py ================================================ import os from cffi import FFI ffi = FFI() ffi.cdef(""" // SF2Bank void* SF2BankCreate(const char* filename); void SF2BankDestroy(void* ptr); unsigned long long SF2BankGetNumberPresets(void* ptr); const char* SF2BankGetPresetName(void* ptr, int i); int SF2BankGetPresetBankNum(void* ptr, int i); int SF2BankGetPresetNumber(void* ptr, int i); // SF2Tone void* SF2ToneCreate(void* ptr_bank, unsigned preset_index); void SF2ToneDestroy(void* ptr); // SF2Synth void SF2SynthNote(void* ptr_wavbuf, void* ptr_tone, float key, float vel, unsigned numSamples, unsigned outputmode, float global_gain_db); """) if os.name == 'nt': fn_shared_lib = 'SoundFont2.dll' fs_encoding = "mbcs" elif os.name == "posix": fn_shared_lib = 'libSoundFont2.so' fs_encoding = "utf-8" path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) class SF2Bank: def __init__(self, filename): self.m_cptr = Native.SF2BankCreate(filename.encode(fs_encoding)) def __del__(self): Native.SF2BankDestroy(self.m_cptr) def num_presets(self): return Native.SF2BankGetNumberPresets(self.m_cptr) def get_preset_info(self, i): info = {} info['presetName'] = ffi.string(Native.SF2BankGetPresetName(self.m_cptr, i)).decode('utf-8') info['bank'] = Native.SF2BankGetPresetBankNum(self.m_cptr, i) info['preset'] = Native.SF2BankGetPresetNumber(self.m_cptr, i) return info SF2Banks={} def GetSF2Bank(filename): if not (filename in SF2Banks): SF2Banks[filename] = SF2Bank(filename) return SF2Banks[filename] def ListPresets(filename): sf2 = GetSF2Bank(filename) num_presets = sf2.num_presets() for i in range(num_presets): preset = sf2.get_preset_info(i) print ('%d : %s bank=%d number=%d' % (i, preset['presetName'], preset['bank'], preset['preset'])) import math from .ScoreDraftCore import F32Buf, WavBuffer from .Instrument import Instrument from .Catalog import Catalog Catalog['Engines'] += ['SF2Instrument - Instrument'] class EngineSoundFont2: def __init__(self, bank, preset_index): self.m_bank = bank self.m_preset_index = preset_index self.m_cptr = Native.SF2ToneCreate(bank.m_cptr, preset_index) self.global_gain_db = 0.0 self.vel = 1.0 def __del__(self): Native.SF2ToneDestroy(self.m_cptr) def isGMDrum(self): preset_info = self.m_bank.get_preset_info(self.m_preset_index) return preset_info['bank'] == 128 def tune(self, cmd): cmd_split= cmd.split(' ') cmd_len=len(cmd_split) if cmd_len>=1: if cmd_len>1 and cmd_split[0]=='velocity': self.vel = float(cmd_split[1]) return True return False def generateWave(self, freq, fduration, sampleRate): key = math.log(freq / 261.626)/math.log(2)*12.0+60.0 num_samples = int(fduration * sampleRate * 0.001+0.5) wav = F32Buf(0) wav_buf = WavBuffer(sampleRate, 1, wav) Native.SF2SynthNote(wav_buf.m_cptr, self.m_cptr, key, self.vel, num_samples, 0, self.global_gain_db) return wav_buf class SF2Instrument(Instrument): def __init__(self, fn, preset_index): Instrument.__init__(self) sf2 = GetSF2Bank(fn) self.engine= EngineSoundFont2(sf2, preset_index) def isGMDrum(self): return self.engine.isGMDrum() ================================================ FILE: python/ScoreDraft/TTEnglishConverter.py ================================================ import os import pickle ScoreDraftPath= os.path.dirname(__file__) lyricSet=set() lyricPrefixSet=set() vowelSet={'eI','aI','aU','OI','oU','3','i','I','U','u','E','{','A','V','O','@'} vowelPrefixSet=set() atomicSet={'tS','dZ','dr','tr'} def BuildLyricSet(): with open(ScoreDraftPath+'/UTAUVoice/TetoEng/Teto/oto.ini', 'r') as f: while True: line = f.readline() if not line: break p1 = line.find('=') if p1==-1: continue fn=line[0:p1-4] p2 = line.find(',',p1) if p2==-1: continue lyric=line[p1+1:p2] if lyric=='': lyric=fn lyricSet.add(lyric) with open(ScoreDraftPath+'/TTLyricSet.data','wb') as f: pickle.dump(lyricSet,f) def LoadLyricSet(): with open(ScoreDraftPath+'/TTLyricSet.data','rb') as f: global lyricSet lyricSet=pickle.load(f) #BuildLyricSet() LoadLyricSet() for lyric in lyricSet: for i in range(len(lyric)): if lyric[i]==' ': continue lyricPrefixSet.add(lyric[0:i+1]) for vowel in vowelSet: for i in range(len(vowel)): vowelPrefixSet.add(vowel[0:i+1]) def TTEnglishConverter(inList): inList_a=[] for inLyric in inList: lyric_a=[] i=0 while i0: if prefix=='-' or cur[1]>0 or vowelMap[cur[0]][0]==0: test_seg = prefix + inList_a[cur[0]][cur[1]] if test_seg in lyricPrefixSet: break test_seg = prefix +' '+inList_a[cur[0]][cur[1]] if test_seg in lyricPrefixSet: break prefix=prefix[1:len(prefix)] #pass2 nextStart=cur[:] seg='' isVowel=False while True: seg='' lastSeg=prefix[:] cur2=cur[:] isVowel=False while True: spaceMust=False newChar='' if not (cur2[0]0: spaceMust=True if lastSeg=='' and cur[0]=vowelMap[cur[0]][0] and cur[1]=vowelMap[cur[0]][0] and cur[1]=len(inList_a[cur2[0]]): cur2[0]+=1 cur2[1]=0 if seg!='': break if len(seg)>0 or len(prefix)==0: break prefix=prefix[1:len(prefix)] if len(seg)>0: outList+=[(seg, iIn, isVowel)] if not (cur[0]=len(inList_a[cur[0]]): cur[0]+=1 cur[1]=0 pos=nextStart[:] prefix='' while pos[0]=len(inList_a[pos[0]]): pos[0]+=1 pos[1]=0 ret=[] syllable=() iSyllable=0 for i in range(len(outList)): outItem=outList[i] if outItem[1]!=iSyllable: ret+=[syllable] syllable=() iSyllable=outItem[1] weight=0.1 if outItem[2]: weight=0.4 syllable+=(outItem[0], weight, outItem[2]) ret+=[syllable] #print(ret) return ret ================================================ FILE: python/ScoreDraft/TsuroVCVConverter.py ================================================ def getVowel(CVLyric): vowels= ["a","e","i","o","u","v"] min_i=len(CVLyric) for c in vowels: i=CVLyric.find(c) if i>-1 and i0: v= vowels[i-1] ret+=[(v+' '+LyricForEachSyllable[i], 1.0, True)] return ret ================================================ FILE: python/ScoreDraft/UTAUUtils.py ================================================ from .VoiceSampler import FrqDataPoint,FrqData import struct import os import math import re def LoadFrq(filename): with open(filename, 'rb') as f: f.seek(8,0) interval= struct.unpack('i',f.read(4))[0] f.seek(12,0) key = struct.unpack('d', f.read(8))[0] f.seek(36,0) count = struct.unpack('i', f.read(4))[0] f.seek(40,0) data=[] for i in range(count): (freq, dyn) = struct.unpack('dd', f.read(16)) data+=[FrqDataPoint(freq,dyn)] frq = FrqData() frq.set(interval, key, data) return frq def LoadOtoINIPath(otoMap, path, encoding): otoIniPath=path+'/oto.ini' with open(otoIniPath,'r', encoding=encoding) as f: while True: line = f.readline() if not line: break line=line.strip('\n') p = line.find('=') if p==-1: continue fn=line[0:p] p+=1 # lyric lyric='' p2 = line.find(',',p) if p2==-1: continue if p2>p: lyric=line[p:p2] p=p2+1 if len(lyric)==0: lyric = fn[0:len(fn)-4] # offset offset=0 p2 = line.find(',',p) if p2==-1: continue if p2>p: offset=float(line[p:p2]) p=p2+1 # consonant consonant = 0 p2 = line.find(',',p) if p2==-1: continue if p2>p: consonant=float(line[p:p2]) p=p2+1 # cutoff cutoff = 0 p2 = line.find(',',p) if p2==-1: continue if p2>p: cutoff=float(line[p:p2]) p=p2+1 # preutter preutterance = 0 p2 = line.find(',',p) if p2==-1: continue if p2>p: preutterance=float(line[p:p2]) p=p2+1 # overlap overlap = 0 if len(line[p:])>0: overlap=float(line[p:]) properties={ 'filename': path+'/'+fn, 'offset': offset, 'consonant': consonant, 'cutoff': cutoff, 'preutterance': preutterance, 'overlap': overlap } otoMap[lyric]=properties def LoadPrefixMap(filename): prefixMap={} with open(filename,'r') as f: while True: line = f.readline() if not line: break words=re.findall(r"[^\s]+", line) prefix='' if len(words)>1: prefix=words[1] if len(words)>0: prefixMap[words[0]]=prefix return prefixMap centerC=440.0 * (2.0** (- 9.0 / 12.0)) # C4 lowest = centerC * (2.0** (- 3.0)) # C1 highest = centerC * (2.0**( 3.0 + 11.0 / 12.0)) #B7 nameMap= [ 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'] def LookUpPrefixMap(prefixMap, freq): name='' if freq<=lowest: name='C1' elif freq>=highest: name='B7' else: fPitch = math.log(freq / centerC) / math.log(2.0) + 4.0 octave = int(fPitch) pitchInOctave = int((fPitch-octave)*12.0) if pitchInOctave==12: pitchInOctave = 0 octave+=1 name = nameMap[pitchInOctave]+str(octave) if name in prefixMap: return prefixMap[name] else: return '' class VoiceBank: def __init__ (self, path): self.path=path self.otoMap={} self.prefixMap={} self.encoding='shift-jis' if os.name == 'nt': self.fsEncoding = 'mbcs' else: self.fsEncoding = 'gbk' self.wavFileNameTranscode=True self.frqFileNameTranscode=True self.initialized=False def buildOtoMap(self,path): for item in os.walk(path): if os.path.isfile(item[0]+'/oto.ini'): LoadOtoINIPath(self.otoMap, item[0], self.encoding) def initialize(self): self.buildOtoMap(self.path) if os.path.isfile(self.path+'/prefix.map'): self.prefixMap=LoadPrefixMap(self.path+'/prefix.map') self.initialized=True def getWavFrq(self,lyric): if not (lyric in self.otoMap): print("missed lyic: "+ lyric) return None wav=self.otoMap[lyric].copy() wavFileName=wav['filename'] if self.wavFileNameTranscode: wav['filename']=wavFileName.encode(self.encoding).decode(self.fsEncoding) frqFileName=wavFileName[0:len(wavFileName)-4]+'_wav.frq' if self.frqFileNameTranscode: frqFileName=frqFileName.encode(self.encoding).decode(self.fsEncoding) frq=LoadFrq(frqFileName) return (wav,frq) def getWavFrq_PrefixMap(self,lyric, freq): if len(self.prefixMap)>0: lyric+=LookUpPrefixMap(self.prefixMap, freq) return self.getWavFrq(lyric) ================================================ FILE: python/ScoreDraft/UtauDraft.py ================================================ import wave from .ScoreDraftCore import F32Buf from .UTAUUtils import VoiceBank from .Singer import Singer from .Catalog import Catalog Catalog['Engines'] += ['UtauDraft - Singing'] # VoiceSampler notVowel = 0 preVowel = 1 isVowel = 2 from .VoiceSampler import GenerateSentence from .VoiceSampler import GenerateSentenceCUDA VoiceBanks={} def loadWav(file): wavS16=bytes() with wave.open(file, mode='rb') as wavFile: wavS16=wavFile.readframes(wavFile.getnframes()) return F32Buf.from_s16(wavS16) def GetVoiceBank(path): if not (path in VoiceBanks): VoiceBanks[path ]= VoiceBank(path) return VoiceBanks[path] def _PieceMapper(syllableLyricList, lyricList, otoList, CZMode=False): transition = 0.1 result= { 'maps': [], 'piece_map': [] } maps= result['maps'] map1=[(otoList[0][1], otoList[0][1]- otoList[0][2], notVowel)] maps+=[map1] map0 = map1 map1 = [] piece_map = result['piece_map'] piece_map += [(0,0)] cursor=0 for i in range(len(lyricList)): piece = lyricList[i] piece_oto = otoList[i] piece_oto_next = None if i0 and srcTotalLen=1: if cmd_len>1 and cmd_split[0]=='prefix_map': if cmd_split[1]=='on': self.usePrefixMap = True return True elif cmd_split[1]=='off': self.usePrefixMap = False return True return False def _convertLyric(self, syllableList): convertedList = self.lyricConverter([syllable['lyric'] for syllable in syllableList]) lyricList=[] for i in range(len(convertedList)): convertedSyllable= convertedList[i] sumWeight=0 for j in range(len(convertedSyllable)//3): sumWeight += convertedSyllable[j*3+1] for j in range(len(convertedSyllable)//3): piece={ 'lyric': convertedSyllable[j*3], 'weight': convertedSyllable[j*3+1]/sumWeight, 'isVowel': convertedSyllable[j*3+2], 'syllableId': i } lyricList+=[piece] return lyricList def generateWave(self, syllableList, sampleRate): # print(syllableList) syllableLyricList=[] totalDuration=0 for syllable in syllableList: aveFreq=0 duration=0 for j in range(len(syllable['ctrlPnts'])): ctrlPnt=syllable['ctrlPnts'][j] if ctrlPnt[1] <=0: continue freq1 = ctrlPnt[0] freq2 = freq1 if j < len(syllable['ctrlPnts']) -1: freq2 = syllable['ctrlPnts'][j+1][0] aveFreq +=(freq1 + freq2) * ctrlPnt[1] duration+=ctrlPnt[1] aveFreq *= 1.0/duration*0.5; syllablePiece={ 'lyric': syllable['lyric'], 'duration' : duration, 'aveFreq': aveFreq } syllableLyricList+=[syllablePiece] totalDuration+=duration lyricList=[] if self.lyricConverter == None: for i in range(len(syllableLyricList)): syllablePiece=syllableLyricList[i] piece={ 'lyric': syllablePiece['lyric'], 'weight': 1.0, 'isVowel': True, 'syllableId': i } lyricList+=[piece] else: lyricList=self._convertLyric(syllableLyricList) srcList = [] otoList = [] for piece in lyricList: wavFrq= self.voiceBank.getWavFrq_PrefixMap(piece['lyric'], syllableLyricList[piece['syllableId']]['aveFreq']) wavFileName=wavFrq[0]['filename'] wav = loadWav(wavFileName) srcList += [ { 'wav': wav, 'frq': wavFrq[1] } ] start = wavFrq[0]['offset'] overlap = start + wavFrq[0]['overlap'] preutterance = start + wavFrq[0]['preutterance'] consonant = start + wavFrq[0]['consonant'] oto_cutoff= wavFrq[0]['cutoff'] end = 0 if oto_cutoff >=0: end = wav.size()/44.1 - oto_cutoff else: end = start - oto_cutoff otoList += [(start, overlap, preutterance, consonant, end)] piece_map = self.pieceMapper(syllableLyricList, lyricList, otoList) sentence= { 'pieces': [], 'piece_map': [], 'freq_map': [], 'volume_map': [] } for i in range(len(lyricList)): sentence['pieces']+=[ { 'src': srcList[i], 'map': piece_map['maps'][i] } ] sentence['piece_map'] = piece_map['piece_map'] freq_map= sentence['freq_map'] cursor=0 for syllable in syllableList: for ctrlPnt in syllable['ctrlPnts']: freq_map+=[(ctrlPnt[0], cursor)] cursor+=ctrlPnt[1] volume_map = sentence['volume_map'] volume_map += [(1.0, 0)] last_duration = syllableLyricList[len(syllableLyricList)-1]['duration'] volume_map += [(1.0, totalDuration-last_duration*0.1)] volume_map += [(0.0, totalDuration)] if self.useCUDA: return GenerateSentenceCUDA(sentence) else: return GenerateSentence(sentence) class UtauDraft(Singer): def __init__(self, voiceBank, useCUDA=True): Singer.__init__(self) self.engine=Engine(voiceBank) self.engine.useCUDA=useCUDA def setLyricConverter(self, lyricConverter): self.engine.lyricConverter=lyricConverter def setPieceMapper(self, pieceMapper): self.engine.pieceMapper=pieceMapper def setUsePrefixMap(self,usePrefixMap): self.engine.usePrefixMap=usePrefixMap def setCZMode(self): self.engine.pieceMapper= CZPieceMapper ================================================ FILE: python/ScoreDraft/VCCVEnglishConverter.py ================================================ import os import pickle ScoreDraftPath= os.path.dirname(__file__) lyricSet=set() lyricPrefixSet=set() vowelSet={'a','e','i','o','u','E','9','3','@','A','I','O','8','Q','6','x','&','1','0'} vowelPrefixSet=set() atomicSet={'ch','dh','sh','th','zh','ng','Ang','dr','tr'} def BuildLyricSet(): with open(ScoreDraftPath+'/UTAUVoice/Yami/D4/oto.ini', 'r') as f: while True: line = f.readline() if not line: break p1 = line.find('=') if p1==-1: continue fn=line[0:p1-4] p2 = line.find(',',p1) if p2==-1: continue lyric=line[p1+1:p2] if lyric=='': lyric=fn lyricSet.add(lyric) with open(ScoreDraftPath+'/VCCVLyricSet.data','wb') as f: pickle.dump(lyricSet,f) def LoadLyricSet(): with open(ScoreDraftPath+'/VCCVLyricSet.data','rb') as f: global lyricSet lyricSet=pickle.load(f) #BuildLyricSet() LoadLyricSet() for lyric in lyricSet: for i in range(len(lyric)): if lyric[i]==' ': continue lyricPrefixSet.add(lyric[0:i+1]) for vowel in vowelSet: for i in range(len(vowel)): vowelPrefixSet.add(vowel[0:i+1]) def VCCVEnglishConverter(inList): inList_a=[] for inLyric in inList: lyric_a=[] i=0 while i0: if prefix=='-' or cur[1]>0 or vowelMap[cur[0]][0]==0: test_seg = prefix + inList_a[cur[0]][cur[1]] if test_seg in lyricPrefixSet: break test_seg = prefix +' '+inList_a[cur[0]][cur[1]] if test_seg in lyricPrefixSet: break prefix=prefix[1:len(prefix)] #pass2 nextStart=cur[:] seg='' isVowel=False while True: seg='' lastSeg=prefix[:] cur2=cur[:] isVowel=False while True: spaceMust=False newChar='' if not (cur2[0]0: spaceMust=True if lastSeg=='' and cur[0]=vowelMap[cur[0]][0] and cur[1]=vowelMap[cur[0]][0] and cur[1]=len(inList_a[cur2[0]]): cur2[0]+=1 cur2[1]=0 if seg!='': break if len(seg)>0 or len(prefix)==0: break prefix=prefix[1:len(prefix)] if len(seg)>0: outList+=[(seg, iIn, isVowel)] if not (cur[0]=len(inList_a[cur[0]]): cur[0]+=1 cur[1]=0 pos=nextStart[:] prefix='' while pos[0]=len(inList_a[pos[0]]): pos[0]+=1 pos[1]=0 ret=[] syllable=() iSyllable=0 for i in range(len(outList)): outItem=outList[i] if outItem[1]!=iSyllable: ret+=[syllable] syllable=() iSyllable=outItem[1] weight=0.1 if outItem[2]: weight=0.4 syllable+=(outItem[0], weight, outItem[2]) ret+=[syllable] #print(ret) return ret ================================================ FILE: python/ScoreDraft/VoiceSampler.py ================================================ import os from cffi import FFI ffi = FFI() ffi.cdef(""" unsigned HaveCUDA(); void* FrqDataPointCreate(double freq, double dyn); void FrqDataPointDestroy(void* ptr); void* FrqDataCreate(); void FrqDataDestroy(void* ptr); void FrqDataSet(void* ptr, int interval, double key, void* ptr_data_points); void FrqDataDetect(void* ptr, void* ptr_f32_buf, int interval); void* SourceMapCtrlPntCreate(float srcPos, float dstPos, int isVowel); void SourceMapCtrlPntDestroy(void* ptr); void* PieceCreate(void* ptr_f32buf, void* ptr_frq_data, void* ptr_src_map); void PieceDestroy(void* ptr); void* GeneralCtrlPntCreate(float value, float dstPos); void GeneralCtrlPntDestroy(void* ptr); void* SentenceDescriptorCreate(void* ptr_pieces, void* ptr_piece_map, void* ptr_freq_map, void* ptr_volume_map); void SentenceDescriptorDestroy(void* ptr); void GenerateSentence(void* ptr_wavbuf, void* ptr_sentence); void GenerateSentenceCUDA(void* ptr_wavbuf, void* ptr_sentence); """) if os.name == 'nt': fn_shared_lib = 'VoiceSampler.dll' elif os.name == "posix": fn_shared_lib = 'libVoiceSampler.so' path_shared_lib = os.path.dirname(__file__)+"/"+fn_shared_lib Native = ffi.dlopen(path_shared_lib) from .ScoreDraftCore import ObjArray, F32Buf, WavBuffer def HaveCUDA(): return Native.HaveCUDA() != 0 class FrqDataPoint: def __init__(self, freq, dyn): self.m_cptr = Native.FrqDataPointCreate(freq, dyn) def __del__(self): Native.FrqDataPointDestroy(self.m_cptr) class FrqData: def __init__(self): self.m_cptr = Native.FrqDataCreate() def __del__(self): Native.FrqDataDestroy(self.m_cptr) def set(self, interval, key, lst_data_points): obj_arr = ObjArray(lst_data_points) Native.FrqDataSet(self.m_cptr, interval, key, obj_arr.m_cptr) def detect(self, f32_buf, interval): Native.FrqDataDetect(self.m_cptr, f32_buf.m_cptr, interval) class SourceMapCtrlPnt: def __init__(self, srcPos, dstPos, isVowel): self.m_cptr = Native.SourceMapCtrlPntCreate(srcPos, dstPos, isVowel) def __del__(self): Native.SourceMapCtrlPntDestroy(self.m_cptr) class Piece: def __init__(self, f32buf, frq_data, src_map): self.m_buf = f32buf obj_arr = ObjArray(src_map) self.m_cptr = Native.PieceCreate(f32buf.m_cptr, frq_data.m_cptr, obj_arr.m_cptr) def __del__(self): Native.PieceDestroy(self.m_cptr) class GeneralCtrlPnt: def __init__(self, value, dstPos): self.m_cptr = Native.GeneralCtrlPntCreate(value, dstPos) def __del__(self): Native.GeneralCtrlPntDestroy(self.m_cptr) class SentenceDescriptor: def __init__(self, pieces, piece_map, freq_map, volume_map): self.m_pieces = pieces obj_pieces = ObjArray(pieces) obj_piece_map = ObjArray(piece_map) obj_freq_map = ObjArray(freq_map) obj_volume_map = ObjArray(volume_map) self.m_cptr = Native.SentenceDescriptorCreate(obj_pieces.m_cptr, obj_piece_map.m_cptr, obj_freq_map.m_cptr, obj_volume_map.m_cptr) def __del__(self): Native.SentenceDescriptorDestroy(self.m_cptr) def CreateSentenceDescriptor(desc_dictionary): lst_pieces = desc_dictionary["pieces"] pieces = [] for obj_piece in lst_pieces: obj_src = obj_piece["src"] wav = obj_src["wav"] frq_data = obj_src["frq"] lst_map = obj_piece["map"] src_map = [] num_ctrlpnts = len(lst_map) for j in range(num_ctrlpnts): tuple_ctrlpnt = lst_map[j] src_pos = tuple_ctrlpnt[0] dst_pos = tuple_ctrlpnt[1] if j < num_ctrlpnts - 1: isVowel = tuple_ctrlpnt[2] else: isVowel = 0 src_map += [SourceMapCtrlPnt(src_pos, dst_pos, isVowel)] pieces += [Piece(wav, frq_data, src_map)] lst_piece_map = desc_dictionary["piece_map"] piece_map = [GeneralCtrlPnt(tuple_ctrlpnt[0], tuple_ctrlpnt[1]) for tuple_ctrlpnt in lst_piece_map] lst_freq_map = desc_dictionary["freq_map"] freq_map = [GeneralCtrlPnt(tuple_ctrlpnt[0], tuple_ctrlpnt[1]) for tuple_ctrlpnt in lst_freq_map] lst_volume_map = desc_dictionary["volume_map"] volume_map = [GeneralCtrlPnt(tuple_ctrlpnt[0], tuple_ctrlpnt[1]) for tuple_ctrlpnt in lst_volume_map] return SentenceDescriptor(pieces, piece_map, freq_map, volume_map) def GenerateSentence(desc_dictionary): sentence_desc = CreateSentenceDescriptor(desc_dictionary) wav = F32Buf(0) wav_buf = WavBuffer(44100.0, 1, wav) Native.GenerateSentence(wav_buf.m_cptr, sentence_desc.m_cptr) return wav_buf def GenerateSentenceCUDA(desc_dictionary): sentence_desc = CreateSentenceDescriptor(desc_dictionary) wav = F32Buf(0) wav_buf = WavBuffer(44100.0, 1, wav) Native.GenerateSentenceCUDA(wav_buf.m_cptr, sentence_desc.m_cptr) return wav_buf ================================================ FILE: python/ScoreDraft/XiaYYConverter.py ================================================ def getCV(CVLyric): vowels= ["a","e","i","o","u","v"] min_i=len(CVLyric) for c in vowels: i=CVLyric.find(c) if i>-1 and i0 and text[-1] == '.': end_sentence = True text = text[0: -1] if text!="": syllables += [(text, end_sentence)] num_syll = len(syllables) seq = [] sentence = [] i_syll = 0 new_syll = True slur = False for measure in part.measure: for note in measure.note: freq = -1.0 if len(note.rest)<1 and len(note.pitch)>0: pitch = note.pitch[0] octave = float(pitch.octave) step_idx = _stepIdxs[pitch.step.name] if not pitch.alter is None: step_idx += float(pitch.alter) step_idx += (octave - 4.0)*12.0 freq = 2.0**(step_idx/12.0) duration = int(note.duration[0] * 48 / divisions) if freq < 0.0: if len(sentence)>0: seq += [sentence] sentence = [] new_syll = True seq += [(freq, duration)] slur = False else: if len(note.notations)>0: if len(note.notations[0].slur)>0: if note.notations[0].slur[0].type.value=="start": slur = True elif note.notations[0].slur[0].type.value=="stop": slur = False if new_syll: sentence += [syllables[i_syll][0]] sentence += [(freq, duration)] if slur: new_syll = False else: new_syll = True if i_syll < num_syll -1: i_syll += 1 if syllables[i_syll][1]: seq += [sentence] sentence = [] if len(sentence)>0: seq += [sentence] sentence = [] idx = self.sing(seq, track_info['singer']) self.setTrackVolume(idx, track_info['volume']) self.setTrackPan(idx, track_info['pan']) continue sustain_ranges = [] if i < num_parts - 1 and self.tracks[i+1]['type'] == "pedal": part_s = self.score.part[i + 1] attrtib_s = part_s.measure[0].attributes[0] divisions_s = int(attrtib_s.divisions) if 48 % divisions_s != 0: print('ScoreDraft cannot handle divisions: %d' % divisions_s) continue pos = 0 for measure in part_s.measure: for note in measure.note: duration = int(note.duration[0] * 48 / divisions_s) if len(note.rest)<1: sustain_ranges += [(pos, pos + duration)] pos += duration # part -> seq attrtib = part.measure[0].attributes[0] divisions = int(attrtib.divisions) if 48 % divisions != 0: print('ScoreDraft cannot handle divisions: %d' % divisions) continue seq = [] duration = 0 pos = 0 i_range = 0 slur = False for measure in part.measure: for note in measure.note: sustain = False while i_range < len(sustain_ranges): if pos >= sustain_ranges[i_range][0]: if pos < sustain_ranges[i_range][1]: sustain = True break else: i_range += 1 else: break freq = -1.0 if len(note.rest)<1 and len(note.pitch)>0: pitch = note.pitch[0] octave = float(pitch.octave) step_idx = _stepIdxs[pitch.step.name] if not pitch.alter is None: step_idx += float(pitch.alter) step_idx += (octave - 4.0)*12.0 freq = 2.0**(step_idx/12.0) if duration>0 and len(note.chord)>0: if track_info['sweep']>0: duration = int(duration*(1.0 - track_info['sweep'])) seq += [(-1.0, -duration)] pos -= duration else: duration = int(note.duration[0] * 48 / divisions) if sustain: seq += [[freq, sustain_ranges[i_range][1] - pos]] seq += [[-1.0, pos + duration -sustain_ranges[i_range][1]]] else: if len(seq)>0 and slur and freq == seq[len(seq)-1][0]: seq[len(seq)-1][1] += duration else: seq += [[freq, duration]] pos += duration if len(note.notations)>0: if len(note.notations[0].slur)>0: if note.notations[0].slur[0].type.value=="start": slur = True elif note.notations[0].slur[0].type.value=="stop": slur = False idx = self.playNoteSeq(seq, track_info['instrument']) self.setTrackVolume(idx, track_info['volume']) self.setTrackPan(idx, track_info['pan']) ================================================ FILE: python/ScoreDraft/__init__.py ================================================ import numbers def isNumber(x): return isinstance(x, numbers.Number) def TellDuration(seq): duration = 0 for item in seq: if isinstance(item, (list, tuple)): _item = item[0] if type(_item) == str: # singing tupleSize=len(item) j=0 while j
TlGW'b)Tq7VT9q^*^$$.:&N@@" "$&)WHtPm*5_rO0&e%K&#-30j(E4#'Zb.o/(Tpm$>K'f@[PvFl,hfINTNU6u'0pao7%XUp9]5.>%h`8_=VYbxuel.NTSsJfLacFu3B'lQSu/m6-Oqem8T+oE--$0a/k]uj9EwsG>%veR*" "hv^BFpQj:K'#SJ,sB-'#](j.Lg92rTw-*n%@/;39rrJF,l#qV%OrtBeC6/,;qB3ebNW[?,Hqj2L.1NP&GjUR=1D8QaS3Up&@*9wP?+lo7b?@%'k4`p0Z$22%K3+iCZj?XJN4Nm&+YF]u" "@-W$U%VEQ/,,>>#)D#%8cY#YZ?=,`Wdxu/ae&#" "w6)R89tI#6@s'(6Bf7a&?S=^ZI_kS&ai`&=tE72L_D,;^R)7[$so8lKN%5/$(vdfq7+ebA#" "u1p]ovUKW&Y%q]'>$1@-[xfn$7ZTp7mM,G,Ko7a&Gu%G[RMxJs[0MM%wci.LFDK)(%:_i2B5CsR8&9Z&#=mPEnm0f`<&c)QL5uJ#%u%lJj+D-r;BoFDoS97h5g)E#o:&S4weDF,9^Hoe`h*L+_a*NrLW-1pG_&2UdB8" "6e%B/:=>)N4xeW.*wft-;$'58-ESqr#U`'6AQ]m&6/`Z>#S?YY#Vc;r7U2&326d=w&H####?TZ`*4?&.MK?LP8Vxg>$[QXc%QJv92.(Db*B)gb*BM9dM*hJMAo*c&#" "b0v=Pjer]$gG&JXDf->'StvU7505l9$AFvgYRI^&<^b68?j#q9QX4SM'RO#&sL1IM.rJfLUAj221]d##DW=m83u5;'bYx,*Sl0hL(W;;$doB&O/TQ:(Z^xBdLjLV#*8U_72Lh+2Q8Cj0i:6hp&$C/:p(HK>T8Y[gHQ4`4)'$Ab(Nof%V'8hL&#SfD07&6D@M.*J:;$-rv29'M]8qMv-tLp,'886iaC=Hb*YJoKJ,(j%K=H`K.v9HggqBIiZu'QvBT.#=)0ukruV&.)3=(^1`o*Pj4<-#MJ+gLq9-##@HuZPN0]u:h7.T..G:;$/Usj(T7`Q8tT72LnYl<-qx8;-HV7Q-&Xdx%1a,hC=0u+HlsV>nuIQL-5" "_>@kXQtMacfD.m-VAb8;IReM3$wf0''hra*so568'Ip&vRs849'MRYSp%:t:h5qSgwpEr$B>Q,;s(C#$)`svQuF$##-D,##,g68@2[T;.XSdN9Qe)rpt._K-#5wF)sP'##p#C0c%-Gb%" "hd+<-j'Ai*x&&HMkT]C'OSl##5RG[JXaHN;d'uA#x._U;.`PU@(Z3dt4r152@:v,'R.Sj'w#0<-;kPI)FfJ&#AYJ&#//)>-k=m=*XnK$>=)72L]0I%>.G690a:$##<,);?;72#?x9+d;" "^V'9;jY@;)br#q^YQpx:X#Te$Z^'=-=bGhLf:D6&bNwZ9-ZD#n^9HhLMr5G;']d&6'wYmTFmLq9wI>P(9mI[>kC-ekLC/R&CH+s'B;K-M6$EB%is00:" "+A4[7xks.LrNk0&E)wILYF@2L'0Nb$+pv<(2.768/FrY&h$^3i&@+G%JT'<-,v`3;_)I9M^AE]CN?Cl2AZg+%4iTpT3$U4O]GKx'm9)b@p7YsvK3w^YR-" "CdQ*:Ir<($u&)#(&?L9Rg3H)4fiEp^iI9O8KnTj,]H?D*r7'M;PwZ9K0E^k&-cpI;.p/6_vwoFMV<->#%Xi.LxVnrU(4&8/P+:hLSKj$#U%]49t'I:rgMi'FL@a:0Y-uA[39',(vbma*" "hU%<-SRF`Tt:542R_VV$p@[p8DV[A,?1839FWdFTi1O*H&#(AL8[_P%.M>v^-))qOT*F5Cq0`Ye%+$B6i:7@0IXSsDiWP,##P`%/L-" "S(qw%sf/@%#B6;/U7K]uZbi^Oc^2n%t<)'mEVE''n`WnJra$^TKvX5B>;_aSEK',(hwa0:i4G?.Bci.(X[?b*($,=-n<.Q%`(X=?+@Am*Js0&=3bh8K]mL69=Lb,OcZV/);TTm8VI;?%OtJ<(b4mq7M6:u?KRdFl*:xP?Yb.5)%w_I?7uk5JC+FS(m#i'k.'a0i)9<7b'fs'59hq$*5Uhv##pi^8+hIEBF`nvo`;'l0.^S1<-wUK2/Coh58KKhLj" "M=SO*rfO`+qC`W-On.=AJ56>>i2@2LH6A:&5q`?9I3@@'04&p2/LVa*T-4<-i3;M9UvZd+N7>b*eIwg:CC)c<>nO&#$(>.Z-I&J(Q0Hd5Q%7Co-b`-cP)hI;*_F]u`Rb[.j8_Q/<&>uu+VsH$sM9TA%?)(vmJ80),P7E>)tjD%2L=-t#fK[%`v=Q8WlA2);Sa" ">gXm8YB`1d@K#n]76-a$U,mF%Ul:#/'xoFM9QX-$.QN'>" "[%$Z$uF6pA6Ki2O5:8w*vP1<-1`[G,)-m#>0`P&#eb#.3i)rtB61(o'$?X3B2Qft^ae_5tKL9MUe9b*sLEQ95C&`=G?@Mj=wh*'3E>=-<)Gt*Iw)'QG:`@I" "wOf7&]1i'S01B+Ev/Nac#9S;=;YQpg_6U`*kVY39xK,[/6Aj7:'1Bm-_1EYfa1+o&o4hp7KN_Q(OlIo@S%;jVdn0'1h19w,WQhLI)3S#f$2(eb,jr*b;3Vw]*7NH%$c4Vs,eD9>XW8?N]o+(*pgC%/72LV-uW%iewS8W6m2rtCpo'RS1R84=@paTKt)>=%&1[)*vp'u+x,VrwN;&]kuO9JDbg=pO$J*.jVe;u'm0dr9l,<*wMK*Oe=g8lV_KEBFkO'oU]^=[-792#ok,)" "i]lR8qQ2oA8wcRCZ^7w/Njh;?.stX?Q1>S1q4Bn$)K1<-rGdO'$Wr.Lc.CG)$/*JL4tNR/,SVO3,aUw'DJN:)Ss;wGn9A32ijw%FL+Z0Fn.U9;reSq)bmI32U==5ALuG&#Vf1398/pVo" "1*c-(aY168o<`JsSbk-,1N;$>0:OUas(3:8Z972LSfF8eb=c-;>SPw7.6hn3m`9^Xkn(r.qS[0;T%&Qc=+STRxX'q1BNk3&*eu2;&8q$&x>Q#Q7^Tf+6<(d%ZVmj2bDi%.3L2n+4W'$P" "iDDG)g,r%+?,$@?uou5tSe2aN_AQU*'IAO" "URQ##V^Fv-XFbGM7Fl(N<3DhLGF%q.1rC$#:T__&Pi68%0xi_&[qFJ(77j_&JWoF.V735&T,[R*:xFR*K5>>#`bW-?4Ne_&6Ne_&6Ne_&n`kr-#GJcM6X;uM6X;uM(.a..^2TkL%oR(#" ";u.T%fAr%4tJ8&><1=GHZ_+m9/#H1F^R#SC#*N=BA9(D?v[UiFY>>^8p,KKF.W]L29uLkLlu/+4T" "w$)F./^n3+rlo+DB;5sIYGNk+i1t-69Jg--0pao7Sm#K)pdHW&;LuDNH@H>#/X-TI(;P>#,Gc>#0Su>#4`1?#8lC?#xL$#B.`$#F:r$#JF.%#NR@%#R_R%#Vke%#Zww%#_-4^Rh%Sflr-k'MS.o?.5/sWel/wpEM0%3'/1)K^f1-d>G21&v(35>V`39V7A4=onx4" "A1OY5EI0;6Ibgr6M$HS7Q<)58C5w,;WoA*#[%T*#`1g*#d=#+#hI5+#lUG+#pbY+#tnl+#x$),#&1;,#*=M,#.I`,#2Ur,#6b.-#;w[H#iQtA#m^0B#qjBB#uvTB##-hB#'9$C#+E6C#" "/QHC#3^ZC#7jmC#;v)D#?,)4kMYD4lVu`4m`:&5niUA5@(A5BA1]PBB:xlBCC=2CDLXMCEUtiCf&0g2'tN?PGT4CPGT4CPGT4CPGT4CPGT4CPGT4CPGT4CP" "GT4CPGT4CPGT4CPGT4CPGT4CPGT4CP-qekC`.9kEg^+F$kwViFJTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5o,^<-28ZI'O?;xp" "O?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xp;7q-#lLYI:xvD=#"; #endif /* NK_INCLUDE_DEFAULT_FONT */ #define NK_CURSOR_DATA_W 90 #define NK_CURSOR_DATA_H 27 NK_GLOBAL const char nk_custom_cursor_data[NK_CURSOR_DATA_W * NK_CURSOR_DATA_H + 1] = { "..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX" "..- -X.....X- X.X - X.X -X.....X - X.....X" "--- -XXX.XXX- X...X - X...X -X....X - X....X" "X - X.X - X.....X - X.....X -X...X - X...X" "XX - X.X -X.......X- X.......X -X..X.X - X.X..X" "X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X" "X..X - X.X - X.X - X.X -XX X.X - X.X XX" "X...X - X.X - X.X - XX X.X XX - 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...XXXXXX.XXXXXX...X - X.X XX-XX 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...XXXXXX.XXXXXX...X - X.X..X-X..X.X " "X.........X -XXX.XXX- 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......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X " "X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX " "X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------" "X.X X..X - -X.......X- X.......X - XX XX - " "XX X..X - - X.....X - X.....X - X.X X.X - " " X..X - X...X - X...X - X..X X..X - " " XX - X.X - X.X - X...XXXXXXXXXXXXX...X - " "------------ - X - X -X.....................X- " " ----------------------------------- X...XXXXXXXXXXXXX...X - " " - X..X X..X - " " - X.X X.X - " " - XX XX - " }; #ifdef __clang__ #pragma clang diagnostic pop #elif defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic pop #endif NK_GLOBAL unsigned char *nk__barrier; NK_GLOBAL unsigned char *nk__barrier2; NK_GLOBAL unsigned char *nk__barrier3; NK_GLOBAL unsigned char *nk__barrier4; NK_GLOBAL unsigned char *nk__dout; NK_INTERN unsigned int nk_decompress_length(unsigned char *input) { return (unsigned int)((input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11]); } NK_INTERN void nk__match(unsigned char *data, unsigned int length) { /* INVERSE of memmove... write each byte before copying the next...*/ NK_ASSERT (nk__dout + length <= nk__barrier); if (nk__dout + length > nk__barrier) { nk__dout += length; return; } if (data < nk__barrier4) { nk__dout = nk__barrier+1; return; } while (length--) *nk__dout++ = *data++; } NK_INTERN void nk__lit(unsigned char *data, unsigned int length) { NK_ASSERT (nk__dout + length <= nk__barrier); if (nk__dout + length > nk__barrier) { nk__dout += length; return; } if (data < nk__barrier2) { nk__dout = nk__barrier+1; return; } NK_MEMCPY(nk__dout, data, length); nk__dout += length; } NK_INTERN unsigned char* nk_decompress_token(unsigned char *i) { #define nk__in2(x) ((i[x] << 8) + i[(x)+1]) #define nk__in3(x) ((i[x] << 16) + nk__in2((x)+1)) #define nk__in4(x) ((i[x] << 24) + nk__in3((x)+1)) if (*i >= 0x20) { /* use fewer if's for cases that expand small */ if (*i >= 0x80) nk__match(nk__dout-i[1]-1, (unsigned int)i[0] - 0x80 + 1), i += 2; else if (*i >= 0x40) nk__match(nk__dout-(nk__in2(0) - 0x4000 + 1), (unsigned int)i[2]+1), i += 3; else /* *i >= 0x20 */ nk__lit(i+1, (unsigned int)i[0] - 0x20 + 1), i += 1 + (i[0] - 0x20 + 1); } else { /* more ifs for cases that expand large, since overhead is amortized */ if (*i >= 0x18) nk__match(nk__dout-(unsigned int)(nk__in3(0) - 0x180000 + 1), (unsigned int)i[3]+1), i += 4; else if (*i >= 0x10) nk__match(nk__dout-(unsigned int)(nk__in3(0) - 0x100000 + 1), (unsigned int)nk__in2(3)+1), i += 5; else if (*i >= 0x08) nk__lit(i+2, (unsigned int)nk__in2(0) - 0x0800 + 1), i += 2 + (nk__in2(0) - 0x0800 + 1); else if (*i == 0x07) nk__lit(i+3, (unsigned int)nk__in2(1) + 1), i += 3 + (nk__in2(1) + 1); else if (*i == 0x06) nk__match(nk__dout-(unsigned int)(nk__in3(1)+1), i[4]+1u), i += 5; else if (*i == 0x04) nk__match(nk__dout-(unsigned int)(nk__in3(1)+1), (unsigned int)nk__in2(4)+1u), i += 6; } return i; } NK_INTERN unsigned int nk_adler32(unsigned int adler32, unsigned char *buffer, unsigned int buflen) { const unsigned long ADLER_MOD = 65521; unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16; unsigned long blocklen, i; blocklen = buflen % 5552; while (buflen) { for (i=0; i + 7 < blocklen; i += 8) { s1 += buffer[0]; s2 += s1; s1 += buffer[1]; s2 += s1; s1 += buffer[2]; s2 += s1; s1 += buffer[3]; s2 += s1; s1 += buffer[4]; s2 += s1; s1 += buffer[5]; s2 += s1; s1 += buffer[6]; s2 += s1; s1 += buffer[7]; s2 += s1; buffer += 8; } for (; i < blocklen; ++i) { s1 += *buffer++; s2 += s1; } s1 %= ADLER_MOD; s2 %= ADLER_MOD; buflen -= (unsigned int)blocklen; blocklen = 5552; } return (unsigned int)(s2 << 16) + (unsigned int)s1; } NK_INTERN unsigned int nk_decompress(unsigned char *output, unsigned char *i, unsigned int length) { unsigned int olen; if (nk__in4(0) != 0x57bC0000) return 0; if (nk__in4(4) != 0) return 0; /* error! stream is > 4GB */ olen = nk_decompress_length(i); nk__barrier2 = i; nk__barrier3 = i+length; nk__barrier = output + olen; nk__barrier4 = output; i += 16; nk__dout = output; for (;;) { unsigned char *old_i = i; i = nk_decompress_token(i); if (i == old_i) { if (*i == 0x05 && i[1] == 0xfa) { NK_ASSERT(nk__dout == output + olen); if (nk__dout != output + olen) return 0; if (nk_adler32(1, output, olen) != (unsigned int) nk__in4(2)) return 0; return olen; } else { NK_ASSERT(0); /* NOTREACHED */ return 0; } } NK_ASSERT(nk__dout <= output + olen); if (nk__dout > output + olen) return 0; } } NK_INTERN unsigned int nk_decode_85_byte(char c) { return (unsigned int)((c >= '\\') ? c-36 : c-35); } NK_INTERN void nk_decode_85(unsigned char* dst, const unsigned char* src) { while (*src) { unsigned int tmp = nk_decode_85_byte((char)src[0]) + 85 * (nk_decode_85_byte((char)src[1]) + 85 * (nk_decode_85_byte((char)src[2]) + 85 * (nk_decode_85_byte((char)src[3]) + 85 * nk_decode_85_byte((char)src[4])))); /* we can't assume little-endianess. */ dst[0] = (unsigned char)((tmp >> 0) & 0xFF); dst[1] = (unsigned char)((tmp >> 8) & 0xFF); dst[2] = (unsigned char)((tmp >> 16) & 0xFF); dst[3] = (unsigned char)((tmp >> 24) & 0xFF); src += 5; dst += 4; } } /* ------------------------------------------------------------- * * FONT ATLAS * * --------------------------------------------------------------*/ NK_API struct nk_font_config nk_font_config(float pixel_height) { struct nk_font_config cfg; nk_zero_struct(cfg); cfg.ttf_blob = 0; cfg.ttf_size = 0; cfg.ttf_data_owned_by_atlas = 0; cfg.size = pixel_height; cfg.oversample_h = 3; cfg.oversample_v = 1; cfg.pixel_snap = 0; cfg.coord_type = NK_COORD_UV; cfg.spacing = nk_vec2(0,0); cfg.range = nk_font_default_glyph_ranges(); cfg.merge_mode = 0; cfg.fallback_glyph = '?'; cfg.font = 0; cfg.n = 0; return cfg; } #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API void nk_font_atlas_init_default(struct nk_font_atlas *atlas) { NK_ASSERT(atlas); if (!atlas) return; nk_zero_struct(*atlas); atlas->temporary.userdata.ptr = 0; atlas->temporary.alloc = nk_malloc; atlas->temporary.free = nk_mfree; atlas->permanent.userdata.ptr = 0; atlas->permanent.alloc = nk_malloc; atlas->permanent.free = nk_mfree; } #endif NK_API void nk_font_atlas_init(struct nk_font_atlas *atlas, struct nk_allocator *alloc) { NK_ASSERT(atlas); NK_ASSERT(alloc); if (!atlas || !alloc) return; nk_zero_struct(*atlas); atlas->permanent = *alloc; atlas->temporary = *alloc; } NK_API void nk_font_atlas_init_custom(struct nk_font_atlas *atlas, struct nk_allocator *permanent, struct nk_allocator *temporary) { NK_ASSERT(atlas); NK_ASSERT(permanent); NK_ASSERT(temporary); if (!atlas || !permanent || !temporary) return; nk_zero_struct(*atlas); atlas->permanent = *permanent; atlas->temporary = *temporary; } NK_API void nk_font_atlas_begin(struct nk_font_atlas *atlas) { NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc && atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc && atlas->permanent.free); if (!atlas || !atlas->permanent.alloc || !atlas->permanent.free || !atlas->temporary.alloc || !atlas->temporary.free) return; if (atlas->glyphs) { atlas->permanent.free(atlas->permanent.userdata, atlas->glyphs); atlas->glyphs = 0; } if (atlas->pixel) { atlas->permanent.free(atlas->permanent.userdata, atlas->pixel); atlas->pixel = 0; } } NK_API struct nk_font* nk_font_atlas_add(struct nk_font_atlas *atlas, const struct nk_font_config *config) { struct nk_font *font = 0; struct nk_font_config *cfg; NK_ASSERT(atlas); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(config); NK_ASSERT(config->ttf_blob); NK_ASSERT(config->ttf_size); NK_ASSERT(config->size > 0.0f); if (!atlas || !config || !config->ttf_blob || !config->ttf_size || config->size <= 0.0f|| !atlas->permanent.alloc || !atlas->permanent.free || !atlas->temporary.alloc || !atlas->temporary.free) return 0; /* allocate font config */ cfg = (struct nk_font_config*) atlas->permanent.alloc(atlas->permanent.userdata,0, sizeof(struct nk_font_config)); NK_MEMCPY(cfg, config, sizeof(*config)); cfg->n = cfg; cfg->p = cfg; if (!config->merge_mode) { /* insert font config into list */ if (!atlas->config) { atlas->config = cfg; cfg->next = 0; } else { struct nk_font_config *i = atlas->config; while (i->next) i = i->next; i->next = cfg; cfg->next = 0; } /* allocate new font */ font = (struct nk_font*) atlas->permanent.alloc(atlas->permanent.userdata,0, sizeof(struct nk_font)); NK_ASSERT(font); nk_zero(font, sizeof(*font)); if (!font) return 0; font->config = cfg; /* insert font into list */ if (!atlas->fonts) { atlas->fonts = font; font->next = 0; } else { struct nk_font *i = atlas->fonts; while (i->next) i = i->next; i->next = font; font->next = 0; } cfg->font = &font->info; } else { /* extend previously added font */ struct nk_font *f = 0; struct nk_font_config *c = 0; NK_ASSERT(atlas->font_num); f = atlas->fonts; c = f->config; cfg->font = &f->info; cfg->n = c; cfg->p = c->p; c->p->n = cfg; c->p = cfg; } /* create own copy of .TTF font blob */ if (!config->ttf_data_owned_by_atlas) { cfg->ttf_blob = atlas->permanent.alloc(atlas->permanent.userdata,0, cfg->ttf_size); NK_ASSERT(cfg->ttf_blob); if (!cfg->ttf_blob) { atlas->font_num++; return 0; } NK_MEMCPY(cfg->ttf_blob, config->ttf_blob, cfg->ttf_size); cfg->ttf_data_owned_by_atlas = 1; } atlas->font_num++; return font; } NK_API struct nk_font* nk_font_atlas_add_from_memory(struct nk_font_atlas *atlas, void *memory, nk_size size, float height, const struct nk_font_config *config) { struct nk_font_config cfg; NK_ASSERT(memory); NK_ASSERT(size); NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); if (!atlas || !atlas->temporary.alloc || !atlas->temporary.free || !memory || !size || !atlas->permanent.alloc || !atlas->permanent.free) return 0; cfg = (config) ? *config: nk_font_config(height); cfg.ttf_blob = memory; cfg.ttf_size = size; cfg.size = height; cfg.ttf_data_owned_by_atlas = 0; return nk_font_atlas_add(atlas, &cfg); } #ifdef NK_INCLUDE_STANDARD_IO NK_API struct nk_font* nk_font_atlas_add_from_file(struct nk_font_atlas *atlas, const char *file_path, float height, const struct nk_font_config *config) { nk_size size; char *memory; struct nk_font_config cfg; NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); if (!atlas || !file_path) return 0; memory = nk_file_load(file_path, &size, &atlas->permanent); if (!memory) return 0; cfg = (config) ? *config: nk_font_config(height); cfg.ttf_blob = memory; cfg.ttf_size = size; cfg.size = height; cfg.ttf_data_owned_by_atlas = 1; return nk_font_atlas_add(atlas, &cfg); } #endif NK_API struct nk_font* nk_font_atlas_add_compressed(struct nk_font_atlas *atlas, void *compressed_data, nk_size compressed_size, float height, const struct nk_font_config *config) { unsigned int decompressed_size; void *decompressed_data; struct nk_font_config cfg; NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); NK_ASSERT(compressed_data); NK_ASSERT(compressed_size); if (!atlas || !compressed_data || !atlas->temporary.alloc || !atlas->temporary.free || !atlas->permanent.alloc || !atlas->permanent.free) return 0; decompressed_size = nk_decompress_length((unsigned char*)compressed_data); decompressed_data = atlas->permanent.alloc(atlas->permanent.userdata,0,decompressed_size); NK_ASSERT(decompressed_data); if (!decompressed_data) return 0; nk_decompress((unsigned char*)decompressed_data, (unsigned char*)compressed_data, (unsigned int)compressed_size); cfg = (config) ? *config: nk_font_config(height); cfg.ttf_blob = decompressed_data; cfg.ttf_size = decompressed_size; cfg.size = height; cfg.ttf_data_owned_by_atlas = 1; return nk_font_atlas_add(atlas, &cfg); } NK_API struct nk_font* nk_font_atlas_add_compressed_base85(struct nk_font_atlas *atlas, const char *data_base85, float height, const struct nk_font_config *config) { int compressed_size; void *compressed_data; struct nk_font *font; NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); NK_ASSERT(data_base85); if (!atlas || !data_base85 || !atlas->temporary.alloc || !atlas->temporary.free || !atlas->permanent.alloc || !atlas->permanent.free) return 0; compressed_size = (((int)nk_strlen(data_base85) + 4) / 5) * 4; compressed_data = atlas->temporary.alloc(atlas->temporary.userdata,0, (nk_size)compressed_size); NK_ASSERT(compressed_data); if (!compressed_data) return 0; nk_decode_85((unsigned char*)compressed_data, (const unsigned char*)data_base85); font = nk_font_atlas_add_compressed(atlas, compressed_data, (nk_size)compressed_size, height, config); atlas->temporary.free(atlas->temporary.userdata, compressed_data); return font; } #ifdef NK_INCLUDE_DEFAULT_FONT NK_API struct nk_font* nk_font_atlas_add_default(struct nk_font_atlas *atlas, float pixel_height, const struct nk_font_config *config) { NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); return nk_font_atlas_add_compressed_base85(atlas, nk_proggy_clean_ttf_compressed_data_base85, pixel_height, config); } #endif NK_API const void* nk_font_atlas_bake(struct nk_font_atlas *atlas, int *width, int *height, enum nk_font_atlas_format fmt) { int i = 0; void *tmp = 0; nk_size tmp_size, img_size; struct nk_font *font_iter; struct nk_font_baker *baker; NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); NK_ASSERT(width); NK_ASSERT(height); if (!atlas || !width || !height || !atlas->temporary.alloc || !atlas->temporary.free || !atlas->permanent.alloc || !atlas->permanent.free) return 0; #ifdef NK_INCLUDE_DEFAULT_FONT /* no font added so just use default font */ if (!atlas->font_num) atlas->default_font = nk_font_atlas_add_default(atlas, 13.0f, 0); #endif NK_ASSERT(atlas->font_num); if (!atlas->font_num) return 0; /* allocate temporary baker memory required for the baking process */ nk_font_baker_memory(&tmp_size, &atlas->glyph_count, atlas->config, atlas->font_num); tmp = atlas->temporary.alloc(atlas->temporary.userdata,0, tmp_size); NK_ASSERT(tmp); if (!tmp) goto failed; /* allocate glyph memory for all fonts */ baker = nk_font_baker(tmp, atlas->glyph_count, atlas->font_num, &atlas->temporary); atlas->glyphs = (struct nk_font_glyph*)atlas->permanent.alloc( atlas->permanent.userdata,0, sizeof(struct nk_font_glyph)*(nk_size)atlas->glyph_count); NK_ASSERT(atlas->glyphs); if (!atlas->glyphs) goto failed; /* pack all glyphs into a tight fit space */ atlas->custom.w = (NK_CURSOR_DATA_W*2)+1; atlas->custom.h = NK_CURSOR_DATA_H + 1; if (!nk_font_bake_pack(baker, &img_size, width, height, &atlas->custom, atlas->config, atlas->font_num, &atlas->temporary)) goto failed; /* allocate memory for the baked image font atlas */ atlas->pixel = atlas->temporary.alloc(atlas->temporary.userdata,0, img_size); NK_ASSERT(atlas->pixel); if (!atlas->pixel) goto failed; /* bake glyphs and custom white pixel into image */ nk_font_bake(baker, atlas->pixel, *width, *height, atlas->glyphs, atlas->glyph_count, atlas->config, atlas->font_num); nk_font_bake_custom_data(atlas->pixel, *width, *height, atlas->custom, nk_custom_cursor_data, NK_CURSOR_DATA_W, NK_CURSOR_DATA_H, '.', 'X'); if (fmt == NK_FONT_ATLAS_RGBA32) { /* convert alpha8 image into rgba32 image */ void *img_rgba = atlas->temporary.alloc(atlas->temporary.userdata,0, (nk_size)(*width * *height * 4)); NK_ASSERT(img_rgba); if (!img_rgba) goto failed; nk_font_bake_convert(img_rgba, *width, *height, atlas->pixel); atlas->temporary.free(atlas->temporary.userdata, atlas->pixel); atlas->pixel = img_rgba; } atlas->tex_width = *width; atlas->tex_height = *height; /* initialize each font */ for (font_iter = atlas->fonts; font_iter; font_iter = font_iter->next) { struct nk_font *font = font_iter; struct nk_font_config *config = font->config; nk_font_init(font, config->size, config->fallback_glyph, atlas->glyphs, config->font, nk_handle_ptr(0)); } /* initialize each cursor */ {NK_STORAGE const struct nk_vec2 nk_cursor_data[NK_CURSOR_COUNT][3] = { /* Pos Size Offset */ {{ 0, 3}, {12,19}, { 0, 0}}, {{13, 0}, { 7,16}, { 4, 8}}, {{31, 0}, {23,23}, {11,11}}, {{21, 0}, { 9, 23}, { 5,11}}, {{55,18}, {23, 9}, {11, 5}}, {{73, 0}, {17,17}, { 9, 9}}, {{55, 0}, {17,17}, { 9, 9}} }; for (i = 0; i < NK_CURSOR_COUNT; ++i) { struct nk_cursor *cursor = &atlas->cursors[i]; cursor->img.w = (unsigned short)*width; cursor->img.h = (unsigned short)*height; cursor->img.region[0] = (unsigned short)(atlas->custom.x + nk_cursor_data[i][0].x); cursor->img.region[1] = (unsigned short)(atlas->custom.y + nk_cursor_data[i][0].y); cursor->img.region[2] = (unsigned short)nk_cursor_data[i][1].x; cursor->img.region[3] = (unsigned short)nk_cursor_data[i][1].y; cursor->size = nk_cursor_data[i][1]; cursor->offset = nk_cursor_data[i][2]; }} /* free temporary memory */ atlas->temporary.free(atlas->temporary.userdata, tmp); return atlas->pixel; failed: /* error so cleanup all memory */ if (tmp) atlas->temporary.free(atlas->temporary.userdata, tmp); if (atlas->glyphs) { atlas->permanent.free(atlas->permanent.userdata, atlas->glyphs); atlas->glyphs = 0; } if (atlas->pixel) { atlas->temporary.free(atlas->temporary.userdata, atlas->pixel); atlas->pixel = 0; } return 0; } NK_API void nk_font_atlas_end(struct nk_font_atlas *atlas, nk_handle texture, struct nk_draw_null_texture *null) { int i = 0; struct nk_font *font_iter; NK_ASSERT(atlas); if (!atlas) { if (!null) return; null->texture = texture; null->uv = nk_vec2(0.5f,0.5f); } if (null) { null->texture = texture; null->uv.x = (atlas->custom.x + 0.5f)/(float)atlas->tex_width; null->uv.y = (atlas->custom.y + 0.5f)/(float)atlas->tex_height; } for (font_iter = atlas->fonts; font_iter; font_iter = font_iter->next) { font_iter->texture = texture; #ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT font_iter->handle.texture = texture; #endif } for (i = 0; i < NK_CURSOR_COUNT; ++i) atlas->cursors[i].img.handle = texture; atlas->temporary.free(atlas->temporary.userdata, atlas->pixel); atlas->pixel = 0; atlas->tex_width = 0; atlas->tex_height = 0; atlas->custom.x = 0; atlas->custom.y = 0; atlas->custom.w = 0; atlas->custom.h = 0; } NK_API void nk_font_atlas_cleanup(struct nk_font_atlas *atlas) { NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); if (!atlas || !atlas->permanent.alloc || !atlas->permanent.free) return; if (atlas->config) { struct nk_font_config *iter; for (iter = atlas->config; iter; iter = iter->next) { struct nk_font_config *i; for (i = iter->n; i != iter; i = i->n) { atlas->permanent.free(atlas->permanent.userdata, i->ttf_blob); i->ttf_blob = 0; } atlas->permanent.free(atlas->permanent.userdata, iter->ttf_blob); iter->ttf_blob = 0; } } } NK_API void nk_font_atlas_clear(struct nk_font_atlas *atlas) { NK_ASSERT(atlas); NK_ASSERT(atlas->temporary.alloc); NK_ASSERT(atlas->temporary.free); NK_ASSERT(atlas->permanent.alloc); NK_ASSERT(atlas->permanent.free); if (!atlas || !atlas->permanent.alloc || !atlas->permanent.free) return; if (atlas->config) { struct nk_font_config *iter, *next; for (iter = atlas->config; iter; iter = next) { struct nk_font_config *i, *n; for (i = iter->n; i != iter; i = n) { n = i->n; if (i->ttf_blob) atlas->permanent.free(atlas->permanent.userdata, i->ttf_blob); atlas->permanent.free(atlas->permanent.userdata, i); } next = iter->next; if (i->ttf_blob) atlas->permanent.free(atlas->permanent.userdata, iter->ttf_blob); atlas->permanent.free(atlas->permanent.userdata, iter); } atlas->config = 0; } if (atlas->fonts) { struct nk_font *iter, *next; for (iter = atlas->fonts; iter; iter = next) { next = iter->next; atlas->permanent.free(atlas->permanent.userdata, iter); } atlas->fonts = 0; } if (atlas->glyphs) atlas->permanent.free(atlas->permanent.userdata, atlas->glyphs); nk_zero_struct(*atlas); } #endif /* =============================================================== * * INPUT * * ===============================================================*/ NK_API void nk_input_begin(struct nk_context *ctx) { int i; struct nk_input *in; NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; for (i = 0; i < NK_BUTTON_MAX; ++i) in->mouse.buttons[i].clicked = 0; in->keyboard.text_len = 0; in->mouse.scroll_delta = nk_vec2(0,0); in->mouse.prev.x = in->mouse.pos.x; in->mouse.prev.y = in->mouse.pos.y; in->mouse.delta.x = 0; in->mouse.delta.y = 0; for (i = 0; i < NK_KEY_MAX; i++) in->keyboard.keys[i].clicked = 0; } NK_API void nk_input_end(struct nk_context *ctx) { struct nk_input *in; NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; if (in->mouse.grab) in->mouse.grab = 0; if (in->mouse.ungrab) { in->mouse.grabbed = 0; in->mouse.ungrab = 0; in->mouse.grab = 0; } } NK_API void nk_input_motion(struct nk_context *ctx, int x, int y) { struct nk_input *in; NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; in->mouse.pos.x = (float)x; in->mouse.pos.y = (float)y; in->mouse.delta.x = in->mouse.pos.x - in->mouse.prev.x; in->mouse.delta.y = in->mouse.pos.y - in->mouse.prev.y; } NK_API void nk_input_key(struct nk_context *ctx, enum nk_keys key, int down) { struct nk_input *in; NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; if (in->keyboard.keys[key].down != down) in->keyboard.keys[key].clicked++; in->keyboard.keys[key].down = down; } NK_API void nk_input_button(struct nk_context *ctx, enum nk_buttons id, int x, int y, int down) { struct nk_mouse_button *btn; struct nk_input *in; NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; if (in->mouse.buttons[id].down == down) return; btn = &in->mouse.buttons[id]; btn->clicked_pos.x = (float)x; btn->clicked_pos.y = (float)y; btn->down = down; btn->clicked++; } NK_API void nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val) { NK_ASSERT(ctx); if (!ctx) return; ctx->input.mouse.scroll_delta.x += val.x; ctx->input.mouse.scroll_delta.y += val.y; } NK_API void nk_input_glyph(struct nk_context *ctx, const nk_glyph glyph) { int len = 0; nk_rune unicode; struct nk_input *in; NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; len = nk_utf_decode(glyph, &unicode, NK_UTF_SIZE); if (len && ((in->keyboard.text_len + len) < NK_INPUT_MAX)) { nk_utf_encode(unicode, &in->keyboard.text[in->keyboard.text_len], NK_INPUT_MAX - in->keyboard.text_len); in->keyboard.text_len += len; } } NK_API void nk_input_char(struct nk_context *ctx, char c) { nk_glyph glyph; NK_ASSERT(ctx); if (!ctx) return; glyph[0] = c; nk_input_glyph(ctx, glyph); } NK_API void nk_input_unicode(struct nk_context *ctx, nk_rune unicode) { nk_glyph rune; NK_ASSERT(ctx); if (!ctx) return; nk_utf_encode(unicode, rune, NK_UTF_SIZE); nk_input_glyph(ctx, rune); } NK_API int nk_input_has_mouse_click(const struct nk_input *i, enum nk_buttons id) { const struct nk_mouse_button *btn; if (!i) return nk_false; btn = &i->mouse.buttons[id]; return (btn->clicked && btn->down == nk_false) ? nk_true : nk_false; } NK_API int nk_input_has_mouse_click_in_rect(const struct nk_input *i, enum nk_buttons id, struct nk_rect b) { const struct nk_mouse_button *btn; if (!i) return nk_false; btn = &i->mouse.buttons[id]; if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h)) return nk_false; return nk_true; } NK_API int nk_input_has_mouse_click_down_in_rect(const struct nk_input *i, enum nk_buttons id, struct nk_rect b, int down) { const struct nk_mouse_button *btn; if (!i) return nk_false; btn = &i->mouse.buttons[id]; return nk_input_has_mouse_click_in_rect(i, id, b) && (btn->down == down); } NK_API int nk_input_is_mouse_click_in_rect(const struct nk_input *i, enum nk_buttons id, struct nk_rect b) { const struct nk_mouse_button *btn; if (!i) return nk_false; btn = &i->mouse.buttons[id]; return (nk_input_has_mouse_click_down_in_rect(i, id, b, nk_false) && btn->clicked) ? nk_true : nk_false; } NK_API int nk_input_is_mouse_click_down_in_rect(const struct nk_input *i, enum nk_buttons id, struct nk_rect b, int down) { const struct nk_mouse_button *btn; if (!i) return nk_false; btn = &i->mouse.buttons[id]; return (nk_input_has_mouse_click_down_in_rect(i, id, b, down) && btn->clicked) ? nk_true : nk_false; } NK_API int nk_input_any_mouse_click_in_rect(const struct nk_input *in, struct nk_rect b) { int i, down = 0; for (i = 0; i < NK_BUTTON_MAX; ++i) down = down || nk_input_is_mouse_click_in_rect(in, (enum nk_buttons)i, b); return down; } NK_API int nk_input_is_mouse_hovering_rect(const struct nk_input *i, struct nk_rect rect) { if (!i) return nk_false; return NK_INBOX(i->mouse.pos.x, i->mouse.pos.y, rect.x, rect.y, rect.w, rect.h); } NK_API int nk_input_is_mouse_prev_hovering_rect(const struct nk_input *i, struct nk_rect rect) { if (!i) return nk_false; return NK_INBOX(i->mouse.prev.x, i->mouse.prev.y, rect.x, rect.y, rect.w, rect.h); } NK_API int nk_input_mouse_clicked(const struct nk_input *i, enum nk_buttons id, struct nk_rect rect) { if (!i) return nk_false; if (!nk_input_is_mouse_hovering_rect(i, rect)) return nk_false; return nk_input_is_mouse_click_in_rect(i, id, rect); } NK_API int nk_input_is_mouse_down(const struct nk_input *i, enum nk_buttons id) { if (!i) return nk_false; return i->mouse.buttons[id].down; } NK_API int nk_input_is_mouse_pressed(const struct nk_input *i, enum nk_buttons id) { const struct nk_mouse_button *b; if (!i) return nk_false; b = &i->mouse.buttons[id]; if (b->down && b->clicked) return nk_true; return nk_false; } NK_API int nk_input_is_mouse_released(const struct nk_input *i, enum nk_buttons id) { if (!i) return nk_false; return (!i->mouse.buttons[id].down && i->mouse.buttons[id].clicked); } NK_API int nk_input_is_key_pressed(const struct nk_input *i, enum nk_keys key) { const struct nk_key *k; if (!i) return nk_false; k = &i->keyboard.keys[key]; if ((k->down && k->clicked) || (!k->down && k->clicked >= 2)) return nk_true; return nk_false; } NK_API int nk_input_is_key_released(const struct nk_input *i, enum nk_keys key) { const struct nk_key *k; if (!i) return nk_false; k = &i->keyboard.keys[key]; if ((!k->down && k->clicked) || (k->down && k->clicked >= 2)) return nk_true; return nk_false; } NK_API int nk_input_is_key_down(const struct nk_input *i, enum nk_keys key) { const struct nk_key *k; if (!i) return nk_false; k = &i->keyboard.keys[key]; if (k->down) return nk_true; return nk_false; } /* =============================================================== * * STYLE * * ===============================================================*/ NK_API void nk_style_default(struct nk_context *ctx){nk_style_from_table(ctx, 0);} #define NK_COLOR_MAP(NK_COLOR)\ NK_COLOR(NK_COLOR_TEXT, 175,175,175,255) \ NK_COLOR(NK_COLOR_WINDOW, 45, 45, 45, 255) \ NK_COLOR(NK_COLOR_HEADER, 40, 40, 40, 255) \ NK_COLOR(NK_COLOR_BORDER, 65, 65, 65, 255) \ NK_COLOR(NK_COLOR_BUTTON, 50, 50, 50, 255) \ NK_COLOR(NK_COLOR_BUTTON_HOVER, 40, 40, 40, 255) \ NK_COLOR(NK_COLOR_BUTTON_ACTIVE, 35, 35, 35, 255) \ NK_COLOR(NK_COLOR_TOGGLE, 100,100,100,255) \ NK_COLOR(NK_COLOR_TOGGLE_HOVER, 120,120,120,255) \ NK_COLOR(NK_COLOR_TOGGLE_CURSOR, 45, 45, 45, 255) \ NK_COLOR(NK_COLOR_SELECT, 45, 45, 45, 255) \ NK_COLOR(NK_COLOR_SELECT_ACTIVE, 35, 35, 35,255) \ NK_COLOR(NK_COLOR_SLIDER, 38, 38, 38, 255) \ NK_COLOR(NK_COLOR_SLIDER_CURSOR, 100,100,100,255) \ NK_COLOR(NK_COLOR_SLIDER_CURSOR_HOVER, 120,120,120,255) \ NK_COLOR(NK_COLOR_SLIDER_CURSOR_ACTIVE, 150,150,150,255) \ NK_COLOR(NK_COLOR_PROPERTY, 38, 38, 38, 255) \ NK_COLOR(NK_COLOR_EDIT, 38, 38, 38, 255) \ NK_COLOR(NK_COLOR_EDIT_CURSOR, 175,175,175,255) \ NK_COLOR(NK_COLOR_COMBO, 45, 45, 45, 255) \ NK_COLOR(NK_COLOR_CHART, 120,120,120,255) \ NK_COLOR(NK_COLOR_CHART_COLOR, 45, 45, 45, 255) \ NK_COLOR(NK_COLOR_CHART_COLOR_HIGHLIGHT, 255, 0, 0, 255) \ NK_COLOR(NK_COLOR_SCROLLBAR, 40, 40, 40, 255) \ NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR, 100,100,100,255) \ NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR_HOVER, 120,120,120,255) \ NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR_ACTIVE, 150,150,150,255) \ NK_COLOR(NK_COLOR_TAB_HEADER, 40, 40, 40,255) NK_GLOBAL const struct nk_color nk_default_color_style[NK_COLOR_COUNT] = { #define NK_COLOR(a,b,c,d,e) {b,c,d,e}, NK_COLOR_MAP(NK_COLOR) #undef NK_COLOR }; NK_GLOBAL const char *nk_color_names[NK_COLOR_COUNT] = { #define NK_COLOR(a,b,c,d,e) #a, NK_COLOR_MAP(NK_COLOR) #undef NK_COLOR }; NK_API const char* nk_style_get_color_by_name(enum nk_style_colors c) { return nk_color_names[c]; } NK_API struct nk_style_item nk_style_item_image(struct nk_image img) { struct nk_style_item i; i.type = NK_STYLE_ITEM_IMAGE; i.data.image = img; return i; } NK_API struct nk_style_item nk_style_item_color(struct nk_color col) { struct nk_style_item i; i.type = NK_STYLE_ITEM_COLOR; i.data.color = col; return i; } NK_API struct nk_style_item nk_style_item_hide(void) { struct nk_style_item i; i.type = NK_STYLE_ITEM_COLOR; i.data.color = nk_rgba(0,0,0,0); return i; } NK_API void nk_style_from_table(struct nk_context *ctx, const struct nk_color *table) { struct nk_style *style; struct nk_style_text *text; struct nk_style_button *button; struct nk_style_toggle *toggle; struct nk_style_selectable *select; struct nk_style_slider *slider; struct nk_style_progress *prog; struct nk_style_scrollbar *scroll; struct nk_style_edit *edit; struct nk_style_property *property; struct nk_style_combo *combo; struct nk_style_chart *chart; struct nk_style_tab *tab; struct nk_style_window *win; NK_ASSERT(ctx); if (!ctx) return; style = &ctx->style; table = (!table) ? nk_default_color_style: table; /* default text */ text = &style->text; text->color = table[NK_COLOR_TEXT]; text->padding = nk_vec2(0,0); /* default button */ button = &style->button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_BUTTON]); button->hover = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]); button->active = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]); button->border_color = table[NK_COLOR_BORDER]; button->text_background = table[NK_COLOR_BUTTON]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(2.0f,2.0f); button->image_padding = nk_vec2(0.0f,0.0f); button->touch_padding = nk_vec2(0.0f, 0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 1.0f; button->rounding = 4.0f; button->draw_begin = 0; button->draw_end = 0; /* contextual button */ button = &style->contextual_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]); button->hover = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]); button->active = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]); button->border_color = table[NK_COLOR_WINDOW]; button->text_background = table[NK_COLOR_WINDOW]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(2.0f,2.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; /* menu button */ button = &style->menu_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]); button->hover = nk_style_item_color(table[NK_COLOR_WINDOW]); button->active = nk_style_item_color(table[NK_COLOR_WINDOW]); button->border_color = table[NK_COLOR_WINDOW]; button->text_background = table[NK_COLOR_WINDOW]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(2.0f,2.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 1.0f; button->draw_begin = 0; button->draw_end = 0; /* checkbox toggle */ toggle = &style->checkbox; nk_zero_struct(*toggle); toggle->normal = nk_style_item_color(table[NK_COLOR_TOGGLE]); toggle->hover = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]); toggle->active = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]); toggle->cursor_normal = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]); toggle->cursor_hover = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]); toggle->userdata = nk_handle_ptr(0); toggle->text_background = table[NK_COLOR_WINDOW]; toggle->text_normal = table[NK_COLOR_TEXT]; toggle->text_hover = table[NK_COLOR_TEXT]; toggle->text_active = table[NK_COLOR_TEXT]; toggle->padding = nk_vec2(2.0f, 2.0f); toggle->touch_padding = nk_vec2(0,0); toggle->border_color = nk_rgba(0,0,0,0); toggle->border = 0.0f; toggle->spacing = 4; /* option toggle */ toggle = &style->option; nk_zero_struct(*toggle); toggle->normal = nk_style_item_color(table[NK_COLOR_TOGGLE]); toggle->hover = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]); toggle->active = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]); toggle->cursor_normal = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]); toggle->cursor_hover = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]); toggle->userdata = nk_handle_ptr(0); toggle->text_background = table[NK_COLOR_WINDOW]; toggle->text_normal = table[NK_COLOR_TEXT]; toggle->text_hover = table[NK_COLOR_TEXT]; toggle->text_active = table[NK_COLOR_TEXT]; toggle->padding = nk_vec2(3.0f, 3.0f); toggle->touch_padding = nk_vec2(0,0); toggle->border_color = nk_rgba(0,0,0,0); toggle->border = 0.0f; toggle->spacing = 4; /* selectable */ select = &style->selectable; nk_zero_struct(*select); select->normal = nk_style_item_color(table[NK_COLOR_SELECT]); select->hover = nk_style_item_color(table[NK_COLOR_SELECT]); select->pressed = nk_style_item_color(table[NK_COLOR_SELECT]); select->normal_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]); select->hover_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]); select->pressed_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]); select->text_normal = table[NK_COLOR_TEXT]; select->text_hover = table[NK_COLOR_TEXT]; select->text_pressed = table[NK_COLOR_TEXT]; select->text_normal_active = table[NK_COLOR_TEXT]; select->text_hover_active = table[NK_COLOR_TEXT]; select->text_pressed_active = table[NK_COLOR_TEXT]; select->padding = nk_vec2(2.0f,2.0f); select->image_padding = nk_vec2(2.0f,2.0f); select->touch_padding = nk_vec2(0,0); select->userdata = nk_handle_ptr(0); select->rounding = 0.0f; select->draw_begin = 0; select->draw_end = 0; /* slider */ slider = &style->slider; nk_zero_struct(*slider); slider->normal = nk_style_item_hide(); slider->hover = nk_style_item_hide(); slider->active = nk_style_item_hide(); slider->bar_normal = table[NK_COLOR_SLIDER]; slider->bar_hover = table[NK_COLOR_SLIDER]; slider->bar_active = table[NK_COLOR_SLIDER]; slider->bar_filled = table[NK_COLOR_SLIDER_CURSOR]; slider->cursor_normal = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]); slider->cursor_hover = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]); slider->cursor_active = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]); slider->inc_symbol = NK_SYMBOL_TRIANGLE_RIGHT; slider->dec_symbol = NK_SYMBOL_TRIANGLE_LEFT; slider->cursor_size = nk_vec2(16,16); slider->padding = nk_vec2(2,2); slider->spacing = nk_vec2(2,2); slider->userdata = nk_handle_ptr(0); slider->show_buttons = nk_false; slider->bar_height = 8; slider->rounding = 0; slider->draw_begin = 0; slider->draw_end = 0; /* slider buttons */ button = &style->slider.inc_button; button->normal = nk_style_item_color(nk_rgb(40,40,40)); button->hover = nk_style_item_color(nk_rgb(42,42,42)); button->active = nk_style_item_color(nk_rgb(44,44,44)); button->border_color = nk_rgb(65,65,65); button->text_background = nk_rgb(40,40,40); button->text_normal = nk_rgb(175,175,175); button->text_hover = nk_rgb(175,175,175); button->text_active = nk_rgb(175,175,175); button->padding = nk_vec2(8.0f,8.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 1.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; style->slider.dec_button = style->slider.inc_button; /* progressbar */ prog = &style->progress; nk_zero_struct(*prog); prog->normal = nk_style_item_color(table[NK_COLOR_SLIDER]); prog->hover = nk_style_item_color(table[NK_COLOR_SLIDER]); prog->active = nk_style_item_color(table[NK_COLOR_SLIDER]); prog->cursor_normal = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]); prog->cursor_hover = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]); prog->cursor_active = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]); prog->border_color = nk_rgba(0,0,0,0); prog->cursor_border_color = nk_rgba(0,0,0,0); prog->userdata = nk_handle_ptr(0); prog->padding = nk_vec2(4,4); prog->rounding = 0; prog->border = 0; prog->cursor_rounding = 0; prog->cursor_border = 0; prog->draw_begin = 0; prog->draw_end = 0; /* scrollbars */ scroll = &style->scrollh; nk_zero_struct(*scroll); scroll->normal = nk_style_item_color(table[NK_COLOR_SCROLLBAR]); scroll->hover = nk_style_item_color(table[NK_COLOR_SCROLLBAR]); scroll->active = nk_style_item_color(table[NK_COLOR_SCROLLBAR]); scroll->cursor_normal = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR]); scroll->cursor_hover = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_HOVER]); scroll->cursor_active = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE]); scroll->dec_symbol = NK_SYMBOL_CIRCLE_SOLID; scroll->inc_symbol = NK_SYMBOL_CIRCLE_SOLID; scroll->userdata = nk_handle_ptr(0); scroll->border_color = table[NK_COLOR_SCROLLBAR]; scroll->cursor_border_color = table[NK_COLOR_SCROLLBAR]; scroll->padding = nk_vec2(0,0); scroll->show_buttons = nk_false; scroll->border = 0; scroll->rounding = 0; scroll->border_cursor = 0; scroll->rounding_cursor = 0; scroll->draw_begin = 0; scroll->draw_end = 0; style->scrollv = style->scrollh; /* scrollbars buttons */ button = &style->scrollh.inc_button; button->normal = nk_style_item_color(nk_rgb(40,40,40)); button->hover = nk_style_item_color(nk_rgb(42,42,42)); button->active = nk_style_item_color(nk_rgb(44,44,44)); button->border_color = nk_rgb(65,65,65); button->text_background = nk_rgb(40,40,40); button->text_normal = nk_rgb(175,175,175); button->text_hover = nk_rgb(175,175,175); button->text_active = nk_rgb(175,175,175); button->padding = nk_vec2(4.0f,4.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 1.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; style->scrollh.dec_button = style->scrollh.inc_button; style->scrollv.inc_button = style->scrollh.inc_button; style->scrollv.dec_button = style->scrollh.inc_button; /* edit */ edit = &style->edit; nk_zero_struct(*edit); edit->normal = nk_style_item_color(table[NK_COLOR_EDIT]); edit->hover = nk_style_item_color(table[NK_COLOR_EDIT]); edit->active = nk_style_item_color(table[NK_COLOR_EDIT]); edit->cursor_normal = table[NK_COLOR_TEXT]; edit->cursor_hover = table[NK_COLOR_TEXT]; edit->cursor_text_normal= table[NK_COLOR_EDIT]; edit->cursor_text_hover = table[NK_COLOR_EDIT]; edit->border_color = table[NK_COLOR_BORDER]; edit->text_normal = table[NK_COLOR_TEXT]; edit->text_hover = table[NK_COLOR_TEXT]; edit->text_active = table[NK_COLOR_TEXT]; edit->selected_normal = table[NK_COLOR_TEXT]; edit->selected_hover = table[NK_COLOR_TEXT]; edit->selected_text_normal = table[NK_COLOR_EDIT]; edit->selected_text_hover = table[NK_COLOR_EDIT]; edit->scrollbar_size = nk_vec2(10,10); edit->scrollbar = style->scrollv; edit->padding = nk_vec2(4,4); edit->row_padding = 2; edit->cursor_size = 4; edit->border = 1; edit->rounding = 0; /* property */ property = &style->property; nk_zero_struct(*property); property->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]); property->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]); property->active = nk_style_item_color(table[NK_COLOR_PROPERTY]); property->border_color = table[NK_COLOR_BORDER]; property->label_normal = table[NK_COLOR_TEXT]; property->label_hover = table[NK_COLOR_TEXT]; property->label_active = table[NK_COLOR_TEXT]; property->sym_left = NK_SYMBOL_TRIANGLE_LEFT; property->sym_right = NK_SYMBOL_TRIANGLE_RIGHT; property->userdata = nk_handle_ptr(0); property->padding = nk_vec2(4,4); property->border = 1; property->rounding = 10; property->draw_begin = 0; property->draw_end = 0; /* property buttons */ button = &style->property.dec_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]); button->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]); button->active = nk_style_item_color(table[NK_COLOR_PROPERTY]); button->border_color = nk_rgba(0,0,0,0); button->text_background = table[NK_COLOR_PROPERTY]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(0.0f,0.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; style->property.inc_button = style->property.dec_button; /* property edit */ edit = &style->property.edit; nk_zero_struct(*edit); edit->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]); edit->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]); edit->active = nk_style_item_color(table[NK_COLOR_PROPERTY]); edit->border_color = nk_rgba(0,0,0,0); edit->cursor_normal = table[NK_COLOR_TEXT]; edit->cursor_hover = table[NK_COLOR_TEXT]; edit->cursor_text_normal= table[NK_COLOR_EDIT]; edit->cursor_text_hover = table[NK_COLOR_EDIT]; edit->text_normal = table[NK_COLOR_TEXT]; edit->text_hover = table[NK_COLOR_TEXT]; edit->text_active = table[NK_COLOR_TEXT]; edit->selected_normal = table[NK_COLOR_TEXT]; edit->selected_hover = table[NK_COLOR_TEXT]; edit->selected_text_normal = table[NK_COLOR_EDIT]; edit->selected_text_hover = table[NK_COLOR_EDIT]; edit->padding = nk_vec2(0,0); edit->cursor_size = 8; edit->border = 0; edit->rounding = 0; /* chart */ chart = &style->chart; nk_zero_struct(*chart); chart->background = nk_style_item_color(table[NK_COLOR_CHART]); chart->border_color = table[NK_COLOR_BORDER]; chart->selected_color = table[NK_COLOR_CHART_COLOR_HIGHLIGHT]; chart->color = table[NK_COLOR_CHART_COLOR]; chart->padding = nk_vec2(4,4); chart->border = 0; chart->rounding = 0; /* combo */ combo = &style->combo; combo->normal = nk_style_item_color(table[NK_COLOR_COMBO]); combo->hover = nk_style_item_color(table[NK_COLOR_COMBO]); combo->active = nk_style_item_color(table[NK_COLOR_COMBO]); combo->border_color = table[NK_COLOR_BORDER]; combo->label_normal = table[NK_COLOR_TEXT]; combo->label_hover = table[NK_COLOR_TEXT]; combo->label_active = table[NK_COLOR_TEXT]; combo->sym_normal = NK_SYMBOL_TRIANGLE_DOWN; combo->sym_hover = NK_SYMBOL_TRIANGLE_DOWN; combo->sym_active = NK_SYMBOL_TRIANGLE_DOWN; combo->content_padding = nk_vec2(4,4); combo->button_padding = nk_vec2(0,4); combo->spacing = nk_vec2(4,0); combo->border = 1; combo->rounding = 0; /* combo button */ button = &style->combo.button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_COMBO]); button->hover = nk_style_item_color(table[NK_COLOR_COMBO]); button->active = nk_style_item_color(table[NK_COLOR_COMBO]); button->border_color = nk_rgba(0,0,0,0); button->text_background = table[NK_COLOR_COMBO]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(2.0f,2.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; /* tab */ tab = &style->tab; tab->background = nk_style_item_color(table[NK_COLOR_TAB_HEADER]); tab->border_color = table[NK_COLOR_BORDER]; tab->text = table[NK_COLOR_TEXT]; tab->sym_minimize = NK_SYMBOL_TRIANGLE_RIGHT; tab->sym_maximize = NK_SYMBOL_TRIANGLE_DOWN; tab->padding = nk_vec2(4,4); tab->spacing = nk_vec2(4,4); tab->indent = 10.0f; tab->border = 1; tab->rounding = 0; /* tab button */ button = &style->tab.tab_minimize_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_TAB_HEADER]); button->hover = nk_style_item_color(table[NK_COLOR_TAB_HEADER]); button->active = nk_style_item_color(table[NK_COLOR_TAB_HEADER]); button->border_color = nk_rgba(0,0,0,0); button->text_background = table[NK_COLOR_TAB_HEADER]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(2.0f,2.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; style->tab.tab_maximize_button =*button; /* node button */ button = &style->tab.node_minimize_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]); button->hover = nk_style_item_color(table[NK_COLOR_WINDOW]); button->active = nk_style_item_color(table[NK_COLOR_WINDOW]); button->border_color = nk_rgba(0,0,0,0); button->text_background = table[NK_COLOR_TAB_HEADER]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(2.0f,2.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; style->tab.node_maximize_button =*button; /* window header */ win = &style->window; win->header.align = NK_HEADER_RIGHT; win->header.close_symbol = NK_SYMBOL_X; win->header.minimize_symbol = NK_SYMBOL_MINUS; win->header.maximize_symbol = NK_SYMBOL_PLUS; win->header.normal = nk_style_item_color(table[NK_COLOR_HEADER]); win->header.hover = nk_style_item_color(table[NK_COLOR_HEADER]); win->header.active = nk_style_item_color(table[NK_COLOR_HEADER]); win->header.label_normal = table[NK_COLOR_TEXT]; win->header.label_hover = table[NK_COLOR_TEXT]; win->header.label_active = table[NK_COLOR_TEXT]; win->header.label_padding = nk_vec2(4,4); win->header.padding = nk_vec2(4,4); win->header.spacing = nk_vec2(0,0); /* window header close button */ button = &style->window.header.close_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_HEADER]); button->hover = nk_style_item_color(table[NK_COLOR_HEADER]); button->active = nk_style_item_color(table[NK_COLOR_HEADER]); button->border_color = nk_rgba(0,0,0,0); button->text_background = table[NK_COLOR_HEADER]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(0.0f,0.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; /* window header minimize button */ button = &style->window.header.minimize_button; nk_zero_struct(*button); button->normal = nk_style_item_color(table[NK_COLOR_HEADER]); button->hover = nk_style_item_color(table[NK_COLOR_HEADER]); button->active = nk_style_item_color(table[NK_COLOR_HEADER]); button->border_color = nk_rgba(0,0,0,0); button->text_background = table[NK_COLOR_HEADER]; button->text_normal = table[NK_COLOR_TEXT]; button->text_hover = table[NK_COLOR_TEXT]; button->text_active = table[NK_COLOR_TEXT]; button->padding = nk_vec2(0.0f,0.0f); button->touch_padding = nk_vec2(0.0f,0.0f); button->userdata = nk_handle_ptr(0); button->text_alignment = NK_TEXT_CENTERED; button->border = 0.0f; button->rounding = 0.0f; button->draw_begin = 0; button->draw_end = 0; /* window */ win->background = table[NK_COLOR_WINDOW]; win->fixed_background = nk_style_item_color(table[NK_COLOR_WINDOW]); win->border_color = table[NK_COLOR_BORDER]; win->popup_border_color = table[NK_COLOR_BORDER]; win->combo_border_color = table[NK_COLOR_BORDER]; win->contextual_border_color = table[NK_COLOR_BORDER]; win->menu_border_color = table[NK_COLOR_BORDER]; win->group_border_color = table[NK_COLOR_BORDER]; win->tooltip_border_color = table[NK_COLOR_BORDER]; win->scaler = nk_style_item_color(table[NK_COLOR_TEXT]); win->rounding = 0.0f; win->spacing = nk_vec2(4,4); win->scrollbar_size = nk_vec2(10,10); win->min_size = nk_vec2(64,64); win->combo_border = 1.0f; win->contextual_border = 1.0f; win->menu_border = 1.0f; win->group_border = 1.0f; win->tooltip_border = 1.0f; win->popup_border = 1.0f; win->border = 2.0f; win->min_row_height_padding = 8; win->padding = nk_vec2(4,4); win->group_padding = nk_vec2(4,4); win->popup_padding = nk_vec2(4,4); win->combo_padding = nk_vec2(4,4); win->contextual_padding = nk_vec2(4,4); win->menu_padding = nk_vec2(4,4); win->tooltip_padding = nk_vec2(4,4); } NK_API void nk_style_set_font(struct nk_context *ctx, const struct nk_user_font *font) { struct nk_style *style; NK_ASSERT(ctx); if (!ctx) return; style = &ctx->style; style->font = font; ctx->stacks.fonts.head = 0; if (ctx->current) nk_layout_reset_min_row_height(ctx); } NK_API int nk_style_push_font(struct nk_context *ctx, const struct nk_user_font *font) { struct nk_config_stack_user_font *font_stack; struct nk_config_stack_user_font_element *element; NK_ASSERT(ctx); if (!ctx) return 0; font_stack = &ctx->stacks.fonts; NK_ASSERT(font_stack->head < (int)NK_LEN(font_stack->elements)); if (font_stack->head >= (int)NK_LEN(font_stack->elements)) return 0; element = &font_stack->elements[font_stack->head++]; element->address = &ctx->style.font; element->old_value = ctx->style.font; ctx->style.font = font; return 1; } NK_API int nk_style_pop_font(struct nk_context *ctx) { struct nk_config_stack_user_font *font_stack; struct nk_config_stack_user_font_element *element; NK_ASSERT(ctx); if (!ctx) return 0; font_stack = &ctx->stacks.fonts; NK_ASSERT(font_stack->head > 0); if (font_stack->head < 1) return 0; element = &font_stack->elements[--font_stack->head]; *element->address = element->old_value; return 1; } #define NK_STYLE_PUSH_IMPLEMENATION(prefix, type, stack) \ nk_style_push_##type(struct nk_context *ctx, prefix##_##type *address, prefix##_##type value)\ {\ struct nk_config_stack_##type * type_stack;\ struct nk_config_stack_##type##_element *element;\ NK_ASSERT(ctx);\ if (!ctx) return 0;\ type_stack = &ctx->stacks.stack;\ NK_ASSERT(type_stack->head < (int)NK_LEN(type_stack->elements));\ if (type_stack->head >= (int)NK_LEN(type_stack->elements))\ return 0;\ element = &type_stack->elements[type_stack->head++];\ element->address = address;\ element->old_value = *address;\ *address = value;\ return 1;\ } #define NK_STYLE_POP_IMPLEMENATION(type, stack) \ nk_style_pop_##type(struct nk_context *ctx)\ {\ struct nk_config_stack_##type *type_stack;\ struct nk_config_stack_##type##_element *element;\ NK_ASSERT(ctx);\ if (!ctx) return 0;\ type_stack = &ctx->stacks.stack;\ NK_ASSERT(type_stack->head > 0);\ if (type_stack->head < 1)\ return 0;\ element = &type_stack->elements[--type_stack->head];\ *element->address = element->old_value;\ return 1;\ } NK_API int NK_STYLE_PUSH_IMPLEMENATION(struct nk, style_item, style_items) NK_API int NK_STYLE_PUSH_IMPLEMENATION(nk,float, floats) NK_API int NK_STYLE_PUSH_IMPLEMENATION(struct nk, vec2, vectors) NK_API int NK_STYLE_PUSH_IMPLEMENATION(nk,flags, flags) NK_API int NK_STYLE_PUSH_IMPLEMENATION(struct nk,color, colors) NK_API int NK_STYLE_POP_IMPLEMENATION(style_item, style_items) NK_API int NK_STYLE_POP_IMPLEMENATION(float,floats) NK_API int NK_STYLE_POP_IMPLEMENATION(vec2, vectors) NK_API int NK_STYLE_POP_IMPLEMENATION(flags,flags) NK_API int NK_STYLE_POP_IMPLEMENATION(color,colors) NK_API int nk_style_set_cursor(struct nk_context *ctx, enum nk_style_cursor c) { struct nk_style *style; NK_ASSERT(ctx); if (!ctx) return 0; style = &ctx->style; if (style->cursors[c]) { style->cursor_active = style->cursors[c]; return 1; } return 0; } NK_API void nk_style_show_cursor(struct nk_context *ctx) { ctx->style.cursor_visible = nk_true; } NK_API void nk_style_hide_cursor(struct nk_context *ctx) { ctx->style.cursor_visible = nk_false; } NK_API void nk_style_load_cursor(struct nk_context *ctx, enum nk_style_cursor cursor, const struct nk_cursor *c) { struct nk_style *style; NK_ASSERT(ctx); if (!ctx) return; style = &ctx->style; style->cursors[cursor] = c; } NK_API void nk_style_load_all_cursors(struct nk_context *ctx, struct nk_cursor *cursors) { int i = 0; struct nk_style *style; NK_ASSERT(ctx); if (!ctx) return; style = &ctx->style; for (i = 0; i < NK_CURSOR_COUNT; ++i) style->cursors[i] = &cursors[i]; style->cursor_visible = nk_true; } /* ============================================================== * * CONTEXT * * ===============================================================*/ NK_INTERN void nk_setup(struct nk_context *ctx, const struct nk_user_font *font) { NK_ASSERT(ctx); if (!ctx) return; nk_zero_struct(*ctx); nk_style_default(ctx); ctx->seq = 1; if (font) ctx->style.font = font; #ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT nk_draw_list_init(&ctx->draw_list); #endif } #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API int nk_init_default(struct nk_context *ctx, const struct nk_user_font *font) { struct nk_allocator alloc; alloc.userdata.ptr = 0; alloc.alloc = nk_malloc; alloc.free = nk_mfree; return nk_init(ctx, &alloc, font); } #endif NK_API int nk_init_fixed(struct nk_context *ctx, void *memory, nk_size size, const struct nk_user_font *font) { NK_ASSERT(memory); if (!memory) return 0; nk_setup(ctx, font); nk_buffer_init_fixed(&ctx->memory, memory, size); ctx->use_pool = nk_false; return 1; } NK_API int nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font *font) { NK_ASSERT(cmds); NK_ASSERT(pool); if (!cmds || !pool) return 0; nk_setup(ctx, font); ctx->memory = *cmds; if (pool->type == NK_BUFFER_FIXED) { /* take memory from buffer and alloc fixed pool */ nk_pool_init_fixed(&ctx->pool, pool->memory.ptr, pool->memory.size); } else { /* create dynamic pool from buffer allocator */ struct nk_allocator *alloc = &pool->pool; nk_pool_init(&ctx->pool, alloc, NK_POOL_DEFAULT_CAPACITY); } ctx->use_pool = nk_true; return 1; } NK_API int nk_init(struct nk_context *ctx, struct nk_allocator *alloc, const struct nk_user_font *font) { NK_ASSERT(alloc); if (!alloc) return 0; nk_setup(ctx, font); nk_buffer_init(&ctx->memory, alloc, NK_DEFAULT_COMMAND_BUFFER_SIZE); nk_pool_init(&ctx->pool, alloc, NK_POOL_DEFAULT_CAPACITY); ctx->use_pool = nk_true; return 1; } #ifdef NK_INCLUDE_COMMAND_USERDATA NK_API void nk_set_user_data(struct nk_context *ctx, nk_handle handle) { if (!ctx) return; ctx->userdata = handle; if (ctx->current) ctx->current->buffer.userdata = handle; } #endif NK_API void nk_free(struct nk_context *ctx) { NK_ASSERT(ctx); if (!ctx) return; nk_buffer_free(&ctx->memory); if (ctx->use_pool) nk_pool_free(&ctx->pool); nk_zero(&ctx->input, sizeof(ctx->input)); nk_zero(&ctx->style, sizeof(ctx->style)); nk_zero(&ctx->memory, sizeof(ctx->memory)); ctx->seq = 0; ctx->build = 0; ctx->begin = 0; ctx->end = 0; ctx->active = 0; ctx->current = 0; ctx->freelist = 0; ctx->count = 0; } NK_API void nk_clear(struct nk_context *ctx) { struct nk_window *iter; struct nk_window *next; NK_ASSERT(ctx); if (!ctx) return; if (ctx->use_pool) nk_buffer_clear(&ctx->memory); else nk_buffer_reset(&ctx->memory, NK_BUFFER_FRONT); ctx->build = 0; ctx->memory.calls = 0; ctx->last_widget_state = 0; ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_ARROW]; NK_MEMSET(&ctx->overlay, 0, sizeof(ctx->overlay)); /* garbage collector */ iter = ctx->begin; while (iter) { /* make sure valid minimized windows do not get removed */ if ((iter->flags & NK_WINDOW_MINIMIZED) && !(iter->flags & NK_WINDOW_CLOSED) && iter->seq == ctx->seq) { iter = iter->next; continue; } /* remove hotness from hidden or closed windows*/ if (((iter->flags & NK_WINDOW_HIDDEN) || (iter->flags & NK_WINDOW_CLOSED)) && iter == ctx->active) { ctx->active = iter->prev; ctx->end = iter->prev; if (!ctx->end) ctx->begin = 0; if (ctx->active) ctx->active->flags &= ~(unsigned)NK_WINDOW_ROM; } /* free unused popup windows */ if (iter->popup.win && iter->popup.win->seq != ctx->seq) { nk_free_window(ctx, iter->popup.win); iter->popup.win = 0; } /* remove unused window state tables */ {struct nk_table *n, *it = iter->tables; while (it) { n = it->next; if (it->seq != ctx->seq) { nk_remove_table(iter, it); nk_zero(it, sizeof(union nk_page_data)); nk_free_table(ctx, it); if (it == iter->tables) iter->tables = n; } it = n; }} /* window itself is not used anymore so free */ if (iter->seq != ctx->seq || iter->flags & NK_WINDOW_CLOSED) { next = iter->next; nk_remove_window(ctx, iter); nk_free_window(ctx, iter); iter = next; } else iter = iter->next; } ctx->seq++; } NK_LIB void nk_start_buffer(struct nk_context *ctx, struct nk_command_buffer *buffer) { NK_ASSERT(ctx); NK_ASSERT(buffer); if (!ctx || !buffer) return; buffer->begin = ctx->memory.allocated; buffer->end = buffer->begin; buffer->last = buffer->begin; buffer->clip = nk_null_rect; } NK_LIB void nk_start(struct nk_context *ctx, struct nk_window *win) { NK_ASSERT(ctx); NK_ASSERT(win); nk_start_buffer(ctx, &win->buffer); } NK_LIB void nk_start_popup(struct nk_context *ctx, struct nk_window *win) { struct nk_popup_buffer *buf; NK_ASSERT(ctx); NK_ASSERT(win); if (!ctx || !win) return; /* save buffer fill state for popup */ buf = &win->popup.buf; buf->begin = win->buffer.end; buf->end = win->buffer.end; buf->parent = win->buffer.last; buf->last = buf->begin; buf->active = nk_true; } NK_LIB void nk_finish_popup(struct nk_context *ctx, struct nk_window *win) { struct nk_popup_buffer *buf; NK_ASSERT(ctx); NK_ASSERT(win); if (!ctx || !win) return; buf = &win->popup.buf; buf->last = win->buffer.last; buf->end = win->buffer.end; } NK_LIB void nk_finish_buffer(struct nk_context *ctx, struct nk_command_buffer *buffer) { NK_ASSERT(ctx); NK_ASSERT(buffer); if (!ctx || !buffer) return; buffer->end = ctx->memory.allocated; } NK_LIB void nk_finish(struct nk_context *ctx, struct nk_window *win) { struct nk_popup_buffer *buf; struct nk_command *parent_last; void *memory; NK_ASSERT(ctx); NK_ASSERT(win); if (!ctx || !win) return; nk_finish_buffer(ctx, &win->buffer); if (!win->popup.buf.active) return; buf = &win->popup.buf; memory = ctx->memory.memory.ptr; parent_last = nk_ptr_add(struct nk_command, memory, buf->parent); parent_last->next = buf->end; } NK_LIB void nk_build(struct nk_context *ctx) { struct nk_window *it = 0; struct nk_command *cmd = 0; nk_byte *buffer = 0; /* draw cursor overlay */ if (!ctx->style.cursor_active) ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_ARROW]; if (ctx->style.cursor_active && !ctx->input.mouse.grabbed && ctx->style.cursor_visible) { struct nk_rect mouse_bounds; const struct nk_cursor *cursor = ctx->style.cursor_active; nk_command_buffer_init(&ctx->overlay, &ctx->memory, NK_CLIPPING_OFF); nk_start_buffer(ctx, &ctx->overlay); mouse_bounds.x = ctx->input.mouse.pos.x - cursor->offset.x; mouse_bounds.y = ctx->input.mouse.pos.y - cursor->offset.y; mouse_bounds.w = cursor->size.x; mouse_bounds.h = cursor->size.y; nk_draw_image(&ctx->overlay, mouse_bounds, &cursor->img, nk_white); nk_finish_buffer(ctx, &ctx->overlay); } /* build one big draw command list out of all window buffers */ it = ctx->begin; buffer = (nk_byte*)ctx->memory.memory.ptr; while (it != 0) { struct nk_window *next = it->next; if (it->buffer.last == it->buffer.begin || (it->flags & NK_WINDOW_HIDDEN)|| it->seq != ctx->seq) goto cont; cmd = nk_ptr_add(struct nk_command, buffer, it->buffer.last); while (next && ((next->buffer.last == next->buffer.begin) || (next->flags & NK_WINDOW_HIDDEN) || next->seq != ctx->seq)) next = next->next; /* skip empty command buffers */ if (next) cmd->next = next->buffer.begin; cont: it = next; } /* append all popup draw commands into lists */ it = ctx->begin; while (it != 0) { struct nk_window *next = it->next; struct nk_popup_buffer *buf; if (!it->popup.buf.active) goto skip; buf = &it->popup.buf; cmd->next = buf->begin; cmd = nk_ptr_add(struct nk_command, buffer, buf->last); buf->active = nk_false; skip: it = next; } if (cmd) { /* append overlay commands */ if (ctx->overlay.end != ctx->overlay.begin) cmd->next = ctx->overlay.begin; else cmd->next = ctx->memory.allocated; } } NK_API const struct nk_command* nk__begin(struct nk_context *ctx) { struct nk_window *iter; nk_byte *buffer; NK_ASSERT(ctx); if (!ctx) return 0; if (!ctx->count) return 0; buffer = (nk_byte*)ctx->memory.memory.ptr; if (!ctx->build) { nk_build(ctx); ctx->build = nk_true; } iter = ctx->begin; while (iter && ((iter->buffer.begin == iter->buffer.end) || (iter->flags & NK_WINDOW_HIDDEN) || iter->seq != ctx->seq)) iter = iter->next; if (!iter) return 0; return nk_ptr_add_const(struct nk_command, buffer, iter->buffer.begin); } NK_API const struct nk_command* nk__next(struct nk_context *ctx, const struct nk_command *cmd) { nk_byte *buffer; const struct nk_command *next; NK_ASSERT(ctx); if (!ctx || !cmd || !ctx->count) return 0; if (cmd->next >= ctx->memory.allocated) return 0; buffer = (nk_byte*)ctx->memory.memory.ptr; next = nk_ptr_add_const(struct nk_command, buffer, cmd->next); return next; } /* =============================================================== * * POOL * * ===============================================================*/ NK_LIB void nk_pool_init(struct nk_pool *pool, struct nk_allocator *alloc, unsigned int capacity) { nk_zero(pool, sizeof(*pool)); pool->alloc = *alloc; pool->capacity = capacity; pool->type = NK_BUFFER_DYNAMIC; pool->pages = 0; } NK_LIB void nk_pool_free(struct nk_pool *pool) { struct nk_page *iter = pool->pages; if (!pool) return; if (pool->type == NK_BUFFER_FIXED) return; while (iter) { struct nk_page *next = iter->next; pool->alloc.free(pool->alloc.userdata, iter); iter = next; } } NK_LIB void nk_pool_init_fixed(struct nk_pool *pool, void *memory, nk_size size) { nk_zero(pool, sizeof(*pool)); NK_ASSERT(size >= sizeof(struct nk_page)); if (size < sizeof(struct nk_page)) return; pool->capacity = (unsigned)(size - sizeof(struct nk_page)) / sizeof(struct nk_page_element); pool->pages = (struct nk_page*)memory; pool->type = NK_BUFFER_FIXED; pool->size = size; } NK_LIB struct nk_page_element* nk_pool_alloc(struct nk_pool *pool) { if (!pool->pages || pool->pages->size >= pool->capacity) { /* allocate new page */ struct nk_page *page; if (pool->type == NK_BUFFER_FIXED) { NK_ASSERT(pool->pages); if (!pool->pages) return 0; NK_ASSERT(pool->pages->size < pool->capacity); return 0; } else { nk_size size = sizeof(struct nk_page); size += NK_POOL_DEFAULT_CAPACITY * sizeof(union nk_page_data); page = (struct nk_page*)pool->alloc.alloc(pool->alloc.userdata,0, size); page->next = pool->pages; pool->pages = page; page->size = 0; } } return &pool->pages->win[pool->pages->size++]; } /* =============================================================== * * PAGE ELEMENT * * ===============================================================*/ NK_LIB struct nk_page_element* nk_create_page_element(struct nk_context *ctx) { struct nk_page_element *elem; if (ctx->freelist) { /* unlink page element from free list */ elem = ctx->freelist; ctx->freelist = elem->next; } else if (ctx->use_pool) { /* allocate page element from memory pool */ elem = nk_pool_alloc(&ctx->pool); NK_ASSERT(elem); if (!elem) return 0; } else { /* allocate new page element from back of fixed size memory buffer */ NK_STORAGE const nk_size size = sizeof(struct nk_page_element); NK_STORAGE const nk_size align = NK_ALIGNOF(struct nk_page_element); elem = (struct nk_page_element*)nk_buffer_alloc(&ctx->memory, NK_BUFFER_BACK, size, align); NK_ASSERT(elem); if (!elem) return 0; } nk_zero_struct(*elem); elem->next = 0; elem->prev = 0; return elem; } NK_LIB void nk_link_page_element_into_freelist(struct nk_context *ctx, struct nk_page_element *elem) { /* link table into freelist */ if (!ctx->freelist) { ctx->freelist = elem; } else { elem->next = ctx->freelist; ctx->freelist = elem; } } NK_LIB void nk_free_page_element(struct nk_context *ctx, struct nk_page_element *elem) { /* we have a pool so just add to free list */ if (ctx->use_pool) { nk_link_page_element_into_freelist(ctx, elem); return; } /* if possible remove last element from back of fixed memory buffer */ {void *elem_end = (void*)(elem + 1); void *buffer_end = (nk_byte*)ctx->memory.memory.ptr + ctx->memory.size; if (elem_end == buffer_end) ctx->memory.size -= sizeof(struct nk_page_element); else nk_link_page_element_into_freelist(ctx, elem);} } /* =============================================================== * * TABLE * * ===============================================================*/ NK_LIB struct nk_table* nk_create_table(struct nk_context *ctx) { struct nk_page_element *elem; elem = nk_create_page_element(ctx); if (!elem) return 0; nk_zero_struct(*elem); return &elem->data.tbl; } NK_LIB void nk_free_table(struct nk_context *ctx, struct nk_table *tbl) { union nk_page_data *pd = NK_CONTAINER_OF(tbl, union nk_page_data, tbl); struct nk_page_element *pe = NK_CONTAINER_OF(pd, struct nk_page_element, data); nk_free_page_element(ctx, pe); } NK_LIB void nk_push_table(struct nk_window *win, struct nk_table *tbl) { if (!win->tables) { win->tables = tbl; tbl->next = 0; tbl->prev = 0; tbl->size = 0; win->table_count = 1; return; } win->tables->prev = tbl; tbl->next = win->tables; tbl->prev = 0; tbl->size = 0; win->tables = tbl; win->table_count++; } NK_LIB void nk_remove_table(struct nk_window *win, struct nk_table *tbl) { if (win->tables == tbl) win->tables = tbl->next; if (tbl->next) tbl->next->prev = tbl->prev; if (tbl->prev) tbl->prev->next = tbl->next; tbl->next = 0; tbl->prev = 0; } NK_LIB nk_uint* nk_add_value(struct nk_context *ctx, struct nk_window *win, nk_hash name, nk_uint value) { NK_ASSERT(ctx); NK_ASSERT(win); if (!win || !ctx) return 0; if (!win->tables || win->tables->size >= NK_VALUE_PAGE_CAPACITY) { struct nk_table *tbl = nk_create_table(ctx); NK_ASSERT(tbl); if (!tbl) return 0; nk_push_table(win, tbl); } win->tables->seq = win->seq; win->tables->keys[win->tables->size] = name; win->tables->values[win->tables->size] = value; return &win->tables->values[win->tables->size++]; } NK_LIB nk_uint* nk_find_value(struct nk_window *win, nk_hash name) { struct nk_table *iter = win->tables; while (iter) { unsigned int i = 0; unsigned int size = iter->size; for (i = 0; i < size; ++i) { if (iter->keys[i] == name) { iter->seq = win->seq; return &iter->values[i]; } } size = NK_VALUE_PAGE_CAPACITY; iter = iter->next; } return 0; } /* =============================================================== * * PANEL * * ===============================================================*/ NK_LIB void* nk_create_panel(struct nk_context *ctx) { struct nk_page_element *elem; elem = nk_create_page_element(ctx); if (!elem) return 0; nk_zero_struct(*elem); return &elem->data.pan; } NK_LIB void nk_free_panel(struct nk_context *ctx, struct nk_panel *pan) { union nk_page_data *pd = NK_CONTAINER_OF(pan, union nk_page_data, pan); struct nk_page_element *pe = NK_CONTAINER_OF(pd, struct nk_page_element, data); nk_free_page_element(ctx, pe); } NK_LIB int nk_panel_has_header(nk_flags flags, const char *title) { int active = 0; active = (flags & (NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE)); active = active || (flags & NK_WINDOW_TITLE); active = active && !(flags & NK_WINDOW_HIDDEN) && title; return active; } NK_LIB struct nk_vec2 nk_panel_get_padding(const struct nk_style *style, enum nk_panel_type type) { switch (type) { default: case NK_PANEL_WINDOW: return style->window.padding; case NK_PANEL_GROUP: return style->window.group_padding; case NK_PANEL_POPUP: return style->window.popup_padding; case NK_PANEL_CONTEXTUAL: return style->window.contextual_padding; case NK_PANEL_COMBO: return style->window.combo_padding; case NK_PANEL_MENU: return style->window.menu_padding; case NK_PANEL_TOOLTIP: return style->window.menu_padding;} } NK_LIB float nk_panel_get_border(const struct nk_style *style, nk_flags flags, enum nk_panel_type type) { if (flags & NK_WINDOW_BORDER) { switch (type) { default: case NK_PANEL_WINDOW: return style->window.border; case NK_PANEL_GROUP: return style->window.group_border; case NK_PANEL_POPUP: return style->window.popup_border; case NK_PANEL_CONTEXTUAL: return style->window.contextual_border; case NK_PANEL_COMBO: return style->window.combo_border; case NK_PANEL_MENU: return style->window.menu_border; case NK_PANEL_TOOLTIP: return style->window.menu_border; }} else return 0; } NK_LIB struct nk_color nk_panel_get_border_color(const struct nk_style *style, enum nk_panel_type type) { switch (type) { default: case NK_PANEL_WINDOW: return style->window.border_color; case NK_PANEL_GROUP: return style->window.group_border_color; case NK_PANEL_POPUP: return style->window.popup_border_color; case NK_PANEL_CONTEXTUAL: return style->window.contextual_border_color; case NK_PANEL_COMBO: return style->window.combo_border_color; case NK_PANEL_MENU: return style->window.menu_border_color; case NK_PANEL_TOOLTIP: return style->window.menu_border_color;} } NK_LIB int nk_panel_is_sub(enum nk_panel_type type) { return (type & NK_PANEL_SET_SUB)?1:0; } NK_LIB int nk_panel_is_nonblock(enum nk_panel_type type) { return (type & NK_PANEL_SET_NONBLOCK)?1:0; } NK_LIB int nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type panel_type) { struct nk_input *in; struct nk_window *win; struct nk_panel *layout; struct nk_command_buffer *out; const struct nk_style *style; const struct nk_user_font *font; struct nk_vec2 scrollbar_size; struct nk_vec2 panel_padding; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; nk_zero(ctx->current->layout, sizeof(*ctx->current->layout)); if ((ctx->current->flags & NK_WINDOW_HIDDEN) || (ctx->current->flags & NK_WINDOW_CLOSED)) { nk_zero(ctx->current->layout, sizeof(struct nk_panel)); ctx->current->layout->type = panel_type; return 0; } /* pull state into local stack */ style = &ctx->style; font = style->font; win = ctx->current; layout = win->layout; out = &win->buffer; in = (win->flags & NK_WINDOW_NO_INPUT) ? 0: &ctx->input; #ifdef NK_INCLUDE_COMMAND_USERDATA win->buffer.userdata = ctx->userdata; #endif /* pull style configuration into local stack */ scrollbar_size = style->window.scrollbar_size; panel_padding = nk_panel_get_padding(style, panel_type); /* window movement */ if ((win->flags & NK_WINDOW_MOVABLE) && !(win->flags & NK_WINDOW_ROM)) { int left_mouse_down; int left_mouse_clicked; int left_mouse_click_in_cursor; /* calculate draggable window space */ struct nk_rect header; header.x = win->bounds.x; header.y = win->bounds.y; header.w = win->bounds.w; if (nk_panel_has_header(win->flags, title)) { header.h = font->height + 2.0f * style->window.header.padding.y; header.h += 2.0f * style->window.header.label_padding.y; } else header.h = panel_padding.y; /* window movement by dragging */ left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down; left_mouse_clicked = (int)in->mouse.buttons[NK_BUTTON_LEFT].clicked; left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, header, nk_true); if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) { win->bounds.x = win->bounds.x + in->mouse.delta.x; win->bounds.y = win->bounds.y + in->mouse.delta.y; in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x += in->mouse.delta.x; in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.y += in->mouse.delta.y; ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_MOVE]; } } /* setup panel */ layout->type = panel_type; layout->flags = win->flags; layout->bounds = win->bounds; layout->bounds.x += panel_padding.x; layout->bounds.w -= 2*panel_padding.x; if (win->flags & NK_WINDOW_BORDER) { layout->border = nk_panel_get_border(style, win->flags, panel_type); layout->bounds = nk_shrink_rect(layout->bounds, layout->border); } else layout->border = 0; layout->at_y = layout->bounds.y; layout->at_x = layout->bounds.x; layout->max_x = 0; layout->header_height = 0; layout->footer_height = 0; nk_layout_reset_min_row_height(ctx); layout->row.index = 0; layout->row.columns = 0; layout->row.ratio = 0; layout->row.item_width = 0; layout->row.tree_depth = 0; layout->row.height = panel_padding.y; layout->has_scrolling = nk_true; if (!(win->flags & NK_WINDOW_NO_SCROLLBAR)) layout->bounds.w -= scrollbar_size.x; if (!nk_panel_is_nonblock(panel_type)) { layout->footer_height = 0; if (!(win->flags & NK_WINDOW_NO_SCROLLBAR) || win->flags & NK_WINDOW_SCALABLE) layout->footer_height = scrollbar_size.y; layout->bounds.h -= layout->footer_height; } /* panel header */ if (nk_panel_has_header(win->flags, title)) { struct nk_text text; struct nk_rect header; const struct nk_style_item *background = 0; /* calculate header bounds */ header.x = win->bounds.x; header.y = win->bounds.y; header.w = win->bounds.w; header.h = font->height + 2.0f * style->window.header.padding.y; header.h += (2.0f * style->window.header.label_padding.y); /* shrink panel by header */ layout->header_height = header.h; layout->bounds.y += header.h; layout->bounds.h -= header.h; layout->at_y += header.h; /* select correct header background and text color */ if (ctx->active == win) { background = &style->window.header.active; text.text = style->window.header.label_active; } else if (nk_input_is_mouse_hovering_rect(&ctx->input, header)) { background = &style->window.header.hover; text.text = style->window.header.label_hover; } else { background = &style->window.header.normal; text.text = style->window.header.label_normal; } /* draw header background */ header.h += 1.0f; if (background->type == NK_STYLE_ITEM_IMAGE) { text.background = nk_rgba(0,0,0,0); nk_draw_image(&win->buffer, header, &background->data.image, nk_white); } else { text.background = background->data.color; nk_fill_rect(out, header, 0, background->data.color); } /* window close button */ {struct nk_rect button; button.y = header.y + style->window.header.padding.y; button.h = header.h - 2 * style->window.header.padding.y; button.w = button.h; if (win->flags & NK_WINDOW_CLOSABLE) { nk_flags ws = 0; if (style->window.header.align == NK_HEADER_RIGHT) { button.x = (header.w + header.x) - (button.w + style->window.header.padding.x); header.w -= button.w + style->window.header.spacing.x + style->window.header.padding.x; } else { button.x = header.x + style->window.header.padding.x; header.x += button.w + style->window.header.spacing.x + style->window.header.padding.x; } if (nk_do_button_symbol(&ws, &win->buffer, button, style->window.header.close_symbol, NK_BUTTON_DEFAULT, &style->window.header.close_button, in, style->font) && !(win->flags & NK_WINDOW_ROM)) { layout->flags |= NK_WINDOW_HIDDEN; layout->flags &= (nk_flags)~NK_WINDOW_MINIMIZED; } } /* window minimize button */ if (win->flags & NK_WINDOW_MINIMIZABLE) { nk_flags ws = 0; if (style->window.header.align == NK_HEADER_RIGHT) { button.x = (header.w + header.x) - button.w; if (!(win->flags & NK_WINDOW_CLOSABLE)) { button.x -= style->window.header.padding.x; header.w -= style->window.header.padding.x; } header.w -= button.w + style->window.header.spacing.x; } else { button.x = header.x; header.x += button.w + style->window.header.spacing.x + style->window.header.padding.x; } if (nk_do_button_symbol(&ws, &win->buffer, button, (layout->flags & NK_WINDOW_MINIMIZED)? style->window.header.maximize_symbol: style->window.header.minimize_symbol, NK_BUTTON_DEFAULT, &style->window.header.minimize_button, in, style->font) && !(win->flags & NK_WINDOW_ROM)) layout->flags = (layout->flags & NK_WINDOW_MINIMIZED) ? layout->flags & (nk_flags)~NK_WINDOW_MINIMIZED: layout->flags | NK_WINDOW_MINIMIZED; }} {/* window header title */ int text_len = nk_strlen(title); struct nk_rect label = {0,0,0,0}; float t = font->width(font->userdata, font->height, title, text_len); text.padding = nk_vec2(0,0); label.x = header.x + style->window.header.padding.x; label.x += style->window.header.label_padding.x; label.y = header.y + style->window.header.label_padding.y; label.h = font->height + 2 * style->window.header.label_padding.y; label.w = t + 2 * style->window.header.spacing.x; label.w = NK_CLAMP(0, label.w, header.x + header.w - label.x); nk_widget_text(out, label,(const char*)title, text_len, &text, NK_TEXT_LEFT, font);} } /* draw window background */ if (!(layout->flags & NK_WINDOW_MINIMIZED) && !(layout->flags & NK_WINDOW_DYNAMIC)) { struct nk_rect body; body.x = win->bounds.x; body.w = win->bounds.w; body.y = (win->bounds.y + layout->header_height); body.h = (win->bounds.h - layout->header_height); if (style->window.fixed_background.type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, body, &style->window.fixed_background.data.image, nk_white); else nk_fill_rect(out, body, 0, style->window.fixed_background.data.color); } /* set clipping rectangle */ {struct nk_rect clip; layout->clip = layout->bounds; nk_unify(&clip, &win->buffer.clip, layout->clip.x, layout->clip.y, layout->clip.x + layout->clip.w, layout->clip.y + layout->clip.h); nk_push_scissor(out, clip); layout->clip = clip;} return !(layout->flags & NK_WINDOW_HIDDEN) && !(layout->flags & NK_WINDOW_MINIMIZED); } NK_LIB void nk_panel_end(struct nk_context *ctx) { struct nk_input *in; struct nk_window *window; struct nk_panel *layout; const struct nk_style *style; struct nk_command_buffer *out; struct nk_vec2 scrollbar_size; struct nk_vec2 panel_padding; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; window = ctx->current; layout = window->layout; style = &ctx->style; out = &window->buffer; in = (layout->flags & NK_WINDOW_ROM || layout->flags & NK_WINDOW_NO_INPUT) ? 0 :&ctx->input; if (!nk_panel_is_sub(layout->type)) nk_push_scissor(out, nk_null_rect); /* cache configuration data */ scrollbar_size = style->window.scrollbar_size; panel_padding = nk_panel_get_padding(style, layout->type); /* update the current cursor Y-position to point over the last added widget */ layout->at_y += layout->row.height; /* dynamic panels */ if (layout->flags & NK_WINDOW_DYNAMIC && !(layout->flags & NK_WINDOW_MINIMIZED)) { /* update panel height to fit dynamic growth */ struct nk_rect empty_space; if (layout->at_y < (layout->bounds.y + layout->bounds.h)) layout->bounds.h = layout->at_y - layout->bounds.y; /* fill top empty space */ empty_space.x = window->bounds.x; empty_space.y = layout->bounds.y; empty_space.h = panel_padding.y; empty_space.w = window->bounds.w; nk_fill_rect(out, empty_space, 0, style->window.background); /* fill left empty space */ empty_space.x = window->bounds.x; empty_space.y = layout->bounds.y; empty_space.w = panel_padding.x + layout->border; empty_space.h = layout->bounds.h; nk_fill_rect(out, empty_space, 0, style->window.background); /* fill right empty space */ empty_space.x = layout->bounds.x + layout->bounds.w - layout->border; empty_space.y = layout->bounds.y; empty_space.w = panel_padding.x + layout->border; empty_space.h = layout->bounds.h; if (*layout->offset_y == 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR)) empty_space.w += scrollbar_size.x; nk_fill_rect(out, empty_space, 0, style->window.background); /* fill bottom empty space */ if (*layout->offset_x != 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR)) { empty_space.x = window->bounds.x; empty_space.y = layout->bounds.y + layout->bounds.h; empty_space.w = window->bounds.w; empty_space.h = scrollbar_size.y; nk_fill_rect(out, empty_space, 0, style->window.background); } } /* scrollbars */ if (!(layout->flags & NK_WINDOW_NO_SCROLLBAR) && !(layout->flags & NK_WINDOW_MINIMIZED) && window->scrollbar_hiding_timer < NK_SCROLLBAR_HIDING_TIMEOUT) { struct nk_rect scroll; int scroll_has_scrolling; float scroll_target; float scroll_offset; float scroll_step; float scroll_inc; /* mouse wheel scrolling */ if (nk_panel_is_sub(layout->type)) { /* sub-window mouse wheel scrolling */ struct nk_window *root_window = window; struct nk_panel *root_panel = window->layout; while (root_panel->parent) root_panel = root_panel->parent; while (root_window->parent) root_window = root_window->parent; /* only allow scrolling if parent window is active */ scroll_has_scrolling = 0; if ((root_window == ctx->active) && layout->has_scrolling) { /* and panel is being hovered and inside clip rect*/ if (nk_input_is_mouse_hovering_rect(in, layout->bounds) && NK_INTERSECT(layout->bounds.x, layout->bounds.y, layout->bounds.w, layout->bounds.h, root_panel->clip.x, root_panel->clip.y, root_panel->clip.w, root_panel->clip.h)) { /* deactivate all parent scrolling */ root_panel = window->layout; while (root_panel->parent) { root_panel->has_scrolling = nk_false; root_panel = root_panel->parent; } root_panel->has_scrolling = nk_false; scroll_has_scrolling = nk_true; } } } else if (!nk_panel_is_sub(layout->type)) { /* window mouse wheel scrolling */ scroll_has_scrolling = (window == ctx->active) && layout->has_scrolling; if (in && (in->mouse.scroll_delta.y > 0 || in->mouse.scroll_delta.x > 0) && scroll_has_scrolling) window->scrolled = nk_true; else window->scrolled = nk_false; } else scroll_has_scrolling = nk_false; { /* vertical scrollbar */ nk_flags state = 0; scroll.x = layout->bounds.x + layout->bounds.w + panel_padding.x; scroll.y = layout->bounds.y; scroll.w = scrollbar_size.x; scroll.h = layout->bounds.h; scroll_offset = (float)*layout->offset_y; scroll_step = scroll.h * 0.10f; scroll_inc = scroll.h * 0.01f; scroll_target = (float)(int)(layout->at_y - scroll.y); scroll_offset = nk_do_scrollbarv(&state, out, scroll, scroll_has_scrolling, scroll_offset, scroll_target, scroll_step, scroll_inc, &ctx->style.scrollv, in, style->font); *layout->offset_y = (nk_uint)scroll_offset; if (in && scroll_has_scrolling) in->mouse.scroll_delta.y = 0; } { /* horizontal scrollbar */ nk_flags state = 0; scroll.x = layout->bounds.x; scroll.y = layout->bounds.y + layout->bounds.h; scroll.w = layout->bounds.w; scroll.h = scrollbar_size.y; scroll_offset = (float)*layout->offset_x; scroll_target = (float)(int)(layout->max_x - scroll.x); scroll_step = layout->max_x * 0.05f; scroll_inc = layout->max_x * 0.005f; scroll_offset = nk_do_scrollbarh(&state, out, scroll, scroll_has_scrolling, scroll_offset, scroll_target, scroll_step, scroll_inc, &ctx->style.scrollh, in, style->font); *layout->offset_x = (nk_uint)scroll_offset; } } /* hide scroll if no user input */ if (window->flags & NK_WINDOW_SCROLL_AUTO_HIDE) { int has_input = ctx->input.mouse.delta.x != 0 || ctx->input.mouse.delta.y != 0 || ctx->input.mouse.scroll_delta.y != 0; int is_window_hovered = nk_window_is_hovered(ctx); int any_item_active = (ctx->last_widget_state & NK_WIDGET_STATE_MODIFIED); if ((!has_input && is_window_hovered) || (!is_window_hovered && !any_item_active)) window->scrollbar_hiding_timer += ctx->delta_time_seconds; else window->scrollbar_hiding_timer = 0; } else window->scrollbar_hiding_timer = 0; /* window border */ if (layout->flags & NK_WINDOW_BORDER) { struct nk_color border_color = nk_panel_get_border_color(style, layout->type); const float padding_y = (layout->flags & NK_WINDOW_MINIMIZED) ? (style->window.border + window->bounds.y + layout->header_height) : ((layout->flags & NK_WINDOW_DYNAMIC) ? (layout->bounds.y + layout->bounds.h + layout->footer_height) : (window->bounds.y + window->bounds.h)); struct nk_rect b = window->bounds; b.h = padding_y - window->bounds.y; nk_stroke_rect(out, b, 0, layout->border, border_color); } /* scaler */ if ((layout->flags & NK_WINDOW_SCALABLE) && in && !(layout->flags & NK_WINDOW_MINIMIZED)) { /* calculate scaler bounds */ struct nk_rect scaler; scaler.w = scrollbar_size.x; scaler.h = scrollbar_size.y; scaler.y = layout->bounds.y + layout->bounds.h; if (layout->flags & NK_WINDOW_SCALE_LEFT) scaler.x = layout->bounds.x - panel_padding.x * 0.5f; else scaler.x = layout->bounds.x + layout->bounds.w + panel_padding.x; if (layout->flags & NK_WINDOW_NO_SCROLLBAR) scaler.x -= scaler.w; /* draw scaler */ {const struct nk_style_item *item = &style->window.scaler; if (item->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, scaler, &item->data.image, nk_white); else { if (layout->flags & NK_WINDOW_SCALE_LEFT) { nk_fill_triangle(out, scaler.x, scaler.y, scaler.x, scaler.y + scaler.h, scaler.x + scaler.w, scaler.y + scaler.h, item->data.color); } else { nk_fill_triangle(out, scaler.x + scaler.w, scaler.y, scaler.x + scaler.w, scaler.y + scaler.h, scaler.x, scaler.y + scaler.h, item->data.color); } }} /* do window scaling */ if (!(window->flags & NK_WINDOW_ROM)) { struct nk_vec2 window_size = style->window.min_size; int left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down; int left_mouse_click_in_scaler = nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, scaler, nk_true); if (left_mouse_down && left_mouse_click_in_scaler) { float delta_x = in->mouse.delta.x; if (layout->flags & NK_WINDOW_SCALE_LEFT) { delta_x = -delta_x; window->bounds.x += in->mouse.delta.x; } /* dragging in x-direction */ if (window->bounds.w + delta_x >= window_size.x) { if ((delta_x < 0) || (delta_x > 0 && in->mouse.pos.x >= scaler.x)) { window->bounds.w = window->bounds.w + delta_x; scaler.x += in->mouse.delta.x; } } /* dragging in y-direction (only possible if static window) */ if (!(layout->flags & NK_WINDOW_DYNAMIC)) { if (window_size.y < window->bounds.h + in->mouse.delta.y) { if ((in->mouse.delta.y < 0) || (in->mouse.delta.y > 0 && in->mouse.pos.y >= scaler.y)) { window->bounds.h = window->bounds.h + in->mouse.delta.y; scaler.y += in->mouse.delta.y; } } } ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_RESIZE_TOP_RIGHT_DOWN_LEFT]; in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x = scaler.x + scaler.w/2.0f; in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.y = scaler.y + scaler.h/2.0f; } } } if (!nk_panel_is_sub(layout->type)) { /* window is hidden so clear command buffer */ if (layout->flags & NK_WINDOW_HIDDEN) nk_command_buffer_reset(&window->buffer); /* window is visible and not tab */ else nk_finish(ctx, window); } /* NK_WINDOW_REMOVE_ROM flag was set so remove NK_WINDOW_ROM */ if (layout->flags & NK_WINDOW_REMOVE_ROM) { layout->flags &= ~(nk_flags)NK_WINDOW_ROM; layout->flags &= ~(nk_flags)NK_WINDOW_REMOVE_ROM; } window->flags = layout->flags; /* property garbage collector */ if (window->property.active && window->property.old != window->property.seq && window->property.active == window->property.prev) { nk_zero(&window->property, sizeof(window->property)); } else { window->property.old = window->property.seq; window->property.prev = window->property.active; window->property.seq = 0; } /* edit garbage collector */ if (window->edit.active && window->edit.old != window->edit.seq && window->edit.active == window->edit.prev) { nk_zero(&window->edit, sizeof(window->edit)); } else { window->edit.old = window->edit.seq; window->edit.prev = window->edit.active; window->edit.seq = 0; } /* contextual garbage collector */ if (window->popup.active_con && window->popup.con_old != window->popup.con_count) { window->popup.con_count = 0; window->popup.con_old = 0; window->popup.active_con = 0; } else { window->popup.con_old = window->popup.con_count; window->popup.con_count = 0; } window->popup.combo_count = 0; /* helper to make sure you have a 'nk_tree_push' for every 'nk_tree_pop' */ NK_ASSERT(!layout->row.tree_depth); } /* =============================================================== * * WINDOW * * ===============================================================*/ NK_LIB void* nk_create_window(struct nk_context *ctx) { struct nk_page_element *elem; elem = nk_create_page_element(ctx); if (!elem) return 0; elem->data.win.seq = ctx->seq; return &elem->data.win; } NK_LIB void nk_free_window(struct nk_context *ctx, struct nk_window *win) { /* unlink windows from list */ struct nk_table *it = win->tables; if (win->popup.win) { nk_free_window(ctx, win->popup.win); win->popup.win = 0; } win->next = 0; win->prev = 0; while (it) { /*free window state tables */ struct nk_table *n = it->next; nk_remove_table(win, it); nk_free_table(ctx, it); if (it == win->tables) win->tables = n; it = n; } /* link windows into freelist */ {union nk_page_data *pd = NK_CONTAINER_OF(win, union nk_page_data, win); struct nk_page_element *pe = NK_CONTAINER_OF(pd, struct nk_page_element, data); nk_free_page_element(ctx, pe);} } NK_LIB struct nk_window* nk_find_window(struct nk_context *ctx, nk_hash hash, const char *name) { struct nk_window *iter; iter = ctx->begin; while (iter) { NK_ASSERT(iter != iter->next); if (iter->name == hash) { int max_len = nk_strlen(iter->name_string); if (!nk_stricmpn(iter->name_string, name, max_len)) return iter; } iter = iter->next; } return 0; } NK_LIB void nk_insert_window(struct nk_context *ctx, struct nk_window *win, enum nk_window_insert_location loc) { const struct nk_window *iter; NK_ASSERT(ctx); NK_ASSERT(win); if (!win || !ctx) return; iter = ctx->begin; while (iter) { NK_ASSERT(iter != iter->next); NK_ASSERT(iter != win); if (iter == win) return; iter = iter->next; } if (!ctx->begin) { win->next = 0; win->prev = 0; ctx->begin = win; ctx->end = win; ctx->count = 1; return; } if (loc == NK_INSERT_BACK) { struct nk_window *end; end = ctx->end; end->flags |= NK_WINDOW_ROM; end->next = win; win->prev = ctx->end; win->next = 0; ctx->end = win; ctx->active = ctx->end; ctx->end->flags &= ~(nk_flags)NK_WINDOW_ROM; } else { /*ctx->end->flags |= NK_WINDOW_ROM;*/ ctx->begin->prev = win; win->next = ctx->begin; win->prev = 0; ctx->begin = win; ctx->begin->flags &= ~(nk_flags)NK_WINDOW_ROM; } ctx->count++; } NK_LIB void nk_remove_window(struct nk_context *ctx, struct nk_window *win) { if (win == ctx->begin || win == ctx->end) { if (win == ctx->begin) { ctx->begin = win->next; if (win->next) win->next->prev = 0; } if (win == ctx->end) { ctx->end = win->prev; if (win->prev) win->prev->next = 0; } } else { if (win->next) win->next->prev = win->prev; if (win->prev) win->prev->next = win->next; } if (win == ctx->active || !ctx->active) { ctx->active = ctx->end; if (ctx->end) ctx->end->flags &= ~(nk_flags)NK_WINDOW_ROM; } win->next = 0; win->prev = 0; ctx->count--; } NK_API int nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags) { return nk_begin_titled(ctx, title, title, bounds, flags); } NK_API int nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, struct nk_rect bounds, nk_flags flags) { struct nk_window *win; struct nk_style *style; nk_hash title_hash; int title_len; int ret = 0; NK_ASSERT(ctx); NK_ASSERT(name); NK_ASSERT(title); NK_ASSERT(ctx->style.font && ctx->style.font->width && "if this triggers you forgot to add a font"); NK_ASSERT(!ctx->current && "if this triggers you missed a `nk_end` call"); if (!ctx || ctx->current || !title || !name) return 0; /* find or create window */ style = &ctx->style; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) { /* create new window */ nk_size name_length = (nk_size)nk_strlen(name); win = (struct nk_window*)nk_create_window(ctx); NK_ASSERT(win); if (!win) return 0; if (flags & NK_WINDOW_BACKGROUND) nk_insert_window(ctx, win, NK_INSERT_FRONT); else nk_insert_window(ctx, win, NK_INSERT_BACK); nk_command_buffer_init(&win->buffer, &ctx->memory, NK_CLIPPING_ON); win->flags = flags; win->bounds = bounds; win->name = title_hash; name_length = NK_MIN(name_length, NK_WINDOW_MAX_NAME-1); NK_MEMCPY(win->name_string, name, name_length); win->name_string[name_length] = 0; win->popup.win = 0; if (!ctx->active) ctx->active = win; } else { /* update window */ win->flags &= ~(nk_flags)(NK_WINDOW_PRIVATE-1); win->flags |= flags; if (!(win->flags & (NK_WINDOW_MOVABLE | NK_WINDOW_SCALABLE))) win->bounds = bounds; /* If this assert triggers you either: * * I.) Have more than one window with the same name or * II.) You forgot to actually draw the window. * More specific you did not call `nk_clear` (nk_clear will be * automatically called for you if you are using one of the * provided demo backends). */ NK_ASSERT(win->seq != ctx->seq); win->seq = ctx->seq; if (!ctx->active && !(win->flags & NK_WINDOW_HIDDEN)) { ctx->active = win; ctx->end = win; } } if (win->flags & NK_WINDOW_HIDDEN) { ctx->current = win; win->layout = 0; return 0; } else nk_start(ctx, win); /* window overlapping */ if (!(win->flags & NK_WINDOW_HIDDEN) && !(win->flags & NK_WINDOW_NO_INPUT)) { int inpanel, ishovered; struct nk_window *iter = win; float h = ctx->style.font->height + 2.0f * style->window.header.padding.y + (2.0f * style->window.header.label_padding.y); struct nk_rect win_bounds = (!(win->flags & NK_WINDOW_MINIMIZED))? win->bounds: nk_rect(win->bounds.x, win->bounds.y, win->bounds.w, h); /* activate window if hovered and no other window is overlapping this window */ inpanel = nk_input_has_mouse_click_down_in_rect(&ctx->input, NK_BUTTON_LEFT, win_bounds, nk_true); inpanel = inpanel && ctx->input.mouse.buttons[NK_BUTTON_LEFT].clicked; ishovered = nk_input_is_mouse_hovering_rect(&ctx->input, win_bounds); if ((win != ctx->active) && ishovered && !ctx->input.mouse.buttons[NK_BUTTON_LEFT].down) { iter = win->next; while (iter) { struct nk_rect iter_bounds = (!(iter->flags & NK_WINDOW_MINIMIZED))? iter->bounds: nk_rect(iter->bounds.x, iter->bounds.y, iter->bounds.w, h); if (NK_INTERSECT(win_bounds.x, win_bounds.y, win_bounds.w, win_bounds.h, iter_bounds.x, iter_bounds.y, iter_bounds.w, iter_bounds.h) && (!(iter->flags & NK_WINDOW_HIDDEN))) break; if (iter->popup.win && iter->popup.active && !(iter->flags & NK_WINDOW_HIDDEN) && NK_INTERSECT(win->bounds.x, win_bounds.y, win_bounds.w, win_bounds.h, iter->popup.win->bounds.x, iter->popup.win->bounds.y, iter->popup.win->bounds.w, iter->popup.win->bounds.h)) break; iter = iter->next; } } /* activate window if clicked */ if (iter && inpanel && (win != ctx->end)) { iter = win->next; while (iter) { /* try to find a panel with higher priority in the same position */ struct nk_rect iter_bounds = (!(iter->flags & NK_WINDOW_MINIMIZED))? iter->bounds: nk_rect(iter->bounds.x, iter->bounds.y, iter->bounds.w, h); if (NK_INBOX(ctx->input.mouse.pos.x, ctx->input.mouse.pos.y, iter_bounds.x, iter_bounds.y, iter_bounds.w, iter_bounds.h) && !(iter->flags & NK_WINDOW_HIDDEN)) break; if (iter->popup.win && iter->popup.active && !(iter->flags & NK_WINDOW_HIDDEN) && NK_INTERSECT(win_bounds.x, win_bounds.y, win_bounds.w, win_bounds.h, iter->popup.win->bounds.x, iter->popup.win->bounds.y, iter->popup.win->bounds.w, iter->popup.win->bounds.h)) break; iter = iter->next; } } if (iter && !(win->flags & NK_WINDOW_ROM) && (win->flags & NK_WINDOW_BACKGROUND)) { win->flags |= (nk_flags)NK_WINDOW_ROM; iter->flags &= ~(nk_flags)NK_WINDOW_ROM; ctx->active = iter; if (!(iter->flags & NK_WINDOW_BACKGROUND)) { /* current window is active in that position so transfer to top * at the highest priority in stack */ nk_remove_window(ctx, iter); nk_insert_window(ctx, iter, NK_INSERT_BACK); } } else { if (!iter && ctx->end != win) { if (!(win->flags & NK_WINDOW_BACKGROUND)) { /* current window is active in that position so transfer to top * at the highest priority in stack */ nk_remove_window(ctx, win); nk_insert_window(ctx, win, NK_INSERT_BACK); } win->flags &= ~(nk_flags)NK_WINDOW_ROM; ctx->active = win; } if (ctx->end != win && !(win->flags & NK_WINDOW_BACKGROUND)) win->flags |= NK_WINDOW_ROM; } } win->layout = (struct nk_panel*)nk_create_panel(ctx); ctx->current = win; ret = nk_panel_begin(ctx, title, NK_PANEL_WINDOW); win->layout->offset_x = &win->scrollbar.x; win->layout->offset_y = &win->scrollbar.y; return ret; } NK_API void nk_end(struct nk_context *ctx) { struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current && "if this triggers you forgot to call `nk_begin`"); if (!ctx || !ctx->current) return; layout = ctx->current->layout; if (!layout || (layout->type == NK_PANEL_WINDOW && (ctx->current->flags & NK_WINDOW_HIDDEN))) { ctx->current = 0; return; } nk_panel_end(ctx); nk_free_panel(ctx, ctx->current->layout); ctx->current = 0; } NK_API struct nk_rect nk_window_get_bounds(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_rect(0,0,0,0); return ctx->current->bounds; } NK_API struct nk_vec2 nk_window_get_position(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_vec2(0,0); return nk_vec2(ctx->current->bounds.x, ctx->current->bounds.y); } NK_API struct nk_vec2 nk_window_get_size(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_vec2(0,0); return nk_vec2(ctx->current->bounds.w, ctx->current->bounds.h); } NK_API float nk_window_get_width(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return 0; return ctx->current->bounds.w; } NK_API float nk_window_get_height(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return 0; return ctx->current->bounds.h; } NK_API struct nk_rect nk_window_get_content_region(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_rect(0,0,0,0); return ctx->current->layout->clip; } NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current) return nk_vec2(0,0); return nk_vec2(ctx->current->layout->clip.x, ctx->current->layout->clip.y); } NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current) return nk_vec2(0,0); return nk_vec2(ctx->current->layout->clip.x + ctx->current->layout->clip.w, ctx->current->layout->clip.y + ctx->current->layout->clip.h); } NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current) return nk_vec2(0,0); return nk_vec2(ctx->current->layout->clip.w, ctx->current->layout->clip.h); } NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current) return 0; return &ctx->current->buffer; } NK_API struct nk_panel* nk_window_get_panel(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return 0; return ctx->current->layout; } NK_API int nk_window_has_focus(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current) return 0; return ctx->current == ctx->active; } NK_API int nk_window_is_hovered(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return 0; if(ctx->current->flags & NK_WINDOW_HIDDEN) return 0; return nk_input_is_mouse_hovering_rect(&ctx->input, ctx->current->bounds); } NK_API int nk_window_is_any_hovered(struct nk_context *ctx) { struct nk_window *iter; NK_ASSERT(ctx); if (!ctx) return 0; iter = ctx->begin; while (iter) { /* check if window is being hovered */ if(!(iter->flags & NK_WINDOW_HIDDEN)) { /* check if window popup is being hovered */ if (iter->popup.active && iter->popup.win && nk_input_is_mouse_hovering_rect(&ctx->input, iter->popup.win->bounds)) return 1; if (iter->flags & NK_WINDOW_MINIMIZED) { struct nk_rect header = iter->bounds; header.h = ctx->style.font->height + 2 * ctx->style.window.header.padding.y; if (nk_input_is_mouse_hovering_rect(&ctx->input, header)) return 1; } else if (nk_input_is_mouse_hovering_rect(&ctx->input, iter->bounds)) { return 1; } } iter = iter->next; } return 0; } NK_API int nk_item_is_any_active(struct nk_context *ctx) { int any_hovered = nk_window_is_any_hovered(ctx); int any_active = (ctx->last_widget_state & NK_WIDGET_STATE_MODIFIED); return any_hovered || any_active; } NK_API int nk_window_is_collapsed(struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return 0; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) return 0; return win->flags & NK_WINDOW_MINIMIZED; } NK_API int nk_window_is_closed(struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return 1; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) return 1; return (win->flags & NK_WINDOW_CLOSED); } NK_API int nk_window_is_hidden(struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return 1; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) return 1; return (win->flags & NK_WINDOW_HIDDEN); } NK_API int nk_window_is_active(struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return 0; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) return 0; return win == ctx->active; } NK_API struct nk_window* nk_window_find(struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); return nk_find_window(ctx, title_hash, name); } NK_API void nk_window_close(struct nk_context *ctx, const char *name) { struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return; win = nk_window_find(ctx, name); if (!win) return; NK_ASSERT(ctx->current != win && "You cannot close a currently active window"); if (ctx->current == win) return; win->flags |= NK_WINDOW_HIDDEN; win->flags |= NK_WINDOW_CLOSED; } NK_API void nk_window_set_bounds(struct nk_context *ctx, const char *name, struct nk_rect bounds) { struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return; win = nk_window_find(ctx, name); if (!win) return; NK_ASSERT(ctx->current != win && "You cannot update a currently in procecss window"); win->bounds = bounds; } NK_API void nk_window_set_position(struct nk_context *ctx, const char *name, struct nk_vec2 pos) { struct nk_window *win = nk_window_find(ctx, name); if (!win) return; win->bounds.x = pos.x; win->bounds.y = pos.y; } NK_API void nk_window_set_size(struct nk_context *ctx, const char *name, struct nk_vec2 size) { struct nk_window *win = nk_window_find(ctx, name); if (!win) return; win->bounds.w = size.x; win->bounds.h = size.y; } NK_API void nk_window_collapse(struct nk_context *ctx, const char *name, enum nk_collapse_states c) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) return; if (c == NK_MINIMIZED) win->flags |= NK_WINDOW_MINIMIZED; else win->flags &= ~(nk_flags)NK_WINDOW_MINIMIZED; } NK_API void nk_window_collapse_if(struct nk_context *ctx, const char *name, enum nk_collapse_states c, int cond) { NK_ASSERT(ctx); if (!ctx || !cond) return; nk_window_collapse(ctx, name, c); } NK_API void nk_window_show(struct nk_context *ctx, const char *name, enum nk_show_states s) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (!win) return; if (s == NK_HIDDEN) { win->flags |= NK_WINDOW_HIDDEN; } else win->flags &= ~(nk_flags)NK_WINDOW_HIDDEN; } NK_API void nk_window_show_if(struct nk_context *ctx, const char *name, enum nk_show_states s, int cond) { NK_ASSERT(ctx); if (!ctx || !cond) return; nk_window_show(ctx, name, s); } NK_API void nk_window_set_focus(struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; struct nk_window *win; NK_ASSERT(ctx); if (!ctx) return; title_len = (int)nk_strlen(name); title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); win = nk_find_window(ctx, title_hash, name); if (win && ctx->end != win) { nk_remove_window(ctx, win); nk_insert_window(ctx, win, NK_INSERT_BACK); } ctx->active = win; } /* =============================================================== * * POPUP * * ===============================================================*/ NK_API int nk_popup_begin(struct nk_context *ctx, enum nk_popup_type type, const char *title, nk_flags flags, struct nk_rect rect) { struct nk_window *popup; struct nk_window *win; struct nk_panel *panel; int title_len; nk_hash title_hash; nk_size allocated; NK_ASSERT(ctx); NK_ASSERT(title); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; panel = win->layout; NK_ASSERT(!(panel->type & NK_PANEL_SET_POPUP) && "popups are not allowed to have popups"); (void)panel; title_len = (int)nk_strlen(title); title_hash = nk_murmur_hash(title, (int)title_len, NK_PANEL_POPUP); popup = win->popup.win; if (!popup) { popup = (struct nk_window*)nk_create_window(ctx); popup->parent = win; win->popup.win = popup; win->popup.active = 0; win->popup.type = NK_PANEL_POPUP; } /* make sure we have correct popup */ if (win->popup.name != title_hash) { if (!win->popup.active) { nk_zero(popup, sizeof(*popup)); win->popup.name = title_hash; win->popup.active = 1; win->popup.type = NK_PANEL_POPUP; } else return 0; } /* popup position is local to window */ ctx->current = popup; rect.x += win->layout->clip.x; rect.y += win->layout->clip.y; /* setup popup data */ popup->parent = win; popup->bounds = rect; popup->seq = ctx->seq; popup->layout = (struct nk_panel*)nk_create_panel(ctx); popup->flags = flags; popup->flags |= NK_WINDOW_BORDER; if (type == NK_POPUP_DYNAMIC) popup->flags |= NK_WINDOW_DYNAMIC; popup->buffer = win->buffer; nk_start_popup(ctx, win); allocated = ctx->memory.allocated; nk_push_scissor(&popup->buffer, nk_null_rect); if (nk_panel_begin(ctx, title, NK_PANEL_POPUP)) { /* popup is running therefore invalidate parent panels */ struct nk_panel *root; root = win->layout; while (root) { root->flags |= NK_WINDOW_ROM; root->flags &= ~(nk_flags)NK_WINDOW_REMOVE_ROM; root = root->parent; } win->popup.active = 1; popup->layout->offset_x = &popup->scrollbar.x; popup->layout->offset_y = &popup->scrollbar.y; popup->layout->parent = win->layout; return 1; } else { /* popup was closed/is invalid so cleanup */ struct nk_panel *root; root = win->layout; while (root) { root->flags |= NK_WINDOW_REMOVE_ROM; root = root->parent; } win->popup.buf.active = 0; win->popup.active = 0; ctx->memory.allocated = allocated; ctx->current = win; nk_free_panel(ctx, popup->layout); popup->layout = 0; return 0; } } NK_LIB int nk_nonblock_begin(struct nk_context *ctx, nk_flags flags, struct nk_rect body, struct nk_rect header, enum nk_panel_type panel_type) { struct nk_window *popup; struct nk_window *win; struct nk_panel *panel; int is_active = nk_true; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; /* popups cannot have popups */ win = ctx->current; panel = win->layout; NK_ASSERT(!(panel->type & NK_PANEL_SET_POPUP)); (void)panel; popup = win->popup.win; if (!popup) { /* create window for nonblocking popup */ popup = (struct nk_window*)nk_create_window(ctx); popup->parent = win; win->popup.win = popup; win->popup.type = panel_type; nk_command_buffer_init(&popup->buffer, &ctx->memory, NK_CLIPPING_ON); } else { /* close the popup if user pressed outside or in the header */ int pressed, in_body, in_header; pressed = nk_input_is_mouse_pressed(&ctx->input, NK_BUTTON_LEFT); in_body = nk_input_is_mouse_hovering_rect(&ctx->input, body); in_header = nk_input_is_mouse_hovering_rect(&ctx->input, header); if (pressed && (!in_body || in_header)) is_active = nk_false; } win->popup.header = header; if (!is_active) { /* remove read only mode from all parent panels */ struct nk_panel *root = win->layout; while (root) { root->flags |= NK_WINDOW_REMOVE_ROM; root = root->parent; } return is_active; } popup->bounds = body; popup->parent = win; popup->layout = (struct nk_panel*)nk_create_panel(ctx); popup->flags = flags; popup->flags |= NK_WINDOW_BORDER; popup->flags |= NK_WINDOW_DYNAMIC; popup->seq = ctx->seq; win->popup.active = 1; NK_ASSERT(popup->layout); nk_start_popup(ctx, win); popup->buffer = win->buffer; nk_push_scissor(&popup->buffer, nk_null_rect); ctx->current = popup; nk_panel_begin(ctx, 0, panel_type); win->buffer = popup->buffer; popup->layout->parent = win->layout; popup->layout->offset_x = &popup->scrollbar.x; popup->layout->offset_y = &popup->scrollbar.y; /* set read only mode to all parent panels */ {struct nk_panel *root; root = win->layout; while (root) { root->flags |= NK_WINDOW_ROM; root = root->parent; }} return is_active; } NK_API void nk_popup_close(struct nk_context *ctx) { struct nk_window *popup; NK_ASSERT(ctx); if (!ctx || !ctx->current) return; popup = ctx->current; NK_ASSERT(popup->parent); NK_ASSERT(popup->layout->type & NK_PANEL_SET_POPUP); popup->flags |= NK_WINDOW_HIDDEN; } NK_API void nk_popup_end(struct nk_context *ctx) { struct nk_window *win; struct nk_window *popup; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; popup = ctx->current; if (!popup->parent) return; win = popup->parent; if (popup->flags & NK_WINDOW_HIDDEN) { struct nk_panel *root; root = win->layout; while (root) { root->flags |= NK_WINDOW_REMOVE_ROM; root = root->parent; } win->popup.active = 0; } nk_push_scissor(&popup->buffer, nk_null_rect); nk_end(ctx); win->buffer = popup->buffer; nk_finish_popup(ctx, win); ctx->current = win; nk_push_scissor(&win->buffer, win->layout->clip); } /* ============================================================== * * CONTEXTUAL * * ===============================================================*/ NK_API int nk_contextual_begin(struct nk_context *ctx, nk_flags flags, struct nk_vec2 size, struct nk_rect trigger_bounds) { struct nk_window *win; struct nk_window *popup; struct nk_rect body; NK_STORAGE const struct nk_rect null_rect = {-1,-1,0,0}; int is_clicked = 0; int is_open = 0; int ret = 0; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; ++win->popup.con_count; if (ctx->current != ctx->active) return 0; /* check if currently active contextual is active */ popup = win->popup.win; is_open = (popup && win->popup.type == NK_PANEL_CONTEXTUAL); is_clicked = nk_input_mouse_clicked(&ctx->input, NK_BUTTON_RIGHT, trigger_bounds); if (win->popup.active_con && win->popup.con_count != win->popup.active_con) return 0; if (!is_open && win->popup.active_con) win->popup.active_con = 0; if ((!is_open && !is_clicked)) return 0; /* calculate contextual position on click */ win->popup.active_con = win->popup.con_count; if (is_clicked) { body.x = ctx->input.mouse.pos.x; body.y = ctx->input.mouse.pos.y; } else { body.x = popup->bounds.x; body.y = popup->bounds.y; } body.w = size.x; body.h = size.y; /* start nonblocking contextual popup */ ret = nk_nonblock_begin(ctx, flags|NK_WINDOW_NO_SCROLLBAR, body, null_rect, NK_PANEL_CONTEXTUAL); if (ret) win->popup.type = NK_PANEL_CONTEXTUAL; else { win->popup.active_con = 0; win->popup.type = NK_PANEL_NONE; if (win->popup.win) win->popup.win->flags = 0; } return ret; } NK_API int nk_contextual_item_text(struct nk_context *ctx, const char *text, int len, nk_flags alignment) { struct nk_window *win; const struct nk_input *in; const struct nk_style *style; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; state = nk_widget_fitting(&bounds, ctx, style->contextual_button.padding); if (!state) return nk_false; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_text(&ctx->last_widget_state, &win->buffer, bounds, text, len, alignment, NK_BUTTON_DEFAULT, &style->contextual_button, in, style->font)) { nk_contextual_close(ctx); return nk_true; } return nk_false; } NK_API int nk_contextual_item_label(struct nk_context *ctx, const char *label, nk_flags align) { return nk_contextual_item_text(ctx, label, nk_strlen(label), align); } NK_API int nk_contextual_item_image_text(struct nk_context *ctx, struct nk_image img, const char *text, int len, nk_flags align) { struct nk_window *win; const struct nk_input *in; const struct nk_style *style; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; state = nk_widget_fitting(&bounds, ctx, style->contextual_button.padding); if (!state) return nk_false; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_text_image(&ctx->last_widget_state, &win->buffer, bounds, img, text, len, align, NK_BUTTON_DEFAULT, &style->contextual_button, style->font, in)){ nk_contextual_close(ctx); return nk_true; } return nk_false; } NK_API int nk_contextual_item_image_label(struct nk_context *ctx, struct nk_image img, const char *label, nk_flags align) { return nk_contextual_item_image_text(ctx, img, label, nk_strlen(label), align); } NK_API int nk_contextual_item_symbol_text(struct nk_context *ctx, enum nk_symbol_type symbol, const char *text, int len, nk_flags align) { struct nk_window *win; const struct nk_input *in; const struct nk_style *style; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; state = nk_widget_fitting(&bounds, ctx, style->contextual_button.padding); if (!state) return nk_false; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_text_symbol(&ctx->last_widget_state, &win->buffer, bounds, symbol, text, len, align, NK_BUTTON_DEFAULT, &style->contextual_button, style->font, in)) { nk_contextual_close(ctx); return nk_true; } return nk_false; } NK_API int nk_contextual_item_symbol_label(struct nk_context *ctx, enum nk_symbol_type symbol, const char *text, nk_flags align) { return nk_contextual_item_symbol_text(ctx, symbol, text, nk_strlen(text), align); } NK_API void nk_contextual_close(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; nk_popup_close(ctx); } NK_API void nk_contextual_end(struct nk_context *ctx) { struct nk_window *popup; struct nk_panel *panel; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return; popup = ctx->current; panel = popup->layout; NK_ASSERT(popup->parent); NK_ASSERT(panel->type & NK_PANEL_SET_POPUP); if (panel->flags & NK_WINDOW_DYNAMIC) { /* Close behavior This is a bit of a hack solution since we do not know before we end our popup how big it will be. We therefore do not directly know when a click outside the non-blocking popup must close it at that direct frame. Instead it will be closed in the next frame.*/ struct nk_rect body = {0,0,0,0}; if (panel->at_y < (panel->bounds.y + panel->bounds.h)) { struct nk_vec2 padding = nk_panel_get_padding(&ctx->style, panel->type); body = panel->bounds; body.y = (panel->at_y + panel->footer_height + panel->border + padding.y + panel->row.height); body.h = (panel->bounds.y + panel->bounds.h) - body.y; } {int pressed = nk_input_is_mouse_pressed(&ctx->input, NK_BUTTON_LEFT); int in_body = nk_input_is_mouse_hovering_rect(&ctx->input, body); if (pressed && in_body) popup->flags |= NK_WINDOW_HIDDEN; } } if (popup->flags & NK_WINDOW_HIDDEN) popup->seq = 0; nk_popup_end(ctx); return; } /* =============================================================== * * MENU * * ===============================================================*/ NK_API void nk_menubar_begin(struct nk_context *ctx) { struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; layout = ctx->current->layout; NK_ASSERT(layout->at_y == layout->bounds.y); /* if this assert triggers you allocated space between nk_begin and nk_menubar_begin. If you want a menubar the first nuklear function after `nk_begin` has to be a `nk_menubar_begin` call. Inside the menubar you then have to allocate space for widgets (also supports multiple rows). Example: if (nk_begin(...)) { nk_menubar_begin(...); nk_layout_xxxx(...); nk_button(...); nk_layout_xxxx(...); nk_button(...); nk_menubar_end(...); } nk_end(...); */ if (layout->flags & NK_WINDOW_HIDDEN || layout->flags & NK_WINDOW_MINIMIZED) return; layout->menu.x = layout->at_x; layout->menu.y = layout->at_y + layout->row.height; layout->menu.w = layout->bounds.w; layout->menu.offset.x = *layout->offset_x; layout->menu.offset.y = *layout->offset_y; *layout->offset_y = 0; } NK_API void nk_menubar_end(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; struct nk_command_buffer *out; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; out = &win->buffer; layout = win->layout; if (layout->flags & NK_WINDOW_HIDDEN || layout->flags & NK_WINDOW_MINIMIZED) return; layout->menu.h = layout->at_y - layout->menu.y; layout->bounds.y += layout->menu.h + ctx->style.window.spacing.y + layout->row.height; layout->bounds.h -= layout->menu.h + ctx->style.window.spacing.y + layout->row.height; *layout->offset_x = layout->menu.offset.x; *layout->offset_y = layout->menu.offset.y; layout->at_y = layout->bounds.y - layout->row.height; layout->clip.y = layout->bounds.y; layout->clip.h = layout->bounds.h; nk_push_scissor(out, layout->clip); } NK_INTERN int nk_menu_begin(struct nk_context *ctx, struct nk_window *win, const char *id, int is_clicked, struct nk_rect header, struct nk_vec2 size) { int is_open = 0; int is_active = 0; struct nk_rect body; struct nk_window *popup; nk_hash hash = nk_murmur_hash(id, (int)nk_strlen(id), NK_PANEL_MENU); NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; body.x = header.x; body.w = size.x; body.y = header.y + header.h; body.h = size.y; popup = win->popup.win; is_open = popup ? nk_true : nk_false; is_active = (popup && (win->popup.name == hash) && win->popup.type == NK_PANEL_MENU); if ((is_clicked && is_open && !is_active) || (is_open && !is_active) || (!is_open && !is_active && !is_clicked)) return 0; if (!nk_nonblock_begin(ctx, NK_WINDOW_NO_SCROLLBAR, body, header, NK_PANEL_MENU)) return 0; win->popup.type = NK_PANEL_MENU; win->popup.name = hash; return 1; } NK_API int nk_menu_begin_text(struct nk_context *ctx, const char *title, int len, nk_flags align, struct nk_vec2 size) { struct nk_window *win; const struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; nk_flags state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; state = nk_widget(&header, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || win->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_text(&ctx->last_widget_state, &win->buffer, header, title, len, align, NK_BUTTON_DEFAULT, &ctx->style.menu_button, in, ctx->style.font)) is_clicked = nk_true; return nk_menu_begin(ctx, win, title, is_clicked, header, size); } NK_API int nk_menu_begin_label(struct nk_context *ctx, const char *text, nk_flags align, struct nk_vec2 size) { return nk_menu_begin_text(ctx, text, nk_strlen(text), align, size); } NK_API int nk_menu_begin_image(struct nk_context *ctx, const char *id, struct nk_image img, struct nk_vec2 size) { struct nk_window *win; struct nk_rect header; const struct nk_input *in; int is_clicked = nk_false; nk_flags state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; state = nk_widget(&header, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_image(&ctx->last_widget_state, &win->buffer, header, img, NK_BUTTON_DEFAULT, &ctx->style.menu_button, in)) is_clicked = nk_true; return nk_menu_begin(ctx, win, id, is_clicked, header, size); } NK_API int nk_menu_begin_symbol(struct nk_context *ctx, const char *id, enum nk_symbol_type sym, struct nk_vec2 size) { struct nk_window *win; const struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; nk_flags state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; state = nk_widget(&header, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_symbol(&ctx->last_widget_state, &win->buffer, header, sym, NK_BUTTON_DEFAULT, &ctx->style.menu_button, in, ctx->style.font)) is_clicked = nk_true; return nk_menu_begin(ctx, win, id, is_clicked, header, size); } NK_API int nk_menu_begin_image_text(struct nk_context *ctx, const char *title, int len, nk_flags align, struct nk_image img, struct nk_vec2 size) { struct nk_window *win; struct nk_rect header; const struct nk_input *in; int is_clicked = nk_false; nk_flags state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; state = nk_widget(&header, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_text_image(&ctx->last_widget_state, &win->buffer, header, img, title, len, align, NK_BUTTON_DEFAULT, &ctx->style.menu_button, ctx->style.font, in)) is_clicked = nk_true; return nk_menu_begin(ctx, win, title, is_clicked, header, size); } NK_API int nk_menu_begin_image_label(struct nk_context *ctx, const char *title, nk_flags align, struct nk_image img, struct nk_vec2 size) { return nk_menu_begin_image_text(ctx, title, nk_strlen(title), align, img, size); } NK_API int nk_menu_begin_symbol_text(struct nk_context *ctx, const char *title, int len, nk_flags align, enum nk_symbol_type sym, struct nk_vec2 size) { struct nk_window *win; struct nk_rect header; const struct nk_input *in; int is_clicked = nk_false; nk_flags state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; state = nk_widget(&header, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; if (nk_do_button_text_symbol(&ctx->last_widget_state, &win->buffer, header, sym, title, len, align, NK_BUTTON_DEFAULT, &ctx->style.menu_button, ctx->style.font, in)) is_clicked = nk_true; return nk_menu_begin(ctx, win, title, is_clicked, header, size); } NK_API int nk_menu_begin_symbol_label(struct nk_context *ctx, const char *title, nk_flags align, enum nk_symbol_type sym, struct nk_vec2 size ) { return nk_menu_begin_symbol_text(ctx, title, nk_strlen(title), align,sym,size); } NK_API int nk_menu_item_text(struct nk_context *ctx, const char *title, int len, nk_flags align) { return nk_contextual_item_text(ctx, title, len, align); } NK_API int nk_menu_item_label(struct nk_context *ctx, const char *label, nk_flags align) { return nk_contextual_item_label(ctx, label, align); } NK_API int nk_menu_item_image_label(struct nk_context *ctx, struct nk_image img, const char *label, nk_flags align) { return nk_contextual_item_image_label(ctx, img, label, align); } NK_API int nk_menu_item_image_text(struct nk_context *ctx, struct nk_image img, const char *text, int len, nk_flags align) { return nk_contextual_item_image_text(ctx, img, text, len, align); } NK_API int nk_menu_item_symbol_text(struct nk_context *ctx, enum nk_symbol_type sym, const char *text, int len, nk_flags align) { return nk_contextual_item_symbol_text(ctx, sym, text, len, align); } NK_API int nk_menu_item_symbol_label(struct nk_context *ctx, enum nk_symbol_type sym, const char *label, nk_flags align) { return nk_contextual_item_symbol_label(ctx, sym, label, align); } NK_API void nk_menu_close(struct nk_context *ctx) { nk_contextual_close(ctx); } NK_API void nk_menu_end(struct nk_context *ctx) { nk_contextual_end(ctx); } /* =============================================================== * * LAYOUT * * ===============================================================*/ NK_API void nk_layout_set_min_row_height(struct nk_context *ctx, float height) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; layout->row.min_height = height; } NK_API void nk_layout_reset_min_row_height(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; layout->row.min_height = ctx->style.font->height; layout->row.min_height += ctx->style.text.padding.y*2; layout->row.min_height += ctx->style.window.min_row_height_padding*2; } NK_LIB float nk_layout_row_calculate_usable_space(const struct nk_style *style, enum nk_panel_type type, float total_space, int columns) { float panel_padding; float panel_spacing; float panel_space; struct nk_vec2 spacing; struct nk_vec2 padding; spacing = style->window.spacing; padding = nk_panel_get_padding(style, type); /* calculate the usable panel space */ panel_padding = 2 * padding.x; panel_spacing = (float)NK_MAX(columns - 1, 0) * spacing.x; panel_space = total_space - panel_padding - panel_spacing; return panel_space; } NK_LIB void nk_panel_layout(const struct nk_context *ctx, struct nk_window *win, float height, int cols) { struct nk_panel *layout; const struct nk_style *style; struct nk_command_buffer *out; struct nk_vec2 item_spacing; struct nk_color color; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; /* prefetch some configuration data */ layout = win->layout; style = &ctx->style; out = &win->buffer; color = style->window.background; item_spacing = style->window.spacing; /* if one of these triggers you forgot to add an `if` condition around either a window, group, popup, combobox or contextual menu `begin` and `end` block. Example: if (nk_begin(...) {...} nk_end(...); or if (nk_group_begin(...) { nk_group_end(...);} */ NK_ASSERT(!(layout->flags & NK_WINDOW_MINIMIZED)); NK_ASSERT(!(layout->flags & NK_WINDOW_HIDDEN)); NK_ASSERT(!(layout->flags & NK_WINDOW_CLOSED)); /* update the current row and set the current row layout */ layout->row.index = 0; layout->at_y += layout->row.height; layout->row.columns = cols; if (height == 0.0f) layout->row.height = NK_MAX(height, layout->row.min_height) + item_spacing.y; else layout->row.height = height + item_spacing.y; layout->row.item_offset = 0; if (layout->flags & NK_WINDOW_DYNAMIC) { /* draw background for dynamic panels */ struct nk_rect background; background.x = win->bounds.x; background.w = win->bounds.w; background.y = layout->at_y - 1.0f; background.h = layout->row.height + 1.0f; nk_fill_rect(out, background, 0, color); } } NK_LIB void nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt, float height, int cols, int width) { /* update the current row and set the current row layout */ struct nk_window *win; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; nk_panel_layout(ctx, win, height, cols); if (fmt == NK_DYNAMIC) win->layout->row.type = NK_LAYOUT_DYNAMIC_FIXED; else win->layout->row.type = NK_LAYOUT_STATIC_FIXED; win->layout->row.ratio = 0; win->layout->row.filled = 0; win->layout->row.item_offset = 0; win->layout->row.item_width = (float)width; } NK_API float nk_layout_ratio_from_pixel(struct nk_context *ctx, float pixel_width) { struct nk_window *win; NK_ASSERT(ctx); NK_ASSERT(pixel_width); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; return NK_CLAMP(0.0f, pixel_width/win->bounds.x, 1.0f); } NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols) { nk_row_layout(ctx, NK_DYNAMIC, height, cols, 0); } NK_API void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols) { nk_row_layout(ctx, NK_STATIC, height, cols, item_width); } NK_API void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; nk_panel_layout(ctx, win, row_height, cols); if (fmt == NK_DYNAMIC) layout->row.type = NK_LAYOUT_DYNAMIC_ROW; else layout->row.type = NK_LAYOUT_STATIC_ROW; layout->row.ratio = 0; layout->row.filled = 0; layout->row.item_width = 0; layout->row.item_offset = 0; layout->row.columns = cols; } NK_API void nk_layout_row_push(struct nk_context *ctx, float ratio_or_width) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; NK_ASSERT(layout->row.type == NK_LAYOUT_STATIC_ROW || layout->row.type == NK_LAYOUT_DYNAMIC_ROW); if (layout->row.type != NK_LAYOUT_STATIC_ROW && layout->row.type != NK_LAYOUT_DYNAMIC_ROW) return; if (layout->row.type == NK_LAYOUT_DYNAMIC_ROW) { float ratio = ratio_or_width; if ((ratio + layout->row.filled) > 1.0f) return; if (ratio > 0.0f) layout->row.item_width = NK_SATURATE(ratio); else layout->row.item_width = 1.0f - layout->row.filled; } else layout->row.item_width = ratio_or_width; } NK_API void nk_layout_row_end(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; NK_ASSERT(layout->row.type == NK_LAYOUT_STATIC_ROW || layout->row.type == NK_LAYOUT_DYNAMIC_ROW); if (layout->row.type != NK_LAYOUT_STATIC_ROW && layout->row.type != NK_LAYOUT_DYNAMIC_ROW) return; layout->row.item_width = 0; layout->row.item_offset = 0; } NK_API void nk_layout_row(struct nk_context *ctx, enum nk_layout_format fmt, float height, int cols, const float *ratio) { int i; int n_undef = 0; struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; nk_panel_layout(ctx, win, height, cols); if (fmt == NK_DYNAMIC) { /* calculate width of undefined widget ratios */ float r = 0; layout->row.ratio = ratio; for (i = 0; i < cols; ++i) { if (ratio[i] < 0.0f) n_undef++; else r += ratio[i]; } r = NK_SATURATE(1.0f - r); layout->row.type = NK_LAYOUT_DYNAMIC; layout->row.item_width = (r > 0 && n_undef > 0) ? (r / (float)n_undef):0; } else { layout->row.ratio = ratio; layout->row.type = NK_LAYOUT_STATIC; layout->row.item_width = 0; layout->row.item_offset = 0; } layout->row.item_offset = 0; layout->row.filled = 0; } NK_API void nk_layout_row_template_begin(struct nk_context *ctx, float height) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; nk_panel_layout(ctx, win, height, 1); layout->row.type = NK_LAYOUT_TEMPLATE; layout->row.columns = 0; layout->row.ratio = 0; layout->row.item_width = 0; layout->row.item_height = 0; layout->row.item_offset = 0; layout->row.filled = 0; layout->row.item.x = 0; layout->row.item.y = 0; layout->row.item.w = 0; layout->row.item.h = 0; } NK_API void nk_layout_row_template_push_dynamic(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE); NK_ASSERT(layout->row.columns < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS); if (layout->row.type != NK_LAYOUT_TEMPLATE) return; if (layout->row.columns >= NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS) return; layout->row.templates[layout->row.columns++] = -1.0f; } NK_API void nk_layout_row_template_push_variable(struct nk_context *ctx, float min_width) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE); NK_ASSERT(layout->row.columns < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS); if (layout->row.type != NK_LAYOUT_TEMPLATE) return; if (layout->row.columns >= NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS) return; layout->row.templates[layout->row.columns++] = -min_width; } NK_API void nk_layout_row_template_push_static(struct nk_context *ctx, float width) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE); NK_ASSERT(layout->row.columns < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS); if (layout->row.type != NK_LAYOUT_TEMPLATE) return; if (layout->row.columns >= NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS) return; layout->row.templates[layout->row.columns++] = width; } NK_API void nk_layout_row_template_end(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; int i = 0; int variable_count = 0; int min_variable_count = 0; float min_fixed_width = 0.0f; float total_fixed_width = 0.0f; float max_variable_width = 0.0f; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE); if (layout->row.type != NK_LAYOUT_TEMPLATE) return; for (i = 0; i < layout->row.columns; ++i) { float width = layout->row.templates[i]; if (width >= 0.0f) { total_fixed_width += width; min_fixed_width += width; } else if (width < -1.0f) { width = -width; total_fixed_width += width; max_variable_width = NK_MAX(max_variable_width, width); variable_count++; } else { min_variable_count++; variable_count++; } } if (variable_count) { float space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type, layout->bounds.w, layout->row.columns); float var_width = (NK_MAX(space-min_fixed_width,0.0f)) / (float)variable_count; int enough_space = var_width >= max_variable_width; if (!enough_space) var_width = (NK_MAX(space-total_fixed_width,0)) / (float)min_variable_count; for (i = 0; i < layout->row.columns; ++i) { float *width = &layout->row.templates[i]; *width = (*width >= 0.0f)? *width: (*width < -1.0f && !enough_space)? -(*width): var_width; } } } NK_API void nk_layout_space_begin(struct nk_context *ctx, enum nk_layout_format fmt, float height, int widget_count) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; nk_panel_layout(ctx, win, height, widget_count); if (fmt == NK_STATIC) layout->row.type = NK_LAYOUT_STATIC_FREE; else layout->row.type = NK_LAYOUT_DYNAMIC_FREE; layout->row.ratio = 0; layout->row.filled = 0; layout->row.item_width = 0; layout->row.item_offset = 0; } NK_API void nk_layout_space_end(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; layout->row.item_width = 0; layout->row.item_height = 0; layout->row.item_offset = 0; nk_zero(&layout->row.item, sizeof(layout->row.item)); } NK_API void nk_layout_space_push(struct nk_context *ctx, struct nk_rect rect) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; layout->row.item = rect; } NK_API struct nk_rect nk_layout_space_bounds(struct nk_context *ctx) { struct nk_rect ret; struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); win = ctx->current; layout = win->layout; ret.x = layout->clip.x; ret.y = layout->clip.y; ret.w = layout->clip.w; ret.h = layout->row.height; return ret; } NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context *ctx) { struct nk_rect ret; struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); win = ctx->current; layout = win->layout; ret.x = layout->at_x; ret.y = layout->at_y; ret.w = layout->bounds.w - NK_MAX(layout->at_x - layout->bounds.x,0); ret.h = layout->row.height; return ret; } NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); win = ctx->current; layout = win->layout; ret.x += layout->at_x - (float)*layout->offset_x; ret.y += layout->at_y - (float)*layout->offset_y; return ret; } NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); win = ctx->current; layout = win->layout; ret.x += -layout->at_x + (float)*layout->offset_x; ret.y += -layout->at_y + (float)*layout->offset_y; return ret; } NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); win = ctx->current; layout = win->layout; ret.x += layout->at_x - (float)*layout->offset_x; ret.y += layout->at_y - (float)*layout->offset_y; return ret; } NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context *ctx, struct nk_rect ret) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); win = ctx->current; layout = win->layout; ret.x += -layout->at_x + (float)*layout->offset_x; ret.y += -layout->at_y + (float)*layout->offset_y; return ret; } NK_LIB void nk_panel_alloc_row(const struct nk_context *ctx, struct nk_window *win) { struct nk_panel *layout = win->layout; struct nk_vec2 spacing = ctx->style.window.spacing; const float row_height = layout->row.height - spacing.y; nk_panel_layout(ctx, win, row_height, layout->row.columns); } NK_LIB void nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, struct nk_window *win, int modify) { struct nk_panel *layout; const struct nk_style *style; struct nk_vec2 spacing; struct nk_vec2 padding; float item_offset = 0; float item_width = 0; float item_spacing = 0; float panel_space = 0; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; style = &ctx->style; NK_ASSERT(bounds); spacing = style->window.spacing; padding = nk_panel_get_padding(style, layout->type); panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type, layout->bounds.w, layout->row.columns); /* calculate the width of one item inside the current layout space */ switch (layout->row.type) { case NK_LAYOUT_DYNAMIC_FIXED: { /* scaling fixed size widgets item width */ item_width = NK_MAX(1.0f,panel_space) / (float)layout->row.columns; item_offset = (float)layout->row.index * item_width; item_spacing = (float)layout->row.index * spacing.x; } break; case NK_LAYOUT_DYNAMIC_ROW: { /* scaling single ratio widget width */ item_width = layout->row.item_width * panel_space; item_offset = layout->row.item_offset; item_spacing = 0; if (modify) { layout->row.item_offset += item_width + spacing.x; layout->row.filled += layout->row.item_width; layout->row.index = 0; } } break; case NK_LAYOUT_DYNAMIC_FREE: { /* panel width depended free widget placing */ bounds->x = layout->at_x + (layout->bounds.w * layout->row.item.x); bounds->x -= (float)*layout->offset_x; bounds->y = layout->at_y + (layout->row.height * layout->row.item.y); bounds->y -= (float)*layout->offset_y; bounds->w = layout->bounds.w * layout->row.item.w; bounds->h = layout->row.height * layout->row.item.h; return; } case NK_LAYOUT_DYNAMIC: { /* scaling arrays of panel width ratios for every widget */ float ratio; NK_ASSERT(layout->row.ratio); ratio = (layout->row.ratio[layout->row.index] < 0) ? layout->row.item_width : layout->row.ratio[layout->row.index]; item_spacing = (float)layout->row.index * spacing.x; item_width = (ratio * panel_space); item_offset = layout->row.item_offset; if (modify) { layout->row.item_offset += item_width; layout->row.filled += ratio; } } break; case NK_LAYOUT_STATIC_FIXED: { /* non-scaling fixed widgets item width */ item_width = layout->row.item_width; item_offset = (float)layout->row.index * item_width; item_spacing = (float)layout->row.index * spacing.x; } break; case NK_LAYOUT_STATIC_ROW: { /* scaling single ratio widget width */ item_width = layout->row.item_width; item_offset = layout->row.item_offset; item_spacing = (float)layout->row.index * spacing.x; if (modify) layout->row.item_offset += item_width; } break; case NK_LAYOUT_STATIC_FREE: { /* free widget placing */ bounds->x = layout->at_x + layout->row.item.x; bounds->w = layout->row.item.w; if (((bounds->x + bounds->w) > layout->max_x) && modify) layout->max_x = (bounds->x + bounds->w); bounds->x -= (float)*layout->offset_x; bounds->y = layout->at_y + layout->row.item.y; bounds->y -= (float)*layout->offset_y; bounds->h = layout->row.item.h; return; } case NK_LAYOUT_STATIC: { /* non-scaling array of panel pixel width for every widget */ item_spacing = (float)layout->row.index * spacing.x; item_width = layout->row.ratio[layout->row.index]; item_offset = layout->row.item_offset; if (modify) layout->row.item_offset += item_width; } break; case NK_LAYOUT_TEMPLATE: { /* stretchy row layout with combined dynamic/static widget width*/ NK_ASSERT(layout->row.index < layout->row.columns); NK_ASSERT(layout->row.index < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS); item_width = layout->row.templates[layout->row.index]; item_offset = layout->row.item_offset; item_spacing = (float)layout->row.index * spacing.x; if (modify) layout->row.item_offset += item_width; } break; default: NK_ASSERT(0); break; }; /* set the bounds of the newly allocated widget */ bounds->w = item_width; bounds->h = layout->row.height - spacing.y; bounds->y = layout->at_y - (float)*layout->offset_y; bounds->x = layout->at_x + item_offset + item_spacing + padding.x; if (((bounds->x + bounds->w) > layout->max_x) && modify) layout->max_x = bounds->x + bounds->w; bounds->x -= (float)*layout->offset_x; } NK_LIB void nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx) { struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; /* check if the end of the row has been hit and begin new row if so */ win = ctx->current; layout = win->layout; if (layout->row.index >= layout->row.columns) nk_panel_alloc_row(ctx, win); /* calculate widget position and size */ nk_layout_widget_space(bounds, ctx, win, nk_true); layout->row.index++; } NK_LIB void nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx) { float y; int index; struct nk_window *win; struct nk_panel *layout; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; y = layout->at_y; index = layout->row.index; if (layout->row.index >= layout->row.columns) { layout->at_y += layout->row.height; layout->row.index = 0; } nk_layout_widget_space(bounds, ctx, win, nk_false); if (!layout->row.index) { bounds->x -= layout->row.item_offset; } layout->at_y = y; layout->row.index = index; } /* =============================================================== * * TREE * * ===============================================================*/ NK_INTERN int nk_tree_state_base(struct nk_context *ctx, enum nk_tree_type type, struct nk_image *img, const char *title, enum nk_collapse_states *state) { struct nk_window *win; struct nk_panel *layout; const struct nk_style *style; struct nk_command_buffer *out; const struct nk_input *in; const struct nk_style_button *button; enum nk_symbol_type symbol; float row_height; struct nk_vec2 item_spacing; struct nk_rect header = {0,0,0,0}; struct nk_rect sym = {0,0,0,0}; struct nk_text text; nk_flags ws = 0; enum nk_widget_layout_states widget_state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; /* cache some data */ win = ctx->current; layout = win->layout; out = &win->buffer; style = &ctx->style; item_spacing = style->window.spacing; /* calculate header bounds and draw background */ row_height = style->font->height + 2 * style->tab.padding.y; nk_layout_set_min_row_height(ctx, row_height); nk_layout_row_dynamic(ctx, row_height, 1); nk_layout_reset_min_row_height(ctx); widget_state = nk_widget(&header, ctx); if (type == NK_TREE_TAB) { const struct nk_style_item *background = &style->tab.background; if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(out, header, &background->data.image, nk_white); text.background = nk_rgba(0,0,0,0); } else { text.background = background->data.color; nk_fill_rect(out, header, 0, style->tab.border_color); nk_fill_rect(out, nk_shrink_rect(header, style->tab.border), style->tab.rounding, background->data.color); } } else text.background = style->window.background; /* update node state */ in = (!(layout->flags & NK_WINDOW_ROM)) ? &ctx->input: 0; in = (in && widget_state == NK_WIDGET_VALID) ? &ctx->input : 0; if (nk_button_behavior(&ws, header, in, NK_BUTTON_DEFAULT)) *state = (*state == NK_MAXIMIZED) ? NK_MINIMIZED : NK_MAXIMIZED; /* select correct button style */ if (*state == NK_MAXIMIZED) { symbol = style->tab.sym_maximize; if (type == NK_TREE_TAB) button = &style->tab.tab_maximize_button; else button = &style->tab.node_maximize_button; } else { symbol = style->tab.sym_minimize; if (type == NK_TREE_TAB) button = &style->tab.tab_minimize_button; else button = &style->tab.node_minimize_button; } {/* draw triangle button */ sym.w = sym.h = style->font->height; sym.y = header.y + style->tab.padding.y; sym.x = header.x + style->tab.padding.x; nk_do_button_symbol(&ws, &win->buffer, sym, symbol, NK_BUTTON_DEFAULT, button, 0, style->font); if (img) { /* draw optional image icon */ sym.x = sym.x + sym.w + 4 * item_spacing.x; nk_draw_image(&win->buffer, sym, img, nk_white); sym.w = style->font->height + style->tab.spacing.x;} } {/* draw label */ struct nk_rect label; header.w = NK_MAX(header.w, sym.w + item_spacing.x); label.x = sym.x + sym.w + item_spacing.x; label.y = sym.y; label.w = header.w - (sym.w + item_spacing.y + style->tab.indent); label.h = style->font->height; text.text = style->tab.text; text.padding = nk_vec2(0,0); nk_widget_text(out, label, title, nk_strlen(title), &text, NK_TEXT_LEFT, style->font);} /* increase x-axis cursor widget position pointer */ if (*state == NK_MAXIMIZED) { layout->at_x = header.x + (float)*layout->offset_x + style->tab.indent; layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent); layout->bounds.w -= (style->tab.indent + style->window.padding.x); layout->row.tree_depth++; return nk_true; } else return nk_false; } NK_INTERN int nk_tree_base(struct nk_context *ctx, enum nk_tree_type type, struct nk_image *img, const char *title, enum nk_collapse_states initial_state, const char *hash, int len, int line) { struct nk_window *win = ctx->current; int title_len = 0; nk_hash tree_hash = 0; nk_uint *state = 0; /* retrieve tree state from internal widget state tables */ if (!hash) { title_len = (int)nk_strlen(title); tree_hash = nk_murmur_hash(title, (int)title_len, (nk_hash)line); } else tree_hash = nk_murmur_hash(hash, len, (nk_hash)line); state = nk_find_value(win, tree_hash); if (!state) { state = nk_add_value(ctx, win, tree_hash, 0); *state = initial_state; } return nk_tree_state_base(ctx, type, img, title, (enum nk_collapse_states*)state); } NK_API int nk_tree_state_push(struct nk_context *ctx, enum nk_tree_type type, const char *title, enum nk_collapse_states *state) { return nk_tree_state_base(ctx, type, 0, title, state); } NK_API int nk_tree_state_image_push(struct nk_context *ctx, enum nk_tree_type type, struct nk_image img, const char *title, enum nk_collapse_states *state) { return nk_tree_state_base(ctx, type, &img, title, state); } NK_API void nk_tree_state_pop(struct nk_context *ctx) { struct nk_window *win = 0; struct nk_panel *layout = 0; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; layout->at_x -= ctx->style.tab.indent + ctx->style.window.padding.x; layout->bounds.w += ctx->style.tab.indent + ctx->style.window.padding.x; NK_ASSERT(layout->row.tree_depth); layout->row.tree_depth--; } NK_API int nk_tree_push_hashed(struct nk_context *ctx, enum nk_tree_type type, const char *title, enum nk_collapse_states initial_state, const char *hash, int len, int line) { return nk_tree_base(ctx, type, 0, title, initial_state, hash, len, line); } NK_API int nk_tree_image_push_hashed(struct nk_context *ctx, enum nk_tree_type type, struct nk_image img, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed) { return nk_tree_base(ctx, type, &img, title, initial_state, hash, len, seed); } NK_API void nk_tree_pop(struct nk_context *ctx) { nk_tree_state_pop(ctx); } NK_INTERN int nk_tree_element_image_push_hashed_base(struct nk_context *ctx, enum nk_tree_type type, struct nk_image *img, const char *title, int title_len, enum nk_collapse_states *state, int *selected) { struct nk_window *win; struct nk_panel *layout; const struct nk_style *style; struct nk_command_buffer *out; const struct nk_input *in; const struct nk_style_button *button; enum nk_symbol_type symbol; float row_height; struct nk_vec2 padding; int text_len; float text_width; struct nk_vec2 item_spacing; struct nk_rect header = {0,0,0,0}; struct nk_rect sym = {0,0,0,0}; struct nk_text text; nk_flags ws = 0; enum nk_widget_layout_states widget_state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; /* cache some data */ win = ctx->current; layout = win->layout; out = &win->buffer; style = &ctx->style; item_spacing = style->window.spacing; padding = style->selectable.padding; /* calculate header bounds and draw background */ row_height = style->font->height + 2 * style->tab.padding.y; nk_layout_set_min_row_height(ctx, row_height); nk_layout_row_dynamic(ctx, row_height, 1); nk_layout_reset_min_row_height(ctx); widget_state = nk_widget(&header, ctx); if (type == NK_TREE_TAB) { const struct nk_style_item *background = &style->tab.background; if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(out, header, &background->data.image, nk_white); text.background = nk_rgba(0,0,0,0); } else { text.background = background->data.color; nk_fill_rect(out, header, 0, style->tab.border_color); nk_fill_rect(out, nk_shrink_rect(header, style->tab.border), style->tab.rounding, background->data.color); } } else text.background = style->window.background; in = (!(layout->flags & NK_WINDOW_ROM)) ? &ctx->input: 0; in = (in && widget_state == NK_WIDGET_VALID) ? &ctx->input : 0; /* select correct button style */ if (*state == NK_MAXIMIZED) { symbol = style->tab.sym_maximize; if (type == NK_TREE_TAB) button = &style->tab.tab_maximize_button; else button = &style->tab.node_maximize_button; } else { symbol = style->tab.sym_minimize; if (type == NK_TREE_TAB) button = &style->tab.tab_minimize_button; else button = &style->tab.node_minimize_button; } {/* draw triangle button */ sym.w = sym.h = style->font->height; sym.y = header.y + style->tab.padding.y; sym.x = header.x + style->tab.padding.x; if (nk_do_button_symbol(&ws, &win->buffer, sym, symbol, NK_BUTTON_DEFAULT, button, in, style->font)) *state = (*state == NK_MAXIMIZED) ? NK_MINIMIZED : NK_MAXIMIZED;} /* draw label */ {nk_flags dummy = 0; struct nk_rect label; /* calculate size of the text and tooltip */ text_len = nk_strlen(title); text_width = style->font->width(style->font->userdata, style->font->height, title, text_len); text_width += (4 * padding.x); header.w = NK_MAX(header.w, sym.w + item_spacing.x); label.x = sym.x + sym.w + item_spacing.x; label.y = sym.y; label.w = NK_MIN(header.w - (sym.w + item_spacing.y + style->tab.indent), text_width); label.h = style->font->height; if (img) { nk_do_selectable_image(&dummy, &win->buffer, label, title, title_len, NK_TEXT_LEFT, selected, img, &style->selectable, in, style->font); } else nk_do_selectable(&dummy, &win->buffer, label, title, title_len, NK_TEXT_LEFT, selected, &style->selectable, in, style->font); } /* increase x-axis cursor widget position pointer */ if (*state == NK_MAXIMIZED) { layout->at_x = header.x + (float)*layout->offset_x + style->tab.indent; layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent); layout->bounds.w -= (style->tab.indent + style->window.padding.x); layout->row.tree_depth++; return nk_true; } else return nk_false; } NK_INTERN int nk_tree_element_base(struct nk_context *ctx, enum nk_tree_type type, struct nk_image *img, const char *title, enum nk_collapse_states initial_state, int *selected, const char *hash, int len, int line) { struct nk_window *win = ctx->current; int title_len = 0; nk_hash tree_hash = 0; nk_uint *state = 0; /* retrieve tree state from internal widget state tables */ if (!hash) { title_len = (int)nk_strlen(title); tree_hash = nk_murmur_hash(title, (int)title_len, (nk_hash)line); } else tree_hash = nk_murmur_hash(hash, len, (nk_hash)line); state = nk_find_value(win, tree_hash); if (!state) { state = nk_add_value(ctx, win, tree_hash, 0); *state = initial_state; } return nk_tree_element_image_push_hashed_base(ctx, type, img, title, nk_strlen(title), (enum nk_collapse_states*)state, selected); } NK_API int nk_tree_element_push_hashed(struct nk_context *ctx, enum nk_tree_type type, const char *title, enum nk_collapse_states initial_state, int *selected, const char *hash, int len, int seed) { return nk_tree_element_base(ctx, type, 0, title, initial_state, selected, hash, len, seed); } NK_API int nk_tree_element_image_push_hashed(struct nk_context *ctx, enum nk_tree_type type, struct nk_image img, const char *title, enum nk_collapse_states initial_state, int *selected, const char *hash, int len,int seed) { return nk_tree_element_base(ctx, type, &img, title, initial_state, selected, hash, len, seed); } NK_API void nk_tree_element_pop(struct nk_context *ctx) { nk_tree_state_pop(ctx); } /* =============================================================== * * GROUP * * ===============================================================*/ NK_API int nk_group_scrolled_offset_begin(struct nk_context *ctx, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags) { struct nk_rect bounds; struct nk_window panel; struct nk_window *win; win = ctx->current; nk_panel_alloc_space(&bounds, ctx); {const struct nk_rect *c = &win->layout->clip; if (!NK_INTERSECT(c->x, c->y, c->w, c->h, bounds.x, bounds.y, bounds.w, bounds.h) && !(flags & NK_WINDOW_MOVABLE)) { return 0; }} if (win->flags & NK_WINDOW_ROM) flags |= NK_WINDOW_ROM; /* initialize a fake window to create the panel from */ nk_zero(&panel, sizeof(panel)); panel.bounds = bounds; panel.flags = flags; panel.scrollbar.x = *x_offset; panel.scrollbar.y = *y_offset; panel.buffer = win->buffer; panel.layout = (struct nk_panel*)nk_create_panel(ctx); ctx->current = &panel; nk_panel_begin(ctx, (flags & NK_WINDOW_TITLE) ? title: 0, NK_PANEL_GROUP); win->buffer = panel.buffer; win->buffer.clip = panel.layout->clip; panel.layout->offset_x = x_offset; panel.layout->offset_y = y_offset; panel.layout->parent = win->layout; win->layout = panel.layout; ctx->current = win; if ((panel.layout->flags & NK_WINDOW_CLOSED) || (panel.layout->flags & NK_WINDOW_MINIMIZED)) { nk_flags f = panel.layout->flags; nk_group_scrolled_end(ctx); if (f & NK_WINDOW_CLOSED) return NK_WINDOW_CLOSED; if (f & NK_WINDOW_MINIMIZED) return NK_WINDOW_MINIMIZED; } return 1; } NK_API void nk_group_scrolled_end(struct nk_context *ctx) { struct nk_window *win; struct nk_panel *parent; struct nk_panel *g; struct nk_rect clip; struct nk_window pan; struct nk_vec2 panel_padding; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return; /* make sure nk_group_begin was called correctly */ NK_ASSERT(ctx->current); win = ctx->current; NK_ASSERT(win->layout); g = win->layout; NK_ASSERT(g->parent); parent = g->parent; /* dummy window */ nk_zero_struct(pan); panel_padding = nk_panel_get_padding(&ctx->style, NK_PANEL_GROUP); pan.bounds.y = g->bounds.y - (g->header_height + g->menu.h); pan.bounds.x = g->bounds.x - panel_padding.x; pan.bounds.w = g->bounds.w + 2 * panel_padding.x; pan.bounds.h = g->bounds.h + g->header_height + g->menu.h; if (g->flags & NK_WINDOW_BORDER) { pan.bounds.x -= g->border; pan.bounds.y -= g->border; pan.bounds.w += 2*g->border; pan.bounds.h += 2*g->border; } if (!(g->flags & NK_WINDOW_NO_SCROLLBAR)) { pan.bounds.w += ctx->style.window.scrollbar_size.x; pan.bounds.h += ctx->style.window.scrollbar_size.y; } pan.scrollbar.x = *g->offset_x; pan.scrollbar.y = *g->offset_y; pan.flags = g->flags; pan.buffer = win->buffer; pan.layout = g; pan.parent = win; ctx->current = &pan; /* make sure group has correct clipping rectangle */ nk_unify(&clip, &parent->clip, pan.bounds.x, pan.bounds.y, pan.bounds.x + pan.bounds.w, pan.bounds.y + pan.bounds.h + panel_padding.x); nk_push_scissor(&pan.buffer, clip); nk_end(ctx); win->buffer = pan.buffer; nk_push_scissor(&win->buffer, parent->clip); ctx->current = win; win->layout = parent; g->bounds = pan.bounds; return; } NK_API int nk_group_scrolled_begin(struct nk_context *ctx, struct nk_scroll *scroll, const char *title, nk_flags flags) { return nk_group_scrolled_offset_begin(ctx, &scroll->x, &scroll->y, title, flags); } NK_API int nk_group_begin_titled(struct nk_context *ctx, const char *id, const char *title, nk_flags flags) { int id_len; nk_hash id_hash; struct nk_window *win; nk_uint *x_offset; nk_uint *y_offset; NK_ASSERT(ctx); NK_ASSERT(id); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !id) return 0; /* find persistent group scrollbar value */ win = ctx->current; id_len = (int)nk_strlen(id); id_hash = nk_murmur_hash(id, (int)id_len, NK_PANEL_GROUP); x_offset = nk_find_value(win, id_hash); if (!x_offset) { x_offset = nk_add_value(ctx, win, id_hash, 0); y_offset = nk_add_value(ctx, win, id_hash+1, 0); NK_ASSERT(x_offset); NK_ASSERT(y_offset); if (!x_offset || !y_offset) return 0; *x_offset = *y_offset = 0; } else y_offset = nk_find_value(win, id_hash+1); return nk_group_scrolled_offset_begin(ctx, x_offset, y_offset, title, flags); } NK_API int nk_group_begin(struct nk_context *ctx, const char *title, nk_flags flags) { return nk_group_begin_titled(ctx, title, title, flags); } NK_API void nk_group_end(struct nk_context *ctx) { nk_group_scrolled_end(ctx); } /* =============================================================== * * LIST VIEW * * ===============================================================*/ NK_API int nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view, const char *title, nk_flags flags, int row_height, int row_count) { int title_len; nk_hash title_hash; nk_uint *x_offset; nk_uint *y_offset; int result; struct nk_window *win; struct nk_panel *layout; const struct nk_style *style; struct nk_vec2 item_spacing; NK_ASSERT(ctx); NK_ASSERT(view); NK_ASSERT(title); if (!ctx || !view || !title) return 0; win = ctx->current; style = &ctx->style; item_spacing = style->window.spacing; row_height += NK_MAX(0, (int)item_spacing.y); /* find persistent list view scrollbar offset */ title_len = (int)nk_strlen(title); title_hash = nk_murmur_hash(title, (int)title_len, NK_PANEL_GROUP); x_offset = nk_find_value(win, title_hash); if (!x_offset) { x_offset = nk_add_value(ctx, win, title_hash, 0); y_offset = nk_add_value(ctx, win, title_hash+1, 0); NK_ASSERT(x_offset); NK_ASSERT(y_offset); if (!x_offset || !y_offset) return 0; *x_offset = *y_offset = 0; } else y_offset = nk_find_value(win, title_hash+1); view->scroll_value = *y_offset; view->scroll_pointer = y_offset; *y_offset = 0; result = nk_group_scrolled_offset_begin(ctx, x_offset, y_offset, title, flags); win = ctx->current; layout = win->layout; view->total_height = row_height * NK_MAX(row_count,1); view->begin = (int)NK_MAX(((float)view->scroll_value / (float)row_height), 0.0f); view->count = (int)NK_MAX(nk_iceilf((layout->clip.h)/(float)row_height),0); view->count = NK_MIN(view->count, row_count - view->begin); view->end = view->begin + view->count; view->ctx = ctx; return result; } NK_API void nk_list_view_end(struct nk_list_view *view) { struct nk_context *ctx; struct nk_window *win; struct nk_panel *layout; NK_ASSERT(view); NK_ASSERT(view->ctx); NK_ASSERT(view->scroll_pointer); if (!view || !view->ctx) return; ctx = view->ctx; win = ctx->current; layout = win->layout; layout->at_y = layout->bounds.y + (float)view->total_height; *view->scroll_pointer = *view->scroll_pointer + view->scroll_value; nk_group_end(view->ctx); } /* =============================================================== * * WIDGET * * ===============================================================*/ NK_API struct nk_rect nk_widget_bounds(struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_rect(0,0,0,0); nk_layout_peek(&bounds, ctx); return bounds; } NK_API struct nk_vec2 nk_widget_position(struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_vec2(0,0); nk_layout_peek(&bounds, ctx); return nk_vec2(bounds.x, bounds.y); } NK_API struct nk_vec2 nk_widget_size(struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return nk_vec2(0,0); nk_layout_peek(&bounds, ctx); return nk_vec2(bounds.w, bounds.h); } NK_API float nk_widget_width(struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return 0; nk_layout_peek(&bounds, ctx); return bounds.w; } NK_API float nk_widget_height(struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return 0; nk_layout_peek(&bounds, ctx); return bounds.h; } NK_API int nk_widget_is_hovered(struct nk_context *ctx) { struct nk_rect c, v; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current || ctx->active != ctx->current) return 0; c = ctx->current->layout->clip; c.x = (float)((int)c.x); c.y = (float)((int)c.y); c.w = (float)((int)c.w); c.h = (float)((int)c.h); nk_layout_peek(&bounds, ctx); nk_unify(&v, &c, bounds.x, bounds.y, bounds.x + bounds.w, bounds.y + bounds.h); if (!NK_INTERSECT(c.x, c.y, c.w, c.h, bounds.x, bounds.y, bounds.w, bounds.h)) return 0; return nk_input_is_mouse_hovering_rect(&ctx->input, bounds); } NK_API int nk_widget_is_mouse_clicked(struct nk_context *ctx, enum nk_buttons btn) { struct nk_rect c, v; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current || ctx->active != ctx->current) return 0; c = ctx->current->layout->clip; c.x = (float)((int)c.x); c.y = (float)((int)c.y); c.w = (float)((int)c.w); c.h = (float)((int)c.h); nk_layout_peek(&bounds, ctx); nk_unify(&v, &c, bounds.x, bounds.y, bounds.x + bounds.w, bounds.y + bounds.h); if (!NK_INTERSECT(c.x, c.y, c.w, c.h, bounds.x, bounds.y, bounds.w, bounds.h)) return 0; return nk_input_mouse_clicked(&ctx->input, btn, bounds); } NK_API int nk_widget_has_mouse_click_down(struct nk_context *ctx, enum nk_buttons btn, int down) { struct nk_rect c, v; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current || ctx->active != ctx->current) return 0; c = ctx->current->layout->clip; c.x = (float)((int)c.x); c.y = (float)((int)c.y); c.w = (float)((int)c.w); c.h = (float)((int)c.h); nk_layout_peek(&bounds, ctx); nk_unify(&v, &c, bounds.x, bounds.y, bounds.x + bounds.w, bounds.y + bounds.h); if (!NK_INTERSECT(c.x, c.y, c.w, c.h, bounds.x, bounds.y, bounds.w, bounds.h)) return 0; return nk_input_has_mouse_click_down_in_rect(&ctx->input, btn, bounds, down); } NK_API enum nk_widget_layout_states nk_widget(struct nk_rect *bounds, const struct nk_context *ctx) { struct nk_rect c, v; struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return NK_WIDGET_INVALID; /* allocate space and check if the widget needs to be updated and drawn */ nk_panel_alloc_space(bounds, ctx); win = ctx->current; layout = win->layout; in = &ctx->input; c = layout->clip; /* if one of these triggers you forgot to add an `if` condition around either a window, group, popup, combobox or contextual menu `begin` and `end` block. Example: if (nk_begin(...) {...} nk_end(...); or if (nk_group_begin(...) { nk_group_end(...);} */ NK_ASSERT(!(layout->flags & NK_WINDOW_MINIMIZED)); NK_ASSERT(!(layout->flags & NK_WINDOW_HIDDEN)); NK_ASSERT(!(layout->flags & NK_WINDOW_CLOSED)); /* need to convert to int here to remove floating point errors */ bounds->x = (float)((int)bounds->x); bounds->y = (float)((int)bounds->y); bounds->w = (float)((int)bounds->w); bounds->h = (float)((int)bounds->h); c.x = (float)((int)c.x); c.y = (float)((int)c.y); c.w = (float)((int)c.w); c.h = (float)((int)c.h); nk_unify(&v, &c, bounds->x, bounds->y, bounds->x + bounds->w, bounds->y + bounds->h); if (!NK_INTERSECT(c.x, c.y, c.w, c.h, bounds->x, bounds->y, bounds->w, bounds->h)) return NK_WIDGET_INVALID; if (!NK_INBOX(in->mouse.pos.x, in->mouse.pos.y, v.x, v.y, v.w, v.h)) return NK_WIDGET_ROM; return NK_WIDGET_VALID; } NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect *bounds, struct nk_context *ctx, struct nk_vec2 item_padding) { /* update the bounds to stand without padding */ struct nk_window *win; struct nk_style *style; struct nk_panel *layout; enum nk_widget_layout_states state; struct nk_vec2 panel_padding; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return NK_WIDGET_INVALID; win = ctx->current; style = &ctx->style; layout = win->layout; state = nk_widget(bounds, ctx); panel_padding = nk_panel_get_padding(style, layout->type); if (layout->row.index == 1) { bounds->w += panel_padding.x; bounds->x -= panel_padding.x; } else bounds->x -= item_padding.x; if (layout->row.index == layout->row.columns) bounds->w += panel_padding.x; else bounds->w += item_padding.x; return state; } NK_API void nk_spacing(struct nk_context *ctx, int cols) { struct nk_window *win; struct nk_panel *layout; struct nk_rect none; int i, index, rows; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; /* spacing over row boundaries */ win = ctx->current; layout = win->layout; index = (layout->row.index + cols) % layout->row.columns; rows = (layout->row.index + cols) / layout->row.columns; if (rows) { for (i = 0; i < rows; ++i) nk_panel_alloc_row(ctx, win); cols = index; } /* non table layout need to allocate space */ if (layout->row.type != NK_LAYOUT_DYNAMIC_FIXED && layout->row.type != NK_LAYOUT_STATIC_FIXED) { for (i = 0; i < cols; ++i) nk_panel_alloc_space(&none, ctx); } layout->row.index = index; } /* =============================================================== * * TEXT * * ===============================================================*/ NK_LIB void nk_widget_text(struct nk_command_buffer *o, struct nk_rect b, const char *string, int len, const struct nk_text *t, nk_flags a, const struct nk_user_font *f) { struct nk_rect label; float text_width; NK_ASSERT(o); NK_ASSERT(t); if (!o || !t) return; b.h = NK_MAX(b.h, 2 * t->padding.y); label.x = 0; label.w = 0; label.y = b.y + t->padding.y; label.h = NK_MIN(f->height, b.h - 2 * t->padding.y); text_width = f->width(f->userdata, f->height, (const char*)string, len); text_width += (2.0f * t->padding.x); /* align in x-axis */ if (a & NK_TEXT_ALIGN_LEFT) { label.x = b.x + t->padding.x; label.w = NK_MAX(0, b.w - 2 * t->padding.x); } else if (a & NK_TEXT_ALIGN_CENTERED) { label.w = NK_MAX(1, 2 * t->padding.x + (float)text_width); label.x = (b.x + t->padding.x + ((b.w - 2 * t->padding.x) - label.w) / 2); label.x = NK_MAX(b.x + t->padding.x, label.x); label.w = NK_MIN(b.x + b.w, label.x + label.w); if (label.w >= label.x) label.w -= label.x; } else if (a & NK_TEXT_ALIGN_RIGHT) { label.x = NK_MAX(b.x + t->padding.x, (b.x + b.w) - (2 * t->padding.x + (float)text_width)); label.w = (float)text_width + 2 * t->padding.x; } else return; /* align in y-axis */ if (a & NK_TEXT_ALIGN_MIDDLE) { label.y = b.y + b.h/2.0f - (float)f->height/2.0f; label.h = NK_MAX(b.h/2.0f, b.h - (b.h/2.0f + f->height/2.0f)); } else if (a & NK_TEXT_ALIGN_BOTTOM) { label.y = b.y + b.h - f->height; label.h = f->height; } nk_draw_text(o, label, (const char*)string, len, f, t->background, t->text); } NK_LIB void nk_widget_text_wrap(struct nk_command_buffer *o, struct nk_rect b, const char *string, int len, const struct nk_text *t, const struct nk_user_font *f) { float width; int glyphs = 0; int fitting = 0; int done = 0; struct nk_rect line; struct nk_text text; NK_INTERN nk_rune seperator[] = {' '}; NK_ASSERT(o); NK_ASSERT(t); if (!o || !t) return; text.padding = nk_vec2(0,0); text.background = t->background; text.text = t->text; b.w = NK_MAX(b.w, 2 * t->padding.x); b.h = NK_MAX(b.h, 2 * t->padding.y); b.h = b.h - 2 * t->padding.y; line.x = b.x + t->padding.x; line.y = b.y + t->padding.y; line.w = b.w - 2 * t->padding.x; line.h = 2 * t->padding.y + f->height; fitting = nk_text_clamp(f, string, len, line.w, &glyphs, &width, seperator,NK_LEN(seperator)); while (done < len) { if (!fitting || line.y + line.h >= (b.y + b.h)) break; nk_widget_text(o, line, &string[done], fitting, &text, NK_TEXT_LEFT, f); done += fitting; line.y += f->height + 2 * t->padding.y; fitting = nk_text_clamp(f, &string[done], len - done, line.w, &glyphs, &width, seperator,NK_LEN(seperator)); } } NK_API void nk_text_colored(struct nk_context *ctx, const char *str, int len, nk_flags alignment, struct nk_color color) { struct nk_window *win; const struct nk_style *style; struct nk_vec2 item_padding; struct nk_rect bounds; struct nk_text text; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; style = &ctx->style; nk_panel_alloc_space(&bounds, ctx); item_padding = style->text.padding; text.padding.x = item_padding.x; text.padding.y = item_padding.y; text.background = style->window.background; text.text = color; nk_widget_text(&win->buffer, bounds, str, len, &text, alignment, style->font); } NK_API void nk_text_wrap_colored(struct nk_context *ctx, const char *str, int len, struct nk_color color) { struct nk_window *win; const struct nk_style *style; struct nk_vec2 item_padding; struct nk_rect bounds; struct nk_text text; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; style = &ctx->style; nk_panel_alloc_space(&bounds, ctx); item_padding = style->text.padding; text.padding.x = item_padding.x; text.padding.y = item_padding.y; text.background = style->window.background; text.text = color; nk_widget_text_wrap(&win->buffer, bounds, str, len, &text, style->font); } #ifdef NK_INCLUDE_STANDARD_VARARGS NK_API void nk_labelf_colored(struct nk_context *ctx, nk_flags flags, struct nk_color color, const char *fmt, ...) { va_list args; va_start(args, fmt); nk_labelfv_colored(ctx, flags, color, fmt, args); va_end(args); } NK_API void nk_labelf_colored_wrap(struct nk_context *ctx, struct nk_color color, const char *fmt, ...) { va_list args; va_start(args, fmt); nk_labelfv_colored_wrap(ctx, color, fmt, args); va_end(args); } NK_API void nk_labelf(struct nk_context *ctx, nk_flags flags, const char *fmt, ...) { va_list args; va_start(args, fmt); nk_labelfv(ctx, flags, fmt, args); va_end(args); } NK_API void nk_labelf_wrap(struct nk_context *ctx, const char *fmt,...) { va_list args; va_start(args, fmt); nk_labelfv_wrap(ctx, fmt, args); va_end(args); } NK_API void nk_labelfv_colored(struct nk_context *ctx, nk_flags flags, struct nk_color color, const char *fmt, va_list args) { char buf[256]; nk_strfmt(buf, NK_LEN(buf), fmt, args); nk_label_colored(ctx, buf, flags, color); } NK_API void nk_labelfv_colored_wrap(struct nk_context *ctx, struct nk_color color, const char *fmt, va_list args) { char buf[256]; nk_strfmt(buf, NK_LEN(buf), fmt, args); nk_label_colored_wrap(ctx, buf, color); } NK_API void nk_labelfv(struct nk_context *ctx, nk_flags flags, const char *fmt, va_list args) { char buf[256]; nk_strfmt(buf, NK_LEN(buf), fmt, args); nk_label(ctx, buf, flags); } NK_API void nk_labelfv_wrap(struct nk_context *ctx, const char *fmt, va_list args) { char buf[256]; nk_strfmt(buf, NK_LEN(buf), fmt, args); nk_label_wrap(ctx, buf); } NK_API void nk_value_bool(struct nk_context *ctx, const char *prefix, int value) { nk_labelf(ctx, NK_TEXT_LEFT, "%s: %s", prefix, ((value) ? "true": "false")); } NK_API void nk_value_int(struct nk_context *ctx, const char *prefix, int value) { nk_labelf(ctx, NK_TEXT_LEFT, "%s: %d", prefix, value); } NK_API void nk_value_uint(struct nk_context *ctx, const char *prefix, unsigned int value) { nk_labelf(ctx, NK_TEXT_LEFT, "%s: %u", prefix, value); } NK_API void nk_value_float(struct nk_context *ctx, const char *prefix, float value) { double double_value = (double)value; nk_labelf(ctx, NK_TEXT_LEFT, "%s: %.3f", prefix, double_value); } NK_API void nk_value_color_byte(struct nk_context *ctx, const char *p, struct nk_color c) { nk_labelf(ctx, NK_TEXT_LEFT, "%s: (%d, %d, %d, %d)", p, c.r, c.g, c.b, c.a); } NK_API void nk_value_color_float(struct nk_context *ctx, const char *p, struct nk_color color) { double c[4]; nk_color_dv(c, color); nk_labelf(ctx, NK_TEXT_LEFT, "%s: (%.2f, %.2f, %.2f, %.2f)", p, c[0], c[1], c[2], c[3]); } NK_API void nk_value_color_hex(struct nk_context *ctx, const char *prefix, struct nk_color color) { char hex[16]; nk_color_hex_rgba(hex, color); nk_labelf(ctx, NK_TEXT_LEFT, "%s: %s", prefix, hex); } #endif NK_API void nk_text(struct nk_context *ctx, const char *str, int len, nk_flags alignment) { NK_ASSERT(ctx); if (!ctx) return; nk_text_colored(ctx, str, len, alignment, ctx->style.text.color); } NK_API void nk_text_wrap(struct nk_context *ctx, const char *str, int len) { NK_ASSERT(ctx); if (!ctx) return; nk_text_wrap_colored(ctx, str, len, ctx->style.text.color); } NK_API void nk_label(struct nk_context *ctx, const char *str, nk_flags alignment) { nk_text(ctx, str, nk_strlen(str), alignment); } NK_API void nk_label_colored(struct nk_context *ctx, const char *str, nk_flags align, struct nk_color color) { nk_text_colored(ctx, str, nk_strlen(str), align, color); } NK_API void nk_label_wrap(struct nk_context *ctx, const char *str) { nk_text_wrap(ctx, str, nk_strlen(str)); } NK_API void nk_label_colored_wrap(struct nk_context *ctx, const char *str, struct nk_color color) { nk_text_wrap_colored(ctx, str, nk_strlen(str), color); } /* =============================================================== * * IMAGE * * ===============================================================*/ NK_API nk_handle nk_handle_ptr(void *ptr) { nk_handle handle = {0}; handle.ptr = ptr; return handle; } NK_API nk_handle nk_handle_id(int id) { nk_handle handle; nk_zero_struct(handle); handle.id = id; return handle; } NK_API struct nk_image nk_subimage_ptr(void *ptr, unsigned short w, unsigned short h, struct nk_rect r) { struct nk_image s; nk_zero(&s, sizeof(s)); s.handle.ptr = ptr; s.w = w; s.h = h; s.region[0] = (unsigned short)r.x; s.region[1] = (unsigned short)r.y; s.region[2] = (unsigned short)r.w; s.region[3] = (unsigned short)r.h; return s; } NK_API struct nk_image nk_subimage_id(int id, unsigned short w, unsigned short h, struct nk_rect r) { struct nk_image s; nk_zero(&s, sizeof(s)); s.handle.id = id; s.w = w; s.h = h; s.region[0] = (unsigned short)r.x; s.region[1] = (unsigned short)r.y; s.region[2] = (unsigned short)r.w; s.region[3] = (unsigned short)r.h; return s; } NK_API struct nk_image nk_subimage_handle(nk_handle handle, unsigned short w, unsigned short h, struct nk_rect r) { struct nk_image s; nk_zero(&s, sizeof(s)); s.handle = handle; s.w = w; s.h = h; s.region[0] = (unsigned short)r.x; s.region[1] = (unsigned short)r.y; s.region[2] = (unsigned short)r.w; s.region[3] = (unsigned short)r.h; return s; } NK_API struct nk_image nk_image_handle(nk_handle handle) { struct nk_image s; nk_zero(&s, sizeof(s)); s.handle = handle; s.w = 0; s.h = 0; s.region[0] = 0; s.region[1] = 0; s.region[2] = 0; s.region[3] = 0; return s; } NK_API struct nk_image nk_image_ptr(void *ptr) { struct nk_image s; nk_zero(&s, sizeof(s)); NK_ASSERT(ptr); s.handle.ptr = ptr; s.w = 0; s.h = 0; s.region[0] = 0; s.region[1] = 0; s.region[2] = 0; s.region[3] = 0; return s; } NK_API struct nk_image nk_image_id(int id) { struct nk_image s; nk_zero(&s, sizeof(s)); s.handle.id = id; s.w = 0; s.h = 0; s.region[0] = 0; s.region[1] = 0; s.region[2] = 0; s.region[3] = 0; return s; } NK_API int nk_image_is_subimage(const struct nk_image* img) { NK_ASSERT(img); return !(img->w == 0 && img->h == 0); } NK_API void nk_image(struct nk_context *ctx, struct nk_image img) { struct nk_window *win; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; if (!nk_widget(&bounds, ctx)) return; nk_draw_image(&win->buffer, bounds, &img, nk_white); } NK_API void nk_image_color(struct nk_context *ctx, struct nk_image img, struct nk_color col) { struct nk_window *win; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; if (!nk_widget(&bounds, ctx)) return; nk_draw_image(&win->buffer, bounds, &img, col); } /* ============================================================== * * BUTTON * * ===============================================================*/ NK_LIB void nk_draw_symbol(struct nk_command_buffer *out, enum nk_symbol_type type, struct nk_rect content, struct nk_color background, struct nk_color foreground, float border_width, const struct nk_user_font *font) { switch (type) { case NK_SYMBOL_X: case NK_SYMBOL_UNDERSCORE: case NK_SYMBOL_PLUS: case NK_SYMBOL_MINUS: { /* single character text symbol */ const char *X = (type == NK_SYMBOL_X) ? "x": (type == NK_SYMBOL_UNDERSCORE) ? "_": (type == NK_SYMBOL_PLUS) ? "+": "-"; struct nk_text text; text.padding = nk_vec2(0,0); text.background = background; text.text = foreground; nk_widget_text(out, content, X, 1, &text, NK_TEXT_CENTERED, font); } break; case NK_SYMBOL_CIRCLE_SOLID: case NK_SYMBOL_CIRCLE_OUTLINE: case NK_SYMBOL_RECT_SOLID: case NK_SYMBOL_RECT_OUTLINE: { /* simple empty/filled shapes */ if (type == NK_SYMBOL_RECT_SOLID || type == NK_SYMBOL_RECT_OUTLINE) { nk_fill_rect(out, content, 0, foreground); if (type == NK_SYMBOL_RECT_OUTLINE) nk_fill_rect(out, nk_shrink_rect(content, border_width), 0, background); } else { nk_fill_circle(out, content, foreground); if (type == NK_SYMBOL_CIRCLE_OUTLINE) nk_fill_circle(out, nk_shrink_rect(content, 1), background); } } break; case NK_SYMBOL_TRIANGLE_UP: case NK_SYMBOL_TRIANGLE_DOWN: case NK_SYMBOL_TRIANGLE_LEFT: case NK_SYMBOL_TRIANGLE_RIGHT: { enum nk_heading heading; struct nk_vec2 points[3]; heading = (type == NK_SYMBOL_TRIANGLE_RIGHT) ? NK_RIGHT : (type == NK_SYMBOL_TRIANGLE_LEFT) ? NK_LEFT: (type == NK_SYMBOL_TRIANGLE_UP) ? NK_UP: NK_DOWN; nk_triangle_from_direction(points, content, 0, 0, heading); nk_fill_triangle(out, points[0].x, points[0].y, points[1].x, points[1].y, points[2].x, points[2].y, foreground); } break; default: case NK_SYMBOL_NONE: case NK_SYMBOL_MAX: break; } } NK_LIB int nk_button_behavior(nk_flags *state, struct nk_rect r, const struct nk_input *i, enum nk_button_behavior behavior) { int ret = 0; nk_widget_state_reset(state); if (!i) return 0; if (nk_input_is_mouse_hovering_rect(i, r)) { *state = NK_WIDGET_STATE_HOVERED; if (nk_input_is_mouse_down(i, NK_BUTTON_LEFT)) *state = NK_WIDGET_STATE_ACTIVE; if (nk_input_has_mouse_click_in_rect(i, NK_BUTTON_LEFT, r)) { ret = (behavior != NK_BUTTON_DEFAULT) ? nk_input_is_mouse_down(i, NK_BUTTON_LEFT): #ifdef NK_BUTTON_TRIGGER_ON_RELEASE nk_input_is_mouse_released(i, NK_BUTTON_LEFT); #else nk_input_is_mouse_pressed(i, NK_BUTTON_LEFT); #endif } } if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(i, r)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(i, r)) *state |= NK_WIDGET_STATE_LEFT; return ret; } NK_LIB const struct nk_style_item* nk_draw_button(struct nk_command_buffer *out, const struct nk_rect *bounds, nk_flags state, const struct nk_style_button *style) { const struct nk_style_item *background; if (state & NK_WIDGET_STATE_HOVER) background = &style->hover; else if (state & NK_WIDGET_STATE_ACTIVED) background = &style->active; else background = &style->normal; if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(out, *bounds, &background->data.image, nk_white); } else { nk_fill_rect(out, *bounds, style->rounding, background->data.color); nk_stroke_rect(out, *bounds, style->rounding, style->border, style->border_color); } return background; } NK_LIB int nk_do_button(nk_flags *state, struct nk_command_buffer *out, struct nk_rect r, const struct nk_style_button *style, const struct nk_input *in, enum nk_button_behavior behavior, struct nk_rect *content) { struct nk_rect bounds; NK_ASSERT(style); NK_ASSERT(state); NK_ASSERT(out); if (!out || !style) return nk_false; /* calculate button content space */ content->x = r.x + style->padding.x + style->border + style->rounding; content->y = r.y + style->padding.y + style->border + style->rounding; content->w = r.w - (2 * style->padding.x + style->border + style->rounding*2); content->h = r.h - (2 * style->padding.y + style->border + style->rounding*2); /* execute button behavior */ bounds.x = r.x - style->touch_padding.x; bounds.y = r.y - style->touch_padding.y; bounds.w = r.w + 2 * style->touch_padding.x; bounds.h = r.h + 2 * style->touch_padding.y; return nk_button_behavior(state, bounds, in, behavior); } NK_LIB void nk_draw_button_text(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *content, nk_flags state, const struct nk_style_button *style, const char *txt, int len, nk_flags text_alignment, const struct nk_user_font *font) { struct nk_text text; const struct nk_style_item *background; background = nk_draw_button(out, bounds, state, style); /* select correct colors/images */ if (background->type == NK_STYLE_ITEM_COLOR) text.background = background->data.color; else text.background = style->text_background; if (state & NK_WIDGET_STATE_HOVER) text.text = style->text_hover; else if (state & NK_WIDGET_STATE_ACTIVED) text.text = style->text_active; else text.text = style->text_normal; text.padding = nk_vec2(0,0); nk_widget_text(out, *content, txt, len, &text, text_alignment, font); } NK_LIB int nk_do_button_text(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *string, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_input *in, const struct nk_user_font *font) { struct nk_rect content; int ret = nk_false; NK_ASSERT(state); NK_ASSERT(style); NK_ASSERT(out); NK_ASSERT(string); NK_ASSERT(font); if (!out || !style || !font || !string) return nk_false; ret = nk_do_button(state, out, bounds, style, in, behavior, &content); if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_text(out, &bounds, &content, *state, style, string, len, align, font); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } NK_LIB void nk_draw_button_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *content, nk_flags state, const struct nk_style_button *style, enum nk_symbol_type type, const struct nk_user_font *font) { struct nk_color sym, bg; const struct nk_style_item *background; /* select correct colors/images */ background = nk_draw_button(out, bounds, state, style); if (background->type == NK_STYLE_ITEM_COLOR) bg = background->data.color; else bg = style->text_background; if (state & NK_WIDGET_STATE_HOVER) sym = style->text_hover; else if (state & NK_WIDGET_STATE_ACTIVED) sym = style->text_active; else sym = style->text_normal; nk_draw_symbol(out, type, *content, bg, sym, 1, font); } NK_LIB int nk_do_button_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_input *in, const struct nk_user_font *font) { int ret; struct nk_rect content; NK_ASSERT(state); NK_ASSERT(style); NK_ASSERT(font); NK_ASSERT(out); if (!out || !style || !font || !state) return nk_false; ret = nk_do_button(state, out, bounds, style, in, behavior, &content); if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_symbol(out, &bounds, &content, *state, style, symbol, font); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } NK_LIB void nk_draw_button_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *content, nk_flags state, const struct nk_style_button *style, const struct nk_image *img) { nk_draw_button(out, bounds, state, style); nk_draw_image(out, *content, img, nk_white); } NK_LIB int nk_do_button_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, enum nk_button_behavior b, const struct nk_style_button *style, const struct nk_input *in) { int ret; struct nk_rect content; NK_ASSERT(state); NK_ASSERT(style); NK_ASSERT(out); if (!out || !style || !state) return nk_false; ret = nk_do_button(state, out, bounds, style, in, b, &content); content.x += style->image_padding.x; content.y += style->image_padding.y; content.w -= 2 * style->image_padding.x; content.h -= 2 * style->image_padding.y; if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_image(out, &bounds, &content, *state, style, &img); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } NK_LIB void nk_draw_button_text_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style, const char *str, int len, enum nk_symbol_type type, const struct nk_user_font *font) { struct nk_color sym; struct nk_text text; const struct nk_style_item *background; /* select correct background colors/images */ background = nk_draw_button(out, bounds, state, style); if (background->type == NK_STYLE_ITEM_COLOR) text.background = background->data.color; else text.background = style->text_background; /* select correct text colors */ if (state & NK_WIDGET_STATE_HOVER) { sym = style->text_hover; text.text = style->text_hover; } else if (state & NK_WIDGET_STATE_ACTIVED) { sym = style->text_active; text.text = style->text_active; } else { sym = style->text_normal; text.text = style->text_normal; } text.padding = nk_vec2(0,0); nk_draw_symbol(out, type, *symbol, style->text_background, sym, 0, font); nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font); } NK_LIB int nk_do_button_text_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, const char *str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in) { int ret; struct nk_rect tri = {0,0,0,0}; struct nk_rect content; NK_ASSERT(style); NK_ASSERT(out); NK_ASSERT(font); if (!out || !style || !font) return nk_false; ret = nk_do_button(state, out, bounds, style, in, behavior, &content); tri.y = content.y + (content.h/2) - font->height/2; tri.w = font->height; tri.h = font->height; if (align & NK_TEXT_ALIGN_LEFT) { tri.x = (content.x + content.w) - (2 * style->padding.x + tri.w); tri.x = NK_MAX(tri.x, 0); } else tri.x = content.x + 2 * style->padding.x; /* draw button */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_text_symbol(out, &bounds, &content, &tri, *state, style, str, len, symbol, font); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img) { struct nk_text text; const struct nk_style_item *background; background = nk_draw_button(out, bounds, state, style); /* select correct colors */ if (background->type == NK_STYLE_ITEM_COLOR) text.background = background->data.color; else text.background = style->text_background; if (state & NK_WIDGET_STATE_HOVER) text.text = style->text_hover; else if (state & NK_WIDGET_STATE_ACTIVED) text.text = style->text_active; else text.text = style->text_normal; text.padding = nk_vec2(0,0); nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font); nk_draw_image(out, *image, img, nk_white); } NK_LIB int nk_do_button_text_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, const char* str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in) { int ret; struct nk_rect icon; struct nk_rect content; NK_ASSERT(style); NK_ASSERT(state); NK_ASSERT(font); NK_ASSERT(out); if (!out || !font || !style || !str) return nk_false; ret = nk_do_button(state, out, bounds, style, in, behavior, &content); icon.y = bounds.y + style->padding.y; icon.w = icon.h = bounds.h - 2 * style->padding.y; if (align & NK_TEXT_ALIGN_LEFT) { icon.x = (bounds.x + bounds.w) - (2 * style->padding.x + icon.w); icon.x = NK_MAX(icon.x, 0); } else icon.x = bounds.x + 2 * style->padding.x; icon.x += style->image_padding.x; icon.y += style->image_padding.y; icon.w -= 2 * style->image_padding.x; icon.h -= 2 * style->image_padding.y; if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } NK_API void nk_button_set_behavior(struct nk_context *ctx, enum nk_button_behavior behavior) { NK_ASSERT(ctx); if (!ctx) return; ctx->button_behavior = behavior; } NK_API int nk_button_push_behavior(struct nk_context *ctx, enum nk_button_behavior behavior) { struct nk_config_stack_button_behavior *button_stack; struct nk_config_stack_button_behavior_element *element; NK_ASSERT(ctx); if (!ctx) return 0; button_stack = &ctx->stacks.button_behaviors; NK_ASSERT(button_stack->head < (int)NK_LEN(button_stack->elements)); if (button_stack->head >= (int)NK_LEN(button_stack->elements)) return 0; element = &button_stack->elements[button_stack->head++]; element->address = &ctx->button_behavior; element->old_value = ctx->button_behavior; ctx->button_behavior = behavior; return 1; } NK_API int nk_button_pop_behavior(struct nk_context *ctx) { struct nk_config_stack_button_behavior *button_stack; struct nk_config_stack_button_behavior_element *element; NK_ASSERT(ctx); if (!ctx) return 0; button_stack = &ctx->stacks.button_behaviors; NK_ASSERT(button_stack->head > 0); if (button_stack->head < 1) return 0; element = &button_stack->elements[--button_stack->head]; *element->address = element->old_value; return 1; } NK_API int nk_button_text_styled(struct nk_context *ctx, const struct nk_style_button *style, const char *title, int len) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(style); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!style || !ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_button_text(&ctx->last_widget_state, &win->buffer, bounds, title, len, style->text_alignment, ctx->button_behavior, style, in, ctx->style.font); } NK_API int nk_button_text(struct nk_context *ctx, const char *title, int len) { NK_ASSERT(ctx); if (!ctx) return 0; return nk_button_text_styled(ctx, &ctx->style.button, title, len); } NK_API int nk_button_label_styled(struct nk_context *ctx, const struct nk_style_button *style, const char *title) { return nk_button_text_styled(ctx, style, title, nk_strlen(title)); } NK_API int nk_button_label(struct nk_context *ctx, const char *title) { return nk_button_text(ctx, title, nk_strlen(title)); } NK_API int nk_button_color(struct nk_context *ctx, struct nk_color color) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; struct nk_style_button button; int ret = 0; struct nk_rect bounds; struct nk_rect content; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; button = ctx->style.button; button.normal = nk_style_item_color(color); button.hover = nk_style_item_color(color); button.active = nk_style_item_color(color); ret = nk_do_button(&ctx->last_widget_state, &win->buffer, bounds, &button, in, ctx->button_behavior, &content); nk_draw_button(&win->buffer, &bounds, ctx->last_widget_state, &button); return ret; } NK_API int nk_button_symbol_styled(struct nk_context *ctx, const struct nk_style_button *style, enum nk_symbol_type symbol) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_button_symbol(&ctx->last_widget_state, &win->buffer, bounds, symbol, ctx->button_behavior, style, in, ctx->style.font); } NK_API int nk_button_symbol(struct nk_context *ctx, enum nk_symbol_type symbol) { NK_ASSERT(ctx); if (!ctx) return 0; return nk_button_symbol_styled(ctx, &ctx->style.button, symbol); } NK_API int nk_button_image_styled(struct nk_context *ctx, const struct nk_style_button *style, struct nk_image img) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_button_image(&ctx->last_widget_state, &win->buffer, bounds, img, ctx->button_behavior, style, in); } NK_API int nk_button_image(struct nk_context *ctx, struct nk_image img) { NK_ASSERT(ctx); if (!ctx) return 0; return nk_button_image_styled(ctx, &ctx->style.button, img); } NK_API int nk_button_symbol_text_styled(struct nk_context *ctx, const struct nk_style_button *style, enum nk_symbol_type symbol, const char *text, int len, nk_flags align) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_button_text_symbol(&ctx->last_widget_state, &win->buffer, bounds, symbol, text, len, align, ctx->button_behavior, style, ctx->style.font, in); } NK_API int nk_button_symbol_text(struct nk_context *ctx, enum nk_symbol_type symbol, const char* text, int len, nk_flags align) { NK_ASSERT(ctx); if (!ctx) return 0; return nk_button_symbol_text_styled(ctx, &ctx->style.button, symbol, text, len, align); } NK_API int nk_button_symbol_label(struct nk_context *ctx, enum nk_symbol_type symbol, const char *label, nk_flags align) { return nk_button_symbol_text(ctx, symbol, label, nk_strlen(label), align); } NK_API int nk_button_symbol_label_styled(struct nk_context *ctx, const struct nk_style_button *style, enum nk_symbol_type symbol, const char *title, nk_flags align) { return nk_button_symbol_text_styled(ctx, style, symbol, title, nk_strlen(title), align); } NK_API int nk_button_image_text_styled(struct nk_context *ctx, const struct nk_style_button *style, struct nk_image img, const char *text, int len, nk_flags align) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_button_text_image(&ctx->last_widget_state, &win->buffer, bounds, img, text, len, align, ctx->button_behavior, style, ctx->style.font, in); } NK_API int nk_button_image_text(struct nk_context *ctx, struct nk_image img, const char *text, int len, nk_flags align) { return nk_button_image_text_styled(ctx, &ctx->style.button,img, text, len, align); } NK_API int nk_button_image_label(struct nk_context *ctx, struct nk_image img, const char *label, nk_flags align) { return nk_button_image_text(ctx, img, label, nk_strlen(label), align); } NK_API int nk_button_image_label_styled(struct nk_context *ctx, const struct nk_style_button *style, struct nk_image img, const char *label, nk_flags text_alignment) { return nk_button_image_text_styled(ctx, style, img, label, nk_strlen(label), text_alignment); } /* =============================================================== * * TOGGLE * * ===============================================================*/ NK_LIB int nk_toggle_behavior(const struct nk_input *in, struct nk_rect select, nk_flags *state, int active) { nk_widget_state_reset(state); if (nk_button_behavior(state, select, in, NK_BUTTON_DEFAULT)) { *state = NK_WIDGET_STATE_ACTIVE; active = !active; } if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(in, select)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(in, select)) *state |= NK_WIDGET_STATE_LEFT; return active; } NK_LIB void nk_draw_checkbox(struct nk_command_buffer *out, nk_flags state, const struct nk_style_toggle *style, int active, const struct nk_rect *label, const struct nk_rect *selector, const struct nk_rect *cursors, const char *string, int len, const struct nk_user_font *font) { const struct nk_style_item *background; const struct nk_style_item *cursor; struct nk_text text; /* select correct colors/images */ if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover; cursor = &style->cursor_hover; text.text = style->text_hover; } else if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->hover; cursor = &style->cursor_hover; text.text = style->text_active; } else { background = &style->normal; cursor = &style->cursor_normal; text.text = style->text_normal; } /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { nk_fill_rect(out, *selector, 0, style->border_color); nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_white); else nk_fill_rect(out, *cursors, 0, cursor->data.color); } text.padding.x = 0; text.padding.y = 0; text.background = style->text_background; nk_widget_text(out, *label, string, len, &text, NK_TEXT_LEFT, font); } NK_LIB void nk_draw_option(struct nk_command_buffer *out, nk_flags state, const struct nk_style_toggle *style, int active, const struct nk_rect *label, const struct nk_rect *selector, const struct nk_rect *cursors, const char *string, int len, const struct nk_user_font *font) { const struct nk_style_item *background; const struct nk_style_item *cursor; struct nk_text text; /* select correct colors/images */ if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover; cursor = &style->cursor_hover; text.text = style->text_hover; } else if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->hover; cursor = &style->cursor_hover; text.text = style->text_active; } else { background = &style->normal; cursor = &style->cursor_normal; text.text = style->text_normal; } /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { nk_fill_circle(out, *selector, style->border_color); nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_white); else nk_fill_circle(out, *cursors, cursor->data.color); } text.padding.x = 0; text.padding.y = 0; text.background = style->text_background; nk_widget_text(out, *label, string, len, &text, NK_TEXT_LEFT, font); } NK_LIB int nk_do_toggle(nk_flags *state, struct nk_command_buffer *out, struct nk_rect r, int *active, const char *str, int len, enum nk_toggle_type type, const struct nk_style_toggle *style, const struct nk_input *in, const struct nk_user_font *font) { int was_active; struct nk_rect bounds; struct nk_rect select; struct nk_rect cursor; struct nk_rect label; NK_ASSERT(style); NK_ASSERT(out); NK_ASSERT(font); if (!out || !style || !font || !active) return 0; r.w = NK_MAX(r.w, font->height + 2 * style->padding.x); r.h = NK_MAX(r.h, font->height + 2 * style->padding.y); /* add additional touch padding for touch screen devices */ bounds.x = r.x - style->touch_padding.x; bounds.y = r.y - style->touch_padding.y; bounds.w = r.w + 2 * style->touch_padding.x; bounds.h = r.h + 2 * style->touch_padding.y; /* calculate the selector space */ select.w = font->height; select.h = select.w; select.y = r.y + r.h/2.0f - select.h/2.0f; select.x = r.x; /* calculate the bounds of the cursor inside the selector */ cursor.x = select.x + style->padding.x + style->border; cursor.y = select.y + style->padding.y + style->border; cursor.w = select.w - (2 * style->padding.x + 2 * style->border); cursor.h = select.h - (2 * style->padding.y + 2 * style->border); /* label behind the selector */ label.x = select.x + select.w + style->spacing; label.y = select.y; label.w = NK_MAX(r.x + r.w, label.x) - label.x; label.h = select.w; /* update selector */ was_active = *active; *active = nk_toggle_behavior(in, bounds, state, *active); /* draw selector */ if (style->draw_begin) style->draw_begin(out, style->userdata); if (type == NK_TOGGLE_CHECK) { nk_draw_checkbox(out, *state, style, *active, &label, &select, &cursor, str, len, font); } else { nk_draw_option(out, *state, style, *active, &label, &select, &cursor, str, len, font); } if (style->draw_end) style->draw_end(out, style->userdata); return (was_active != *active); } /*---------------------------------------------------------------- * * CHECKBOX * * --------------------------------------------------------------*/ NK_API int nk_check_text(struct nk_context *ctx, const char *text, int len, int active) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; const struct nk_style *style; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return active; win = ctx->current; style = &ctx->style; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return active; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; nk_do_toggle(&ctx->last_widget_state, &win->buffer, bounds, &active, text, len, NK_TOGGLE_CHECK, &style->checkbox, in, style->font); return active; } NK_API unsigned int nk_check_flags_text(struct nk_context *ctx, const char *text, int len, unsigned int flags, unsigned int value) { int old_active; NK_ASSERT(ctx); NK_ASSERT(text); if (!ctx || !text) return flags; old_active = (int)((flags & value) & value); if (nk_check_text(ctx, text, len, old_active)) flags |= value; else flags &= ~value; return flags; } NK_API int nk_checkbox_text(struct nk_context *ctx, const char *text, int len, int *active) { int old_val; NK_ASSERT(ctx); NK_ASSERT(text); NK_ASSERT(active); if (!ctx || !text || !active) return 0; old_val = *active; *active = nk_check_text(ctx, text, len, *active); return old_val != *active; } NK_API int nk_checkbox_flags_text(struct nk_context *ctx, const char *text, int len, unsigned int *flags, unsigned int value) { int active; NK_ASSERT(ctx); NK_ASSERT(text); NK_ASSERT(flags); if (!ctx || !text || !flags) return 0; active = (int)((*flags & value) & value); if (nk_checkbox_text(ctx, text, len, &active)) { if (active) *flags |= value; else *flags &= ~value; return 1; } return 0; } NK_API int nk_check_label(struct nk_context *ctx, const char *label, int active) { return nk_check_text(ctx, label, nk_strlen(label), active); } NK_API unsigned int nk_check_flags_label(struct nk_context *ctx, const char *label, unsigned int flags, unsigned int value) { return nk_check_flags_text(ctx, label, nk_strlen(label), flags, value); } NK_API int nk_checkbox_label(struct nk_context *ctx, const char *label, int *active) { return nk_checkbox_text(ctx, label, nk_strlen(label), active); } NK_API int nk_checkbox_flags_label(struct nk_context *ctx, const char *label, unsigned int *flags, unsigned int value) { return nk_checkbox_flags_text(ctx, label, nk_strlen(label), flags, value); } /*---------------------------------------------------------------- * * OPTION * * --------------------------------------------------------------*/ NK_API int nk_option_text(struct nk_context *ctx, const char *text, int len, int is_active) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; const struct nk_style *style; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return is_active; win = ctx->current; style = &ctx->style; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return (int)state; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; nk_do_toggle(&ctx->last_widget_state, &win->buffer, bounds, &is_active, text, len, NK_TOGGLE_OPTION, &style->option, in, style->font); return is_active; } NK_API int nk_radio_text(struct nk_context *ctx, const char *text, int len, int *active) { int old_value; NK_ASSERT(ctx); NK_ASSERT(text); NK_ASSERT(active); if (!ctx || !text || !active) return 0; old_value = *active; *active = nk_option_text(ctx, text, len, old_value); return old_value != *active; } NK_API int nk_option_label(struct nk_context *ctx, const char *label, int active) { return nk_option_text(ctx, label, nk_strlen(label), active); } NK_API int nk_radio_label(struct nk_context *ctx, const char *label, int *active) { return nk_radio_text(ctx, label, nk_strlen(label), active); } /* =============================================================== * * SELECTABLE * * ===============================================================*/ NK_LIB void nk_draw_selectable(struct nk_command_buffer *out, nk_flags state, const struct nk_style_selectable *style, int active, const struct nk_rect *bounds, const struct nk_rect *icon, const struct nk_image *img, enum nk_symbol_type sym, const char *string, int len, nk_flags align, const struct nk_user_font *font) { const struct nk_style_item *background; struct nk_text text; text.padding = style->padding; /* select correct colors/images */ if (!active) { if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->pressed; text.text = style->text_pressed; } else if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover; text.text = style->text_hover; } else { background = &style->normal; text.text = style->text_normal; } } else { if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->pressed_active; text.text = style->text_pressed_active; } else if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover_active; text.text = style->text_hover_active; } else { background = &style->normal_active; text.text = style->text_normal_active; } } /* draw selectable background and text */ if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(out, *bounds, &background->data.image, nk_white); text.background = nk_rgba(0,0,0,0); } else { nk_fill_rect(out, *bounds, style->rounding, background->data.color); text.background = background->data.color; } if (icon) { if (img) nk_draw_image(out, *icon, img, nk_white); else nk_draw_symbol(out, sym, *icon, text.background, text.text, 1, font); } nk_widget_text(out, *bounds, string, len, &text, align, font); } NK_LIB int nk_do_selectable(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *str, int len, nk_flags align, int *value, const struct nk_style_selectable *style, const struct nk_input *in, const struct nk_user_font *font) { int old_value; struct nk_rect touch; NK_ASSERT(state); NK_ASSERT(out); NK_ASSERT(str); NK_ASSERT(len); NK_ASSERT(value); NK_ASSERT(style); NK_ASSERT(font); if (!state || !out || !str || !len || !value || !style || !font) return 0; old_value = *value; /* remove padding */ touch.x = bounds.x - style->touch_padding.x; touch.y = bounds.y - style->touch_padding.y; touch.w = bounds.w + style->touch_padding.x * 2; touch.h = bounds.h + style->touch_padding.y * 2; /* update button */ if (nk_button_behavior(state, touch, in, NK_BUTTON_DEFAULT)) *value = !(*value); /* draw selectable */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_selectable(out, *state, style, *value, &bounds, 0,0,NK_SYMBOL_NONE, str, len, align, font); if (style->draw_end) style->draw_end(out, style->userdata); return old_value != *value; } NK_LIB int nk_do_selectable_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *str, int len, nk_flags align, int *value, const struct nk_image *img, const struct nk_style_selectable *style, const struct nk_input *in, const struct nk_user_font *font) { int old_value; struct nk_rect touch; struct nk_rect icon; NK_ASSERT(state); NK_ASSERT(out); NK_ASSERT(str); NK_ASSERT(len); NK_ASSERT(value); NK_ASSERT(style); NK_ASSERT(font); if (!state || !out || !str || !len || !value || !style || !font) return 0; old_value = *value; /* toggle behavior */ touch.x = bounds.x - style->touch_padding.x; touch.y = bounds.y - style->touch_padding.y; touch.w = bounds.w + style->touch_padding.x * 2; touch.h = bounds.h + style->touch_padding.y * 2; if (nk_button_behavior(state, touch, in, NK_BUTTON_DEFAULT)) *value = !(*value); icon.y = bounds.y + style->padding.y; icon.w = icon.h = bounds.h - 2 * style->padding.y; if (align & NK_TEXT_ALIGN_LEFT) { icon.x = (bounds.x + bounds.w) - (2 * style->padding.x + icon.w); icon.x = NK_MAX(icon.x, 0); } else icon.x = bounds.x + 2 * style->padding.x; icon.x += style->image_padding.x; icon.y += style->image_padding.y; icon.w -= 2 * style->image_padding.x; icon.h -= 2 * style->image_padding.y; /* draw selectable */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_selectable(out, *state, style, *value, &bounds, &icon, img, NK_SYMBOL_NONE, str, len, align, font); if (style->draw_end) style->draw_end(out, style->userdata); return old_value != *value; } NK_LIB int nk_do_selectable_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *str, int len, nk_flags align, int *value, enum nk_symbol_type sym, const struct nk_style_selectable *style, const struct nk_input *in, const struct nk_user_font *font) { int old_value; struct nk_rect touch; struct nk_rect icon; NK_ASSERT(state); NK_ASSERT(out); NK_ASSERT(str); NK_ASSERT(len); NK_ASSERT(value); NK_ASSERT(style); NK_ASSERT(font); if (!state || !out || !str || !len || !value || !style || !font) return 0; old_value = *value; /* toggle behavior */ touch.x = bounds.x - style->touch_padding.x; touch.y = bounds.y - style->touch_padding.y; touch.w = bounds.w + style->touch_padding.x * 2; touch.h = bounds.h + style->touch_padding.y * 2; if (nk_button_behavior(state, touch, in, NK_BUTTON_DEFAULT)) *value = !(*value); icon.y = bounds.y + style->padding.y; icon.w = icon.h = bounds.h - 2 * style->padding.y; if (align & NK_TEXT_ALIGN_LEFT) { icon.x = (bounds.x + bounds.w) - (2 * style->padding.x + icon.w); icon.x = NK_MAX(icon.x, 0); } else icon.x = bounds.x + 2 * style->padding.x; icon.x += style->image_padding.x; icon.y += style->image_padding.y; icon.w -= 2 * style->image_padding.x; icon.h -= 2 * style->image_padding.y; /* draw selectable */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_selectable(out, *state, style, *value, &bounds, &icon, 0, sym, str, len, align, font); if (style->draw_end) style->draw_end(out, style->userdata); return old_value != *value; } NK_API int nk_selectable_text(struct nk_context *ctx, const char *str, int len, nk_flags align, int *value) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; const struct nk_style *style; enum nk_widget_layout_states state; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(value); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !value) return 0; win = ctx->current; layout = win->layout; style = &ctx->style; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_selectable(&ctx->last_widget_state, &win->buffer, bounds, str, len, align, value, &style->selectable, in, style->font); } NK_API int nk_selectable_image_text(struct nk_context *ctx, struct nk_image img, const char *str, int len, nk_flags align, int *value) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; const struct nk_style *style; enum nk_widget_layout_states state; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(value); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !value) return 0; win = ctx->current; layout = win->layout; style = &ctx->style; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_selectable_image(&ctx->last_widget_state, &win->buffer, bounds, str, len, align, value, &img, &style->selectable, in, style->font); } NK_API int nk_selectable_symbol_text(struct nk_context *ctx, enum nk_symbol_type sym, const char *str, int len, nk_flags align, int *value) { struct nk_window *win; struct nk_panel *layout; const struct nk_input *in; const struct nk_style *style; enum nk_widget_layout_states state; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(value); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !value) return 0; win = ctx->current; layout = win->layout; style = &ctx->style; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_selectable_symbol(&ctx->last_widget_state, &win->buffer, bounds, str, len, align, value, sym, &style->selectable, in, style->font); } NK_API int nk_selectable_symbol_label(struct nk_context *ctx, enum nk_symbol_type sym, const char *title, nk_flags align, int *value) { return nk_selectable_symbol_text(ctx, sym, title, nk_strlen(title), align, value); } NK_API int nk_select_text(struct nk_context *ctx, const char *str, int len, nk_flags align, int value) { nk_selectable_text(ctx, str, len, align, &value);return value; } NK_API int nk_selectable_label(struct nk_context *ctx, const char *str, nk_flags align, int *value) { return nk_selectable_text(ctx, str, nk_strlen(str), align, value); } NK_API int nk_selectable_image_label(struct nk_context *ctx,struct nk_image img, const char *str, nk_flags align, int *value) { return nk_selectable_image_text(ctx, img, str, nk_strlen(str), align, value); } NK_API int nk_select_label(struct nk_context *ctx, const char *str, nk_flags align, int value) { nk_selectable_text(ctx, str, nk_strlen(str), align, &value);return value; } NK_API int nk_select_image_label(struct nk_context *ctx, struct nk_image img, const char *str, nk_flags align, int value) { nk_selectable_image_text(ctx, img, str, nk_strlen(str), align, &value);return value; } NK_API int nk_select_image_text(struct nk_context *ctx, struct nk_image img, const char *str, int len, nk_flags align, int value) { nk_selectable_image_text(ctx, img, str, len, align, &value);return value; } NK_API int nk_select_symbol_text(struct nk_context *ctx, enum nk_symbol_type sym, const char *title, int title_len, nk_flags align, int value) { nk_selectable_symbol_text(ctx, sym, title, title_len, align, &value);return value; } NK_API int nk_select_symbol_label(struct nk_context *ctx, enum nk_symbol_type sym, const char *title, nk_flags align, int value) { return nk_select_symbol_text(ctx, sym, title, nk_strlen(title), align, value); } /* =============================================================== * * SLIDER * * ===============================================================*/ NK_LIB float nk_slider_behavior(nk_flags *state, struct nk_rect *logical_cursor, struct nk_rect *visual_cursor, struct nk_input *in, struct nk_rect bounds, float slider_min, float slider_max, float slider_value, float slider_step, float slider_steps) { int left_mouse_down; int left_mouse_click_in_cursor; /* check if visual cursor is being dragged */ nk_widget_state_reset(state); left_mouse_down = in && in->mouse.buttons[NK_BUTTON_LEFT].down; left_mouse_click_in_cursor = in && nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, *visual_cursor, nk_true); if (left_mouse_down && left_mouse_click_in_cursor) { float ratio = 0; const float d = in->mouse.pos.x - (visual_cursor->x+visual_cursor->w*0.5f); const float pxstep = bounds.w / slider_steps; /* only update value if the next slider step is reached */ *state = NK_WIDGET_STATE_ACTIVE; if (NK_ABS(d) >= pxstep) { const float steps = (float)((int)(NK_ABS(d) / pxstep)); slider_value += (d > 0) ? (slider_step*steps) : -(slider_step*steps); slider_value = NK_CLAMP(slider_min, slider_value, slider_max); ratio = (slider_value - slider_min)/slider_step; logical_cursor->x = bounds.x + (logical_cursor->w * ratio); in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x = logical_cursor->x; } } /* slider widget state */ if (nk_input_is_mouse_hovering_rect(in, bounds)) *state = NK_WIDGET_STATE_HOVERED; if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(in, bounds)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(in, bounds)) *state |= NK_WIDGET_STATE_LEFT; return slider_value; } NK_LIB void nk_draw_slider(struct nk_command_buffer *out, nk_flags state, const struct nk_style_slider *style, const struct nk_rect *bounds, const struct nk_rect *visual_cursor, float min, float value, float max) { struct nk_rect fill; struct nk_rect bar; const struct nk_style_item *background; /* select correct slider images/colors */ struct nk_color bar_color; const struct nk_style_item *cursor; NK_UNUSED(min); NK_UNUSED(max); NK_UNUSED(value); if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->active; bar_color = style->bar_active; cursor = &style->cursor_active; } else if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover; bar_color = style->bar_hover; cursor = &style->cursor_hover; } else { background = &style->normal; bar_color = style->bar_normal; cursor = &style->cursor_normal; } /* calculate slider background bar */ bar.x = bounds->x; bar.y = (visual_cursor->y + visual_cursor->h/2) - bounds->h/12; bar.w = bounds->w; bar.h = bounds->h/6; /* filled background bar style */ fill.w = (visual_cursor->x + (visual_cursor->w/2.0f)) - bar.x; fill.x = bar.x; fill.y = bar.y; fill.h = bar.h; /* draw background */ if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(out, *bounds, &background->data.image, nk_white); } else { nk_fill_rect(out, *bounds, style->rounding, background->data.color); nk_stroke_rect(out, *bounds, style->rounding, style->border, style->border_color); } /* draw slider bar */ nk_fill_rect(out, bar, style->rounding, bar_color); nk_fill_rect(out, fill, style->rounding, style->bar_filled); /* draw cursor */ if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *visual_cursor, &cursor->data.image, nk_white); else nk_fill_circle(out, *visual_cursor, cursor->data.color); } NK_LIB float nk_do_slider(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, float min, float val, float max, float step, const struct nk_style_slider *style, struct nk_input *in, const struct nk_user_font *font) { float slider_range; float slider_min; float slider_max; float slider_value; float slider_steps; float cursor_offset; struct nk_rect visual_cursor; struct nk_rect logical_cursor; NK_ASSERT(style); NK_ASSERT(out); if (!out || !style) return 0; /* remove padding from slider bounds */ bounds.x = bounds.x + style->padding.x; bounds.y = bounds.y + style->padding.y; bounds.h = NK_MAX(bounds.h, 2*style->padding.y); bounds.w = NK_MAX(bounds.w, 2*style->padding.x + style->cursor_size.x); bounds.w -= 2 * style->padding.x; bounds.h -= 2 * style->padding.y; /* optional buttons */ if (style->show_buttons) { nk_flags ws; struct nk_rect button; button.y = bounds.y; button.w = bounds.h; button.h = bounds.h; /* decrement button */ button.x = bounds.x; if (nk_do_button_symbol(&ws, out, button, style->dec_symbol, NK_BUTTON_DEFAULT, &style->dec_button, in, font)) val -= step; /* increment button */ button.x = (bounds.x + bounds.w) - button.w; if (nk_do_button_symbol(&ws, out, button, style->inc_symbol, NK_BUTTON_DEFAULT, &style->inc_button, in, font)) val += step; bounds.x = bounds.x + button.w + style->spacing.x; bounds.w = bounds.w - (2*button.w + 2*style->spacing.x); } /* remove one cursor size to support visual cursor */ bounds.x += style->cursor_size.x*0.5f; bounds.w -= style->cursor_size.x; /* make sure the provided values are correct */ slider_max = NK_MAX(min, max); slider_min = NK_MIN(min, max); slider_value = NK_CLAMP(slider_min, val, slider_max); slider_range = slider_max - slider_min; slider_steps = slider_range / step; cursor_offset = (slider_value - slider_min) / step; /* calculate cursor Basically you have two cursors. One for visual representation and interaction and one for updating the actual cursor value. */ logical_cursor.h = bounds.h; logical_cursor.w = bounds.w / slider_steps; logical_cursor.x = bounds.x + (logical_cursor.w * cursor_offset); logical_cursor.y = bounds.y; visual_cursor.h = style->cursor_size.y; visual_cursor.w = style->cursor_size.x; visual_cursor.y = (bounds.y + bounds.h*0.5f) - visual_cursor.h*0.5f; visual_cursor.x = logical_cursor.x - visual_cursor.w*0.5f; slider_value = nk_slider_behavior(state, &logical_cursor, &visual_cursor, in, bounds, slider_min, slider_max, slider_value, step, slider_steps); visual_cursor.x = logical_cursor.x - visual_cursor.w*0.5f; /* draw slider */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_slider(out, *state, style, &bounds, &visual_cursor, slider_min, slider_value, slider_max); if (style->draw_end) style->draw_end(out, style->userdata); return slider_value; } NK_API int nk_slider_float(struct nk_context *ctx, float min_value, float *value, float max_value, float value_step) { struct nk_window *win; struct nk_panel *layout; struct nk_input *in; const struct nk_style *style; int ret = 0; float old_value; struct nk_rect bounds; enum nk_widget_layout_states state; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); NK_ASSERT(value); if (!ctx || !ctx->current || !ctx->current->layout || !value) return ret; win = ctx->current; style = &ctx->style; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return ret; in = (/*state == NK_WIDGET_ROM || */ layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; old_value = *value; *value = nk_do_slider(&ctx->last_widget_state, &win->buffer, bounds, min_value, old_value, max_value, value_step, &style->slider, in, style->font); return (old_value > *value || old_value < *value); } NK_API float nk_slide_float(struct nk_context *ctx, float min, float val, float max, float step) { nk_slider_float(ctx, min, &val, max, step); return val; } NK_API int nk_slide_int(struct nk_context *ctx, int min, int val, int max, int step) { float value = (float)val; nk_slider_float(ctx, (float)min, &value, (float)max, (float)step); return (int)value; } NK_API int nk_slider_int(struct nk_context *ctx, int min, int *val, int max, int step) { int ret; float value = (float)*val; ret = nk_slider_float(ctx, (float)min, &value, (float)max, (float)step); *val = (int)value; return ret; } /* =============================================================== * * PROGRESS * * ===============================================================*/ NK_LIB nk_size nk_progress_behavior(nk_flags *state, struct nk_input *in, struct nk_rect r, struct nk_rect cursor, nk_size max, nk_size value, int modifiable) { int left_mouse_down = 0; int left_mouse_click_in_cursor = 0; nk_widget_state_reset(state); if (!in || !modifiable) return value; left_mouse_down = in && in->mouse.buttons[NK_BUTTON_LEFT].down; left_mouse_click_in_cursor = in && nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, cursor, nk_true); if (nk_input_is_mouse_hovering_rect(in, r)) *state = NK_WIDGET_STATE_HOVERED; if (in && left_mouse_down && left_mouse_click_in_cursor) { if (left_mouse_down && left_mouse_click_in_cursor) { float ratio = NK_MAX(0, (float)(in->mouse.pos.x - cursor.x)) / (float)cursor.w; value = (nk_size)NK_CLAMP(0, (float)max * ratio, (float)max); in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x = cursor.x + cursor.w/2.0f; *state |= NK_WIDGET_STATE_ACTIVE; } } /* set progressbar widget state */ if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(in, r)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(in, r)) *state |= NK_WIDGET_STATE_LEFT; return value; } NK_LIB void nk_draw_progress(struct nk_command_buffer *out, nk_flags state, const struct nk_style_progress *style, const struct nk_rect *bounds, const struct nk_rect *scursor, nk_size value, nk_size max) { const struct nk_style_item *background; const struct nk_style_item *cursor; NK_UNUSED(max); NK_UNUSED(value); /* select correct colors/images to draw */ if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->active; cursor = &style->cursor_active; } else if (state & NK_WIDGET_STATE_HOVER){ background = &style->hover; cursor = &style->cursor_hover; } else { background = &style->normal; cursor = &style->cursor_normal; } /* draw background */ if (background->type == NK_STYLE_ITEM_COLOR) { nk_fill_rect(out, *bounds, style->rounding, background->data.color); nk_stroke_rect(out, *bounds, style->rounding, style->border, style->border_color); } else nk_draw_image(out, *bounds, &background->data.image, nk_white); /* draw cursor */ if (cursor->type == NK_STYLE_ITEM_COLOR) { nk_fill_rect(out, *scursor, style->rounding, cursor->data.color); nk_stroke_rect(out, *scursor, style->rounding, style->border, style->border_color); } else nk_draw_image(out, *scursor, &cursor->data.image, nk_white); } NK_LIB nk_size nk_do_progress(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, nk_size value, nk_size max, int modifiable, const struct nk_style_progress *style, struct nk_input *in) { float prog_scale; nk_size prog_value; struct nk_rect cursor; NK_ASSERT(style); NK_ASSERT(out); if (!out || !style) return 0; /* calculate progressbar cursor */ cursor.w = NK_MAX(bounds.w, 2 * style->padding.x + 2 * style->border); cursor.h = NK_MAX(bounds.h, 2 * style->padding.y + 2 * style->border); cursor = nk_pad_rect(bounds, nk_vec2(style->padding.x + style->border, style->padding.y + style->border)); prog_scale = (float)value / (float)max; /* update progressbar */ prog_value = NK_MIN(value, max); prog_value = nk_progress_behavior(state, in, bounds, cursor,max, prog_value, modifiable); cursor.w = cursor.w * prog_scale; /* draw progressbar */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_progress(out, *state, style, &bounds, &cursor, value, max); if (style->draw_end) style->draw_end(out, style->userdata); return prog_value; } NK_API int nk_progress(struct nk_context *ctx, nk_size *cur, nk_size max, int is_modifyable) { struct nk_window *win; struct nk_panel *layout; const struct nk_style *style; struct nk_input *in; struct nk_rect bounds; enum nk_widget_layout_states state; nk_size old_value; NK_ASSERT(ctx); NK_ASSERT(cur); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !cur) return 0; win = ctx->current; style = &ctx->style; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; old_value = *cur; *cur = nk_do_progress(&ctx->last_widget_state, &win->buffer, bounds, *cur, max, is_modifyable, &style->progress, in); return (*cur != old_value); } NK_API nk_size nk_prog(struct nk_context *ctx, nk_size cur, nk_size max, int modifyable) { nk_progress(ctx, &cur, max, modifyable); return cur; } /* =============================================================== * * SCROLLBAR * * ===============================================================*/ NK_LIB float nk_scrollbar_behavior(nk_flags *state, struct nk_input *in, int has_scrolling, const struct nk_rect *scroll, const struct nk_rect *cursor, const struct nk_rect *empty0, const struct nk_rect *empty1, float scroll_offset, float target, float scroll_step, enum nk_orientation o) { nk_flags ws = 0; int left_mouse_down; int left_mouse_click_in_cursor; float scroll_delta; nk_widget_state_reset(state); if (!in) return scroll_offset; left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down; left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, *cursor, nk_true); if (nk_input_is_mouse_hovering_rect(in, *scroll)) *state = NK_WIDGET_STATE_HOVERED; scroll_delta = (o == NK_VERTICAL) ? in->mouse.scroll_delta.y: in->mouse.scroll_delta.x; if (left_mouse_down && left_mouse_click_in_cursor) { /* update cursor by mouse dragging */ float pixel, delta; *state = NK_WIDGET_STATE_ACTIVE; if (o == NK_VERTICAL) { float cursor_y; pixel = in->mouse.delta.y; delta = (pixel / scroll->h) * target; scroll_offset = NK_CLAMP(0, scroll_offset + delta, target - scroll->h); cursor_y = scroll->y + ((scroll_offset/target) * scroll->h); in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.y = cursor_y + cursor->h/2.0f; } else { float cursor_x; pixel = in->mouse.delta.x; delta = (pixel / scroll->w) * target; scroll_offset = NK_CLAMP(0, scroll_offset + delta, target - scroll->w); cursor_x = scroll->x + ((scroll_offset/target) * scroll->w); in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x = cursor_x + cursor->w/2.0f; } } else if ((nk_input_is_key_pressed(in, NK_KEY_SCROLL_UP) && o == NK_VERTICAL && has_scrolling)|| nk_button_behavior(&ws, *empty0, in, NK_BUTTON_DEFAULT)) { /* scroll page up by click on empty space or shortcut */ if (o == NK_VERTICAL) scroll_offset = NK_MAX(0, scroll_offset - scroll->h); else scroll_offset = NK_MAX(0, scroll_offset - scroll->w); } else if ((nk_input_is_key_pressed(in, NK_KEY_SCROLL_DOWN) && o == NK_VERTICAL && has_scrolling) || nk_button_behavior(&ws, *empty1, in, NK_BUTTON_DEFAULT)) { /* scroll page down by click on empty space or shortcut */ if (o == NK_VERTICAL) scroll_offset = NK_MIN(scroll_offset + scroll->h, target - scroll->h); else scroll_offset = NK_MIN(scroll_offset + scroll->w, target - scroll->w); } else if (has_scrolling) { if ((scroll_delta < 0 || (scroll_delta > 0))) { /* update cursor by mouse scrolling */ scroll_offset = scroll_offset + scroll_step * (-scroll_delta); if (o == NK_VERTICAL) scroll_offset = NK_CLAMP(0, scroll_offset, target - scroll->h); else scroll_offset = NK_CLAMP(0, scroll_offset, target - scroll->w); } else if (nk_input_is_key_pressed(in, NK_KEY_SCROLL_START)) { /* update cursor to the beginning */ if (o == NK_VERTICAL) scroll_offset = 0; } else if (nk_input_is_key_pressed(in, NK_KEY_SCROLL_END)) { /* update cursor to the end */ if (o == NK_VERTICAL) scroll_offset = target - scroll->h; } } if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(in, *scroll)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(in, *scroll)) *state |= NK_WIDGET_STATE_LEFT; return scroll_offset; } NK_LIB void nk_draw_scrollbar(struct nk_command_buffer *out, nk_flags state, const struct nk_style_scrollbar *style, const struct nk_rect *bounds, const struct nk_rect *scroll) { const struct nk_style_item *background; const struct nk_style_item *cursor; /* select correct colors/images to draw */ if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->active; cursor = &style->cursor_active; } else if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover; cursor = &style->cursor_hover; } else { background = &style->normal; cursor = &style->cursor_normal; } /* draw background */ if (background->type == NK_STYLE_ITEM_COLOR) { nk_fill_rect(out, *bounds, style->rounding, background->data.color); nk_stroke_rect(out, *bounds, style->rounding, style->border, style->border_color); } else { nk_draw_image(out, *bounds, &background->data.image, nk_white); } /* draw cursor */ if (cursor->type == NK_STYLE_ITEM_COLOR) { nk_fill_rect(out, *scroll, style->rounding_cursor, cursor->data.color); nk_stroke_rect(out, *scroll, style->rounding_cursor, style->border_cursor, style->cursor_border_color); } else nk_draw_image(out, *scroll, &cursor->data.image, nk_white); } NK_LIB float nk_do_scrollbarv(nk_flags *state, struct nk_command_buffer *out, struct nk_rect scroll, int has_scrolling, float offset, float target, float step, float button_pixel_inc, const struct nk_style_scrollbar *style, struct nk_input *in, const struct nk_user_font *font) { struct nk_rect empty_north; struct nk_rect empty_south; struct nk_rect cursor; float scroll_step; float scroll_offset; float scroll_off; float scroll_ratio; NK_ASSERT(out); NK_ASSERT(style); NK_ASSERT(state); if (!out || !style) return 0; scroll.w = NK_MAX(scroll.w, 1); scroll.h = NK_MAX(scroll.h, 0); if (target <= scroll.h) return 0; /* optional scrollbar buttons */ if (style->show_buttons) { nk_flags ws; float scroll_h; struct nk_rect button; button.x = scroll.x; button.w = scroll.w; button.h = scroll.w; scroll_h = NK_MAX(scroll.h - 2 * button.h,0); scroll_step = NK_MIN(step, button_pixel_inc); /* decrement button */ button.y = scroll.y; if (nk_do_button_symbol(&ws, out, button, style->dec_symbol, NK_BUTTON_REPEATER, &style->dec_button, in, font)) offset = offset - scroll_step; /* increment button */ button.y = scroll.y + scroll.h - button.h; if (nk_do_button_symbol(&ws, out, button, style->inc_symbol, NK_BUTTON_REPEATER, &style->inc_button, in, font)) offset = offset + scroll_step; scroll.y = scroll.y + button.h; scroll.h = scroll_h; } /* calculate scrollbar constants */ scroll_step = NK_MIN(step, scroll.h); scroll_offset = NK_CLAMP(0, offset, target - scroll.h); scroll_ratio = scroll.h / target; scroll_off = scroll_offset / target; /* calculate scrollbar cursor bounds */ cursor.h = NK_MAX((scroll_ratio * scroll.h) - (2*style->border + 2*style->padding.y), 0); cursor.y = scroll.y + (scroll_off * scroll.h) + style->border + style->padding.y; cursor.w = scroll.w - (2 * style->border + 2 * style->padding.x); cursor.x = scroll.x + style->border + style->padding.x; /* calculate empty space around cursor */ empty_north.x = scroll.x; empty_north.y = scroll.y; empty_north.w = scroll.w; empty_north.h = NK_MAX(cursor.y - scroll.y, 0); empty_south.x = scroll.x; empty_south.y = cursor.y + cursor.h; empty_south.w = scroll.w; empty_south.h = NK_MAX((scroll.y + scroll.h) - (cursor.y + cursor.h), 0); /* update scrollbar */ scroll_offset = nk_scrollbar_behavior(state, in, has_scrolling, &scroll, &cursor, &empty_north, &empty_south, scroll_offset, target, scroll_step, NK_VERTICAL); scroll_off = scroll_offset / target; cursor.y = scroll.y + (scroll_off * scroll.h) + style->border_cursor + style->padding.y; /* draw scrollbar */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_scrollbar(out, *state, style, &scroll, &cursor); if (style->draw_end) style->draw_end(out, style->userdata); return scroll_offset; } NK_LIB float nk_do_scrollbarh(nk_flags *state, struct nk_command_buffer *out, struct nk_rect scroll, int has_scrolling, float offset, float target, float step, float button_pixel_inc, const struct nk_style_scrollbar *style, struct nk_input *in, const struct nk_user_font *font) { struct nk_rect cursor; struct nk_rect empty_west; struct nk_rect empty_east; float scroll_step; float scroll_offset; float scroll_off; float scroll_ratio; NK_ASSERT(out); NK_ASSERT(style); if (!out || !style) return 0; /* scrollbar background */ scroll.h = NK_MAX(scroll.h, 1); scroll.w = NK_MAX(scroll.w, 2 * scroll.h); if (target <= scroll.w) return 0; /* optional scrollbar buttons */ if (style->show_buttons) { nk_flags ws; float scroll_w; struct nk_rect button; button.y = scroll.y; button.w = scroll.h; button.h = scroll.h; scroll_w = scroll.w - 2 * button.w; scroll_step = NK_MIN(step, button_pixel_inc); /* decrement button */ button.x = scroll.x; if (nk_do_button_symbol(&ws, out, button, style->dec_symbol, NK_BUTTON_REPEATER, &style->dec_button, in, font)) offset = offset - scroll_step; /* increment button */ button.x = scroll.x + scroll.w - button.w; if (nk_do_button_symbol(&ws, out, button, style->inc_symbol, NK_BUTTON_REPEATER, &style->inc_button, in, font)) offset = offset + scroll_step; scroll.x = scroll.x + button.w; scroll.w = scroll_w; } /* calculate scrollbar constants */ scroll_step = NK_MIN(step, scroll.w); scroll_offset = NK_CLAMP(0, offset, target - scroll.w); scroll_ratio = scroll.w / target; scroll_off = scroll_offset / target; /* calculate cursor bounds */ cursor.w = (scroll_ratio * scroll.w) - (2*style->border + 2*style->padding.x); cursor.x = scroll.x + (scroll_off * scroll.w) + style->border + style->padding.x; cursor.h = scroll.h - (2 * style->border + 2 * style->padding.y); cursor.y = scroll.y + style->border + style->padding.y; /* calculate empty space around cursor */ empty_west.x = scroll.x; empty_west.y = scroll.y; empty_west.w = cursor.x - scroll.x; empty_west.h = scroll.h; empty_east.x = cursor.x + cursor.w; empty_east.y = scroll.y; empty_east.w = (scroll.x + scroll.w) - (cursor.x + cursor.w); empty_east.h = scroll.h; /* update scrollbar */ scroll_offset = nk_scrollbar_behavior(state, in, has_scrolling, &scroll, &cursor, &empty_west, &empty_east, scroll_offset, target, scroll_step, NK_HORIZONTAL); scroll_off = scroll_offset / target; cursor.x = scroll.x + (scroll_off * scroll.w); /* draw scrollbar */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_scrollbar(out, *state, style, &scroll, &cursor); if (style->draw_end) style->draw_end(out, style->userdata); return scroll_offset; } /* =============================================================== * * TEXT EDITOR * * ===============================================================*/ /* stb_textedit.h - v1.8 - public domain - Sean Barrett */ struct nk_text_find { float x,y; /* position of n'th character */ float height; /* height of line */ int first_char, length; /* first char of row, and length */ int prev_first; /*_ first char of previous row */ }; struct nk_text_edit_row { float x0,x1; /* starting x location, end x location (allows for align=right, etc) */ float baseline_y_delta; /* position of baseline relative to previous row's baseline*/ float ymin,ymax; /* height of row above and below baseline */ int num_chars; }; /* forward declarations */ NK_INTERN void nk_textedit_makeundo_delete(struct nk_text_edit*, int, int); NK_INTERN void nk_textedit_makeundo_insert(struct nk_text_edit*, int, int); NK_INTERN void nk_textedit_makeundo_replace(struct nk_text_edit*, int, int, int); #define NK_TEXT_HAS_SELECTION(s) ((s)->select_start != (s)->select_end) NK_INTERN float nk_textedit_get_width(const struct nk_text_edit *edit, int line_start, int char_id, const struct nk_user_font *font) { int len = 0; nk_rune unicode = 0; const char *str = nk_str_at_const(&edit->string, line_start + char_id, &unicode, &len); return font->width(font->userdata, font->height, str, len); } NK_INTERN void nk_textedit_layout_row(struct nk_text_edit_row *r, struct nk_text_edit *edit, int line_start_id, float row_height, const struct nk_user_font *font) { int l; int glyphs = 0; nk_rune unicode; const char *remaining; int len = nk_str_len_char(&edit->string); const char *end = nk_str_get_const(&edit->string) + len; const char *text = nk_str_at_const(&edit->string, line_start_id, &unicode, &l); const struct nk_vec2 size = nk_text_calculate_text_bounds(font, text, (int)(end - text), row_height, &remaining, 0, &glyphs, NK_STOP_ON_NEW_LINE); r->x0 = 0.0f; r->x1 = size.x; r->baseline_y_delta = size.y; r->ymin = 0.0f; r->ymax = size.y; r->num_chars = glyphs; } NK_INTERN int nk_textedit_locate_coord(struct nk_text_edit *edit, float x, float y, const struct nk_user_font *font, float row_height) { struct nk_text_edit_row r; int n = edit->string.len; float base_y = 0, prev_x; int i=0, k; r.x0 = r.x1 = 0; r.ymin = r.ymax = 0; r.num_chars = 0; /* search rows to find one that straddles 'y' */ while (i < n) { nk_textedit_layout_row(&r, edit, i, row_height, font); if (r.num_chars <= 0) return n; if (i==0 && y < base_y + r.ymin) return 0; if (y < base_y + r.ymax) break; i += r.num_chars; base_y += r.baseline_y_delta; } /* below all text, return 'after' last character */ if (i >= n) return n; /* check if it's before the beginning of the line */ if (x < r.x0) return i; /* check if it's before the end of the line */ if (x < r.x1) { /* search characters in row for one that straddles 'x' */ k = i; prev_x = r.x0; for (i=0; i < r.num_chars; ++i) { float w = nk_textedit_get_width(edit, k, i, font); if (x < prev_x+w) { if (x < prev_x+w/2) return k+i; else return k+i+1; } prev_x += w; } /* shouldn't happen, but if it does, fall through to end-of-line case */ } /* if the last character is a newline, return that. * otherwise return 'after' the last character */ if (nk_str_rune_at(&edit->string, i+r.num_chars-1) == '\n') return i+r.num_chars-1; else return i+r.num_chars; } NK_LIB void nk_textedit_click(struct nk_text_edit *state, float x, float y, const struct nk_user_font *font, float row_height) { /* API click: on mouse down, move the cursor to the clicked location, * and reset the selection */ state->cursor = nk_textedit_locate_coord(state, x, y, font, row_height); state->select_start = state->cursor; state->select_end = state->cursor; state->has_preferred_x = 0; } NK_LIB void nk_textedit_drag(struct nk_text_edit *state, float x, float y, const struct nk_user_font *font, float row_height) { /* API drag: on mouse drag, move the cursor and selection endpoint * to the clicked location */ int p = nk_textedit_locate_coord(state, x, y, font, row_height); if (state->select_start == state->select_end) state->select_start = state->cursor; state->cursor = state->select_end = p; } NK_INTERN void nk_textedit_find_charpos(struct nk_text_find *find, struct nk_text_edit *state, int n, int single_line, const struct nk_user_font *font, float row_height) { /* find the x/y location of a character, and remember info about the previous * row in case we get a move-up event (for page up, we'll have to rescan) */ struct nk_text_edit_row r; int prev_start = 0; int z = state->string.len; int i=0, first; nk_zero_struct(r); if (n == z) { /* if it's at the end, then find the last line -- simpler than trying to explicitly handle this case in the regular code */ nk_textedit_layout_row(&r, state, 0, row_height, font); if (single_line) { find->first_char = 0; find->length = z; } else { while (i < z) { prev_start = i; i += r.num_chars; nk_textedit_layout_row(&r, state, i, row_height, font); } find->first_char = i; find->length = r.num_chars; } find->x = r.x1; find->y = r.ymin; find->height = r.ymax - r.ymin; find->prev_first = prev_start; return; } /* search rows to find the one that straddles character n */ find->y = 0; for(;;) { nk_textedit_layout_row(&r, state, i, row_height, font); if (n < i + r.num_chars) break; prev_start = i; i += r.num_chars; find->y += r.baseline_y_delta; } find->first_char = first = i; find->length = r.num_chars; find->height = r.ymax - r.ymin; find->prev_first = prev_start; /* now scan to find xpos */ find->x = r.x0; for (i=0; first+i < n; ++i) find->x += nk_textedit_get_width(state, first, i, font); } NK_INTERN void nk_textedit_clamp(struct nk_text_edit *state) { /* make the selection/cursor state valid if client altered the string */ int n = state->string.len; if (NK_TEXT_HAS_SELECTION(state)) { if (state->select_start > n) state->select_start = n; if (state->select_end > n) state->select_end = n; /* if clamping forced them to be equal, move the cursor to match */ if (state->select_start == state->select_end) state->cursor = state->select_start; } if (state->cursor > n) state->cursor = n; } NK_API void nk_textedit_delete(struct nk_text_edit *state, int where, int len) { /* delete characters while updating undo */ nk_textedit_makeundo_delete(state, where, len); nk_str_delete_runes(&state->string, where, len); state->has_preferred_x = 0; } NK_API void nk_textedit_delete_selection(struct nk_text_edit *state) { /* delete the section */ nk_textedit_clamp(state); if (NK_TEXT_HAS_SELECTION(state)) { if (state->select_start < state->select_end) { nk_textedit_delete(state, state->select_start, state->select_end - state->select_start); state->select_end = state->cursor = state->select_start; } else { nk_textedit_delete(state, state->select_end, state->select_start - state->select_end); state->select_start = state->cursor = state->select_end; } state->has_preferred_x = 0; } } NK_INTERN void nk_textedit_sortselection(struct nk_text_edit *state) { /* canonicalize the selection so start <= end */ if (state->select_end < state->select_start) { int temp = state->select_end; state->select_end = state->select_start; state->select_start = temp; } } NK_INTERN void nk_textedit_move_to_first(struct nk_text_edit *state) { /* move cursor to first character of selection */ if (NK_TEXT_HAS_SELECTION(state)) { nk_textedit_sortselection(state); state->cursor = state->select_start; state->select_end = state->select_start; state->has_preferred_x = 0; } } NK_INTERN void nk_textedit_move_to_last(struct nk_text_edit *state) { /* move cursor to last character of selection */ if (NK_TEXT_HAS_SELECTION(state)) { nk_textedit_sortselection(state); nk_textedit_clamp(state); state->cursor = state->select_end; state->select_start = state->select_end; state->has_preferred_x = 0; } } NK_INTERN int nk_is_word_boundary( struct nk_text_edit *state, int idx) { int len; nk_rune c; if (idx <= 0) return 1; if (!nk_str_at_rune(&state->string, idx, &c, &len)) return 1; return (c == ' ' || c == '\t' ||c == 0x3000 || c == ',' || c == ';' || c == '(' || c == ')' || c == '{' || c == '}' || c == '[' || c == ']' || c == '|'); } NK_INTERN int nk_textedit_move_to_word_previous(struct nk_text_edit *state) { int c = state->cursor - 1; while( c >= 0 && !nk_is_word_boundary(state, c)) --c; if( c < 0 ) c = 0; return c; } NK_INTERN int nk_textedit_move_to_word_next(struct nk_text_edit *state) { const int len = state->string.len; int c = state->cursor+1; while( c < len && !nk_is_word_boundary(state, c)) ++c; if( c > len ) c = len; return c; } NK_INTERN void nk_textedit_prep_selection_at_cursor(struct nk_text_edit *state) { /* update selection and cursor to match each other */ if (!NK_TEXT_HAS_SELECTION(state)) state->select_start = state->select_end = state->cursor; else state->cursor = state->select_end; } NK_API int nk_textedit_cut(struct nk_text_edit *state) { /* API cut: delete selection */ if (state->mode == NK_TEXT_EDIT_MODE_VIEW) return 0; if (NK_TEXT_HAS_SELECTION(state)) { nk_textedit_delete_selection(state); /* implicitly clamps */ state->has_preferred_x = 0; return 1; } return 0; } NK_API int nk_textedit_paste(struct nk_text_edit *state, char const *ctext, int len) { /* API paste: replace existing selection with passed-in text */ int glyphs; const char *text = (const char *) ctext; if (state->mode == NK_TEXT_EDIT_MODE_VIEW) return 0; /* if there's a selection, the paste should delete it */ nk_textedit_clamp(state); nk_textedit_delete_selection(state); /* try to insert the characters */ glyphs = nk_utf_len(ctext, len); if (nk_str_insert_text_char(&state->string, state->cursor, text, len)) { nk_textedit_makeundo_insert(state, state->cursor, glyphs); state->cursor += len; state->has_preferred_x = 0; return 1; } /* remove the undo since we didn't actually insert the characters */ if (state->undo.undo_point) --state->undo.undo_point; return 0; } NK_API void nk_textedit_text(struct nk_text_edit *state, const char *text, int total_len) { nk_rune unicode; int glyph_len; int text_len = 0; NK_ASSERT(state); NK_ASSERT(text); if (!text || !total_len || state->mode == NK_TEXT_EDIT_MODE_VIEW) return; glyph_len = nk_utf_decode(text, &unicode, total_len); while ((text_len < total_len) && glyph_len) { /* don't insert a backward delete, just process the event */ if (unicode == 127) goto next; /* can't add newline in single-line mode */ if (unicode == '\n' && state->single_line) goto next; /* filter incoming text */ if (state->filter && !state->filter(state, unicode)) goto next; if (!NK_TEXT_HAS_SELECTION(state) && state->cursor < state->string.len) { if (state->mode == NK_TEXT_EDIT_MODE_REPLACE) { nk_textedit_makeundo_replace(state, state->cursor, 1, 1); nk_str_delete_runes(&state->string, state->cursor, 1); } if (nk_str_insert_text_utf8(&state->string, state->cursor, text+text_len, 1)) { ++state->cursor; state->has_preferred_x = 0; } } else { nk_textedit_delete_selection(state); /* implicitly clamps */ if (nk_str_insert_text_utf8(&state->string, state->cursor, text+text_len, 1)) { nk_textedit_makeundo_insert(state, state->cursor, 1); ++state->cursor; state->has_preferred_x = 0; } } next: text_len += glyph_len; glyph_len = nk_utf_decode(text + text_len, &unicode, total_len-text_len); } } NK_LIB void nk_textedit_key(struct nk_text_edit *state, enum nk_keys key, int shift_mod, const struct nk_user_font *font, float row_height) { retry: switch (key) { case NK_KEY_NONE: case NK_KEY_CTRL: case NK_KEY_ENTER: case NK_KEY_SHIFT: case NK_KEY_TAB: case NK_KEY_COPY: case NK_KEY_CUT: case NK_KEY_PASTE: case NK_KEY_MAX: default: break; case NK_KEY_TEXT_UNDO: nk_textedit_undo(state); state->has_preferred_x = 0; break; case NK_KEY_TEXT_REDO: nk_textedit_redo(state); state->has_preferred_x = 0; break; case NK_KEY_TEXT_SELECT_ALL: nk_textedit_select_all(state); state->has_preferred_x = 0; break; case NK_KEY_TEXT_INSERT_MODE: if (state->mode == NK_TEXT_EDIT_MODE_VIEW) state->mode = NK_TEXT_EDIT_MODE_INSERT; break; case NK_KEY_TEXT_REPLACE_MODE: if (state->mode == NK_TEXT_EDIT_MODE_VIEW) state->mode = NK_TEXT_EDIT_MODE_REPLACE; break; case NK_KEY_TEXT_RESET_MODE: if (state->mode == NK_TEXT_EDIT_MODE_INSERT || state->mode == NK_TEXT_EDIT_MODE_REPLACE) state->mode = NK_TEXT_EDIT_MODE_VIEW; break; case NK_KEY_LEFT: if (shift_mod) { nk_textedit_clamp(state); nk_textedit_prep_selection_at_cursor(state); /* move selection left */ if (state->select_end > 0) --state->select_end; state->cursor = state->select_end; state->has_preferred_x = 0; } else { /* if currently there's a selection, * move cursor to start of selection */ if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_move_to_first(state); else if (state->cursor > 0) --state->cursor; state->has_preferred_x = 0; } break; case NK_KEY_RIGHT: if (shift_mod) { nk_textedit_prep_selection_at_cursor(state); /* move selection right */ ++state->select_end; nk_textedit_clamp(state); state->cursor = state->select_end; state->has_preferred_x = 0; } else { /* if currently there's a selection, * move cursor to end of selection */ if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_move_to_last(state); else ++state->cursor; nk_textedit_clamp(state); state->has_preferred_x = 0; } break; case NK_KEY_TEXT_WORD_LEFT: if (shift_mod) { if( !NK_TEXT_HAS_SELECTION( state ) ) nk_textedit_prep_selection_at_cursor(state); state->cursor = nk_textedit_move_to_word_previous(state); state->select_end = state->cursor; nk_textedit_clamp(state ); } else { if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_move_to_first(state); else { state->cursor = nk_textedit_move_to_word_previous(state); nk_textedit_clamp(state ); } } break; case NK_KEY_TEXT_WORD_RIGHT: if (shift_mod) { if( !NK_TEXT_HAS_SELECTION( state ) ) nk_textedit_prep_selection_at_cursor(state); state->cursor = nk_textedit_move_to_word_next(state); state->select_end = state->cursor; nk_textedit_clamp(state); } else { if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_move_to_last(state); else { state->cursor = nk_textedit_move_to_word_next(state); nk_textedit_clamp(state ); } } break; case NK_KEY_DOWN: { struct nk_text_find find; struct nk_text_edit_row row; int i, sel = shift_mod; if (state->single_line) { /* on windows, up&down in single-line behave like left&right */ key = NK_KEY_RIGHT; goto retry; } if (sel) nk_textedit_prep_selection_at_cursor(state); else if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_move_to_last(state); /* compute current position of cursor point */ nk_textedit_clamp(state); nk_textedit_find_charpos(&find, state, state->cursor, state->single_line, font, row_height); /* now find character position down a row */ if (find.length) { float x; float goal_x = state->has_preferred_x ? state->preferred_x : find.x; int start = find.first_char + find.length; state->cursor = start; nk_textedit_layout_row(&row, state, state->cursor, row_height, font); x = row.x0; for (i=0; i < row.num_chars && x < row.x1; ++i) { float dx = nk_textedit_get_width(state, start, i, font); x += dx; if (x > goal_x) break; ++state->cursor; } nk_textedit_clamp(state); state->has_preferred_x = 1; state->preferred_x = goal_x; if (sel) state->select_end = state->cursor; } } break; case NK_KEY_UP: { struct nk_text_find find; struct nk_text_edit_row row; int i, sel = shift_mod; if (state->single_line) { /* on windows, up&down become left&right */ key = NK_KEY_LEFT; goto retry; } if (sel) nk_textedit_prep_selection_at_cursor(state); else if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_move_to_first(state); /* compute current position of cursor point */ nk_textedit_clamp(state); nk_textedit_find_charpos(&find, state, state->cursor, state->single_line, font, row_height); /* can only go up if there's a previous row */ if (find.prev_first != find.first_char) { /* now find character position up a row */ float x; float goal_x = state->has_preferred_x ? state->preferred_x : find.x; state->cursor = find.prev_first; nk_textedit_layout_row(&row, state, state->cursor, row_height, font); x = row.x0; for (i=0; i < row.num_chars && x < row.x1; ++i) { float dx = nk_textedit_get_width(state, find.prev_first, i, font); x += dx; if (x > goal_x) break; ++state->cursor; } nk_textedit_clamp(state); state->has_preferred_x = 1; state->preferred_x = goal_x; if (sel) state->select_end = state->cursor; } } break; case NK_KEY_DEL: if (state->mode == NK_TEXT_EDIT_MODE_VIEW) break; if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_delete_selection(state); else { int n = state->string.len; if (state->cursor < n) nk_textedit_delete(state, state->cursor, 1); } state->has_preferred_x = 0; break; case NK_KEY_BACKSPACE: if (state->mode == NK_TEXT_EDIT_MODE_VIEW) break; if (NK_TEXT_HAS_SELECTION(state)) nk_textedit_delete_selection(state); else { nk_textedit_clamp(state); if (state->cursor > 0) { nk_textedit_delete(state, state->cursor-1, 1); --state->cursor; } } state->has_preferred_x = 0; break; case NK_KEY_TEXT_START: if (shift_mod) { nk_textedit_prep_selection_at_cursor(state); state->cursor = state->select_end = 0; state->has_preferred_x = 0; } else { state->cursor = state->select_start = state->select_end = 0; state->has_preferred_x = 0; } break; case NK_KEY_TEXT_END: if (shift_mod) { nk_textedit_prep_selection_at_cursor(state); state->cursor = state->select_end = state->string.len; state->has_preferred_x = 0; } else { state->cursor = state->string.len; state->select_start = state->select_end = 0; state->has_preferred_x = 0; } break; case NK_KEY_TEXT_LINE_START: { if (shift_mod) { struct nk_text_find find; nk_textedit_clamp(state); nk_textedit_prep_selection_at_cursor(state); if (state->string.len && state->cursor == state->string.len) --state->cursor; nk_textedit_find_charpos(&find, state,state->cursor, state->single_line, font, row_height); state->cursor = state->select_end = find.first_char; state->has_preferred_x = 0; } else { struct nk_text_find find; if (state->string.len && state->cursor == state->string.len) --state->cursor; nk_textedit_clamp(state); nk_textedit_move_to_first(state); nk_textedit_find_charpos(&find, state, state->cursor, state->single_line, font, row_height); state->cursor = find.first_char; state->has_preferred_x = 0; } } break; case NK_KEY_TEXT_LINE_END: { if (shift_mod) { struct nk_text_find find; nk_textedit_clamp(state); nk_textedit_prep_selection_at_cursor(state); nk_textedit_find_charpos(&find, state, state->cursor, state->single_line, font, row_height); state->has_preferred_x = 0; state->cursor = find.first_char + find.length; if (find.length > 0 && nk_str_rune_at(&state->string, state->cursor-1) == '\n') --state->cursor; state->select_end = state->cursor; } else { struct nk_text_find find; nk_textedit_clamp(state); nk_textedit_move_to_first(state); nk_textedit_find_charpos(&find, state, state->cursor, state->single_line, font, row_height); state->has_preferred_x = 0; state->cursor = find.first_char + find.length; if (find.length > 0 && nk_str_rune_at(&state->string, state->cursor-1) == '\n') --state->cursor; }} break; } } NK_INTERN void nk_textedit_flush_redo(struct nk_text_undo_state *state) { state->redo_point = NK_TEXTEDIT_UNDOSTATECOUNT; state->redo_char_point = NK_TEXTEDIT_UNDOCHARCOUNT; } NK_INTERN void nk_textedit_discard_undo(struct nk_text_undo_state *state) { /* discard the oldest entry in the undo list */ if (state->undo_point > 0) { /* if the 0th undo state has characters, clean those up */ if (state->undo_rec[0].char_storage >= 0) { int n = state->undo_rec[0].insert_length, i; /* delete n characters from all other records */ state->undo_char_point = (short)(state->undo_char_point - n); NK_MEMCPY(state->undo_char, state->undo_char + n, (nk_size)state->undo_char_point*sizeof(nk_rune)); for (i=0; i < state->undo_point; ++i) { if (state->undo_rec[i].char_storage >= 0) state->undo_rec[i].char_storage = (short) (state->undo_rec[i].char_storage - n); } } --state->undo_point; NK_MEMCPY(state->undo_rec, state->undo_rec+1, (nk_size)((nk_size)state->undo_point * sizeof(state->undo_rec[0]))); } } NK_INTERN void nk_textedit_discard_redo(struct nk_text_undo_state *state) { /* discard the oldest entry in the redo list--it's bad if this ever happens, but because undo & redo have to store the actual characters in different cases, the redo character buffer can fill up even though the undo buffer didn't */ nk_size num; int k = NK_TEXTEDIT_UNDOSTATECOUNT-1; if (state->redo_point <= k) { /* if the k'th undo state has characters, clean those up */ if (state->undo_rec[k].char_storage >= 0) { int n = state->undo_rec[k].insert_length, i; /* delete n characters from all other records */ state->redo_char_point = (short)(state->redo_char_point + n); num = (nk_size)(NK_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point); NK_MEMCPY(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, num * sizeof(char)); for (i = state->redo_point; i < k; ++i) { if (state->undo_rec[i].char_storage >= 0) { state->undo_rec[i].char_storage = (short) (state->undo_rec[i].char_storage + n); } } } ++state->redo_point; num = (nk_size)(NK_TEXTEDIT_UNDOSTATECOUNT - state->redo_point); if (num) NK_MEMCPY(state->undo_rec + state->redo_point-1, state->undo_rec + state->redo_point, num * sizeof(state->undo_rec[0])); } } NK_INTERN struct nk_text_undo_record* nk_textedit_create_undo_record(struct nk_text_undo_state *state, int numchars) { /* any time we create a new undo record, we discard redo*/ nk_textedit_flush_redo(state); /* if we have no free records, we have to make room, * by sliding the existing records down */ if (state->undo_point == NK_TEXTEDIT_UNDOSTATECOUNT) nk_textedit_discard_undo(state); /* if the characters to store won't possibly fit in the buffer, * we can't undo */ if (numchars > NK_TEXTEDIT_UNDOCHARCOUNT) { state->undo_point = 0; state->undo_char_point = 0; return 0; } /* if we don't have enough free characters in the buffer, * we have to make room */ while (state->undo_char_point + numchars > NK_TEXTEDIT_UNDOCHARCOUNT) nk_textedit_discard_undo(state); return &state->undo_rec[state->undo_point++]; } NK_INTERN nk_rune* nk_textedit_createundo(struct nk_text_undo_state *state, int pos, int insert_len, int delete_len) { struct nk_text_undo_record *r = nk_textedit_create_undo_record(state, insert_len); if (r == 0) return 0; r->where = pos; r->insert_length = (short) insert_len; r->delete_length = (short) delete_len; if (insert_len == 0) { r->char_storage = -1; return 0; } else { r->char_storage = state->undo_char_point; state->undo_char_point = (short)(state->undo_char_point + insert_len); return &state->undo_char[r->char_storage]; } } NK_API void nk_textedit_undo(struct nk_text_edit *state) { struct nk_text_undo_state *s = &state->undo; struct nk_text_undo_record u, *r; if (s->undo_point == 0) return; /* we need to do two things: apply the undo record, and create a redo record */ u = s->undo_rec[s->undo_point-1]; r = &s->undo_rec[s->redo_point-1]; r->char_storage = -1; r->insert_length = u.delete_length; r->delete_length = u.insert_length; r->where = u.where; if (u.delete_length) { /* if the undo record says to delete characters, then the redo record will need to re-insert the characters that get deleted, so we need to store them. there are three cases: - there's enough room to store the characters - characters stored for *redoing* don't leave room for redo - characters stored for *undoing* don't leave room for redo if the last is true, we have to bail */ if (s->undo_char_point + u.delete_length >= NK_TEXTEDIT_UNDOCHARCOUNT) { /* the undo records take up too much character space; there's no space * to store the redo characters */ r->insert_length = 0; } else { int i; /* there's definitely room to store the characters eventually */ while (s->undo_char_point + u.delete_length > s->redo_char_point) { /* there's currently not enough room, so discard a redo record */ nk_textedit_discard_redo(s); /* should never happen: */ if (s->redo_point == NK_TEXTEDIT_UNDOSTATECOUNT) return; } r = &s->undo_rec[s->redo_point-1]; r->char_storage = (short)(s->redo_char_point - u.delete_length); s->redo_char_point = (short)(s->redo_char_point - u.delete_length); /* now save the characters */ for (i=0; i < u.delete_length; ++i) s->undo_char[r->char_storage + i] = nk_str_rune_at(&state->string, u.where + i); } /* now we can carry out the deletion */ nk_str_delete_runes(&state->string, u.where, u.delete_length); } /* check type of recorded action: */ if (u.insert_length) { /* easy case: was a deletion, so we need to insert n characters */ nk_str_insert_text_runes(&state->string, u.where, &s->undo_char[u.char_storage], u.insert_length); s->undo_char_point = (short)(s->undo_char_point - u.insert_length); } state->cursor = (short)(u.where + u.insert_length); s->undo_point--; s->redo_point--; } NK_API void nk_textedit_redo(struct nk_text_edit *state) { struct nk_text_undo_state *s = &state->undo; struct nk_text_undo_record *u, r; if (s->redo_point == NK_TEXTEDIT_UNDOSTATECOUNT) return; /* we need to do two things: apply the redo record, and create an undo record */ u = &s->undo_rec[s->undo_point]; r = s->undo_rec[s->redo_point]; /* we KNOW there must be room for the undo record, because the redo record was derived from an undo record */ u->delete_length = r.insert_length; u->insert_length = r.delete_length; u->where = r.where; u->char_storage = -1; if (r.delete_length) { /* the redo record requires us to delete characters, so the undo record needs to store the characters */ if (s->undo_char_point + u->insert_length > s->redo_char_point) { u->insert_length = 0; u->delete_length = 0; } else { int i; u->char_storage = s->undo_char_point; s->undo_char_point = (short)(s->undo_char_point + u->insert_length); /* now save the characters */ for (i=0; i < u->insert_length; ++i) { s->undo_char[u->char_storage + i] = nk_str_rune_at(&state->string, u->where + i); } } nk_str_delete_runes(&state->string, r.where, r.delete_length); } if (r.insert_length) { /* easy case: need to insert n characters */ nk_str_insert_text_runes(&state->string, r.where, &s->undo_char[r.char_storage], r.insert_length); } state->cursor = r.where + r.insert_length; s->undo_point++; s->redo_point++; } NK_INTERN void nk_textedit_makeundo_insert(struct nk_text_edit *state, int where, int length) { nk_textedit_createundo(&state->undo, where, 0, length); } NK_INTERN void nk_textedit_makeundo_delete(struct nk_text_edit *state, int where, int length) { int i; nk_rune *p = nk_textedit_createundo(&state->undo, where, length, 0); if (p) { for (i=0; i < length; ++i) p[i] = nk_str_rune_at(&state->string, where+i); } } NK_INTERN void nk_textedit_makeundo_replace(struct nk_text_edit *state, int where, int old_length, int new_length) { int i; nk_rune *p = nk_textedit_createundo(&state->undo, where, old_length, new_length); if (p) { for (i=0; i < old_length; ++i) p[i] = nk_str_rune_at(&state->string, where+i); } } NK_LIB void nk_textedit_clear_state(struct nk_text_edit *state, enum nk_text_edit_type type, nk_plugin_filter filter) { /* reset the state to default */ state->undo.undo_point = 0; state->undo.undo_char_point = 0; state->undo.redo_point = NK_TEXTEDIT_UNDOSTATECOUNT; state->undo.redo_char_point = NK_TEXTEDIT_UNDOCHARCOUNT; state->select_end = state->select_start = 0; state->cursor = 0; state->has_preferred_x = 0; state->preferred_x = 0; state->cursor_at_end_of_line = 0; state->initialized = 1; state->single_line = (unsigned char)(type == NK_TEXT_EDIT_SINGLE_LINE); state->mode = NK_TEXT_EDIT_MODE_VIEW; state->filter = filter; state->scrollbar = nk_vec2(0,0); } NK_API void nk_textedit_init_fixed(struct nk_text_edit *state, void *memory, nk_size size) { NK_ASSERT(state); NK_ASSERT(memory); if (!state || !memory || !size) return; NK_MEMSET(state, 0, sizeof(struct nk_text_edit)); nk_textedit_clear_state(state, NK_TEXT_EDIT_SINGLE_LINE, 0); nk_str_init_fixed(&state->string, memory, size); } NK_API void nk_textedit_init(struct nk_text_edit *state, struct nk_allocator *alloc, nk_size size) { NK_ASSERT(state); NK_ASSERT(alloc); if (!state || !alloc) return; NK_MEMSET(state, 0, sizeof(struct nk_text_edit)); nk_textedit_clear_state(state, NK_TEXT_EDIT_SINGLE_LINE, 0); nk_str_init(&state->string, alloc, size); } #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API void nk_textedit_init_default(struct nk_text_edit *state) { NK_ASSERT(state); if (!state) return; NK_MEMSET(state, 0, sizeof(struct nk_text_edit)); nk_textedit_clear_state(state, NK_TEXT_EDIT_SINGLE_LINE, 0); nk_str_init_default(&state->string); } #endif NK_API void nk_textedit_select_all(struct nk_text_edit *state) { NK_ASSERT(state); state->select_start = 0; state->select_end = state->string.len; } NK_API void nk_textedit_free(struct nk_text_edit *state) { NK_ASSERT(state); if (!state) return; nk_str_free(&state->string); } /* =============================================================== * * FILTER * * ===============================================================*/ NK_API int nk_filter_default(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(unicode); NK_UNUSED(box); return nk_true; } NK_API int nk_filter_ascii(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(box); if (unicode > 128) return nk_false; else return nk_true; } NK_API int nk_filter_float(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(box); if ((unicode < '0' || unicode > '9') && unicode != '.' && unicode != '-') return nk_false; else return nk_true; } NK_API int nk_filter_decimal(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(box); if ((unicode < '0' || unicode > '9') && unicode != '-') return nk_false; else return nk_true; } NK_API int nk_filter_hex(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(box); if ((unicode < '0' || unicode > '9') && (unicode < 'a' || unicode > 'f') && (unicode < 'A' || unicode > 'F')) return nk_false; else return nk_true; } NK_API int nk_filter_oct(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(box); if (unicode < '0' || unicode > '7') return nk_false; else return nk_true; } NK_API int nk_filter_binary(const struct nk_text_edit *box, nk_rune unicode) { NK_UNUSED(box); if (unicode != '0' && unicode != '1') return nk_false; else return nk_true; } /* =============================================================== * * EDIT * * ===============================================================*/ NK_LIB void nk_edit_draw_text(struct nk_command_buffer *out, const struct nk_style_edit *style, float pos_x, float pos_y, float x_offset, const char *text, int byte_len, float row_height, const struct nk_user_font *font, struct nk_color background, struct nk_color foreground, int is_selected) { NK_ASSERT(out); NK_ASSERT(font); NK_ASSERT(style); if (!text || !byte_len || !out || !style) return; {int glyph_len = 0; nk_rune unicode = 0; int text_len = 0; float line_width = 0; float glyph_width; const char *line = text; float line_offset = 0; int line_count = 0; struct nk_text txt; txt.padding = nk_vec2(0,0); txt.background = background; txt.text = foreground; glyph_len = nk_utf_decode(text+text_len, &unicode, byte_len-text_len); if (!glyph_len) return; while ((text_len < byte_len) && glyph_len) { if (unicode == '\n') { /* new line separator so draw previous line */ struct nk_rect label; label.y = pos_y + line_offset; label.h = row_height; label.w = line_width; label.x = pos_x; if (!line_count) label.x += x_offset; if (is_selected) /* selection needs to draw different background color */ nk_fill_rect(out, label, 0, background); nk_widget_text(out, label, line, (int)((text + text_len) - line), &txt, NK_TEXT_CENTERED, font); text_len++; line_count++; line_width = 0; line = text + text_len; line_offset += row_height; glyph_len = nk_utf_decode(text + text_len, &unicode, (int)(byte_len-text_len)); continue; } if (unicode == '\r') { text_len++; glyph_len = nk_utf_decode(text + text_len, &unicode, byte_len-text_len); continue; } glyph_width = font->width(font->userdata, font->height, text+text_len, glyph_len); line_width += (float)glyph_width; text_len += glyph_len; glyph_len = nk_utf_decode(text + text_len, &unicode, byte_len-text_len); continue; } if (line_width > 0) { /* draw last line */ struct nk_rect label; label.y = pos_y + line_offset; label.h = row_height; label.w = line_width; label.x = pos_x; if (!line_count) label.x += x_offset; if (is_selected) nk_fill_rect(out, label, 0, background); nk_widget_text(out, label, line, (int)((text + text_len) - line), &txt, NK_TEXT_LEFT, font); }} } NK_LIB nk_flags nk_do_edit(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, nk_flags flags, nk_plugin_filter filter, struct nk_text_edit *edit, const struct nk_style_edit *style, struct nk_input *in, const struct nk_user_font *font) { struct nk_rect area; nk_flags ret = 0; float row_height; char prev_state = 0; char is_hovered = 0; char select_all = 0; char cursor_follow = 0; struct nk_rect old_clip; struct nk_rect clip; NK_ASSERT(state); NK_ASSERT(out); NK_ASSERT(style); if (!state || !out || !style) return ret; /* visible text area calculation */ area.x = bounds.x + style->padding.x + style->border; area.y = bounds.y + style->padding.y + style->border; area.w = bounds.w - (2.0f * style->padding.x + 2 * style->border); area.h = bounds.h - (2.0f * style->padding.y + 2 * style->border); if (flags & NK_EDIT_MULTILINE) area.w = NK_MAX(0, area.w - style->scrollbar_size.x); row_height = (flags & NK_EDIT_MULTILINE)? font->height + style->row_padding: area.h; /* calculate clipping rectangle */ old_clip = out->clip; nk_unify(&clip, &old_clip, area.x, area.y, area.x + area.w, area.y + area.h); /* update edit state */ prev_state = (char)edit->active; is_hovered = (char)nk_input_is_mouse_hovering_rect(in, bounds); if (in && in->mouse.buttons[NK_BUTTON_LEFT].clicked && in->mouse.buttons[NK_BUTTON_LEFT].down) { edit->active = NK_INBOX(in->mouse.pos.x, in->mouse.pos.y, bounds.x, bounds.y, bounds.w, bounds.h); } /* (de)activate text editor */ if (!prev_state && edit->active) { const enum nk_text_edit_type type = (flags & NK_EDIT_MULTILINE) ? NK_TEXT_EDIT_MULTI_LINE: NK_TEXT_EDIT_SINGLE_LINE; nk_textedit_clear_state(edit, type, filter); if (flags & NK_EDIT_AUTO_SELECT) select_all = nk_true; if (flags & NK_EDIT_GOTO_END_ON_ACTIVATE) { edit->cursor = edit->string.len; in = 0; } } else if (!edit->active) edit->mode = NK_TEXT_EDIT_MODE_VIEW; if (flags & NK_EDIT_READ_ONLY) edit->mode = NK_TEXT_EDIT_MODE_VIEW; else if (flags & NK_EDIT_ALWAYS_INSERT_MODE) edit->mode = NK_TEXT_EDIT_MODE_INSERT; ret = (edit->active) ? NK_EDIT_ACTIVE: NK_EDIT_INACTIVE; if (prev_state != edit->active) ret |= (edit->active) ? NK_EDIT_ACTIVATED: NK_EDIT_DEACTIVATED; /* handle user input */ if (edit->active && in) { int shift_mod = in->keyboard.keys[NK_KEY_SHIFT].down; const float mouse_x = (in->mouse.pos.x - area.x) + edit->scrollbar.x; const float mouse_y = (in->mouse.pos.y - area.y) + edit->scrollbar.y; /* mouse click handler */ is_hovered = (char)nk_input_is_mouse_hovering_rect(in, area); if (select_all) { nk_textedit_select_all(edit); } else if (is_hovered && in->mouse.buttons[NK_BUTTON_LEFT].down && in->mouse.buttons[NK_BUTTON_LEFT].clicked) { nk_textedit_click(edit, mouse_x, mouse_y, font, row_height); } else if (is_hovered && in->mouse.buttons[NK_BUTTON_LEFT].down && (in->mouse.delta.x != 0.0f || in->mouse.delta.y != 0.0f)) { nk_textedit_drag(edit, mouse_x, mouse_y, font, row_height); cursor_follow = nk_true; } else if (is_hovered && in->mouse.buttons[NK_BUTTON_RIGHT].clicked && in->mouse.buttons[NK_BUTTON_RIGHT].down) { nk_textedit_key(edit, NK_KEY_TEXT_WORD_LEFT, nk_false, font, row_height); nk_textedit_key(edit, NK_KEY_TEXT_WORD_RIGHT, nk_true, font, row_height); cursor_follow = nk_true; } {int i; /* keyboard input */ int old_mode = edit->mode; for (i = 0; i < NK_KEY_MAX; ++i) { if (i == NK_KEY_ENTER || i == NK_KEY_TAB) continue; /* special case */ if (nk_input_is_key_pressed(in, (enum nk_keys)i)) { nk_textedit_key(edit, (enum nk_keys)i, shift_mod, font, row_height); cursor_follow = nk_true; } } if (old_mode != edit->mode) { in->keyboard.text_len = 0; }} /* text input */ edit->filter = filter; if (in->keyboard.text_len) { nk_textedit_text(edit, in->keyboard.text, in->keyboard.text_len); cursor_follow = nk_true; in->keyboard.text_len = 0; } /* enter key handler */ if (nk_input_is_key_pressed(in, NK_KEY_ENTER)) { cursor_follow = nk_true; if (flags & NK_EDIT_CTRL_ENTER_NEWLINE && shift_mod) nk_textedit_text(edit, "\n", 1); else if (flags & NK_EDIT_SIG_ENTER) ret |= NK_EDIT_COMMITED; else nk_textedit_text(edit, "\n", 1); } /* cut & copy handler */ {int copy= nk_input_is_key_pressed(in, NK_KEY_COPY); int cut = nk_input_is_key_pressed(in, NK_KEY_CUT); if ((copy || cut) && (flags & NK_EDIT_CLIPBOARD)) { int glyph_len; nk_rune unicode; const char *text; int b = edit->select_start; int e = edit->select_end; int begin = NK_MIN(b, e); int end = NK_MAX(b, e); text = nk_str_at_const(&edit->string, begin, &unicode, &glyph_len); if (edit->clip.copy) edit->clip.copy(edit->clip.userdata, text, end - begin); if (cut && !(flags & NK_EDIT_READ_ONLY)){ nk_textedit_cut(edit); cursor_follow = nk_true; } }} /* paste handler */ {int paste = nk_input_is_key_pressed(in, NK_KEY_PASTE); if (paste && (flags & NK_EDIT_CLIPBOARD) && edit->clip.paste) { edit->clip.paste(edit->clip.userdata, edit); cursor_follow = nk_true; }} /* tab handler */ {int tab = nk_input_is_key_pressed(in, NK_KEY_TAB); if (tab && (flags & NK_EDIT_ALLOW_TAB)) { nk_textedit_text(edit, " ", 4); cursor_follow = nk_true; }} } /* set widget state */ if (edit->active) *state = NK_WIDGET_STATE_ACTIVE; else nk_widget_state_reset(state); if (is_hovered) *state |= NK_WIDGET_STATE_HOVERED; /* DRAW EDIT */ {const char *text = nk_str_get_const(&edit->string); int len = nk_str_len_char(&edit->string); {/* select background colors/images */ const struct nk_style_item *background; if (*state & NK_WIDGET_STATE_ACTIVED) background = &style->active; else if (*state & NK_WIDGET_STATE_HOVER) background = &style->hover; else background = &style->normal; /* draw background frame */ if (background->type == NK_STYLE_ITEM_COLOR) { nk_stroke_rect(out, bounds, style->rounding, style->border, style->border_color); nk_fill_rect(out, bounds, style->rounding, background->data.color); } else nk_draw_image(out, bounds, &background->data.image, nk_white);} area.w = NK_MAX(0, area.w - style->cursor_size); if (edit->active) { int total_lines = 1; struct nk_vec2 text_size = nk_vec2(0,0); /* text pointer positions */ const char *cursor_ptr = 0; const char *select_begin_ptr = 0; const char *select_end_ptr = 0; /* 2D pixel positions */ struct nk_vec2 cursor_pos = nk_vec2(0,0); struct nk_vec2 selection_offset_start = nk_vec2(0,0); struct nk_vec2 selection_offset_end = nk_vec2(0,0); int selection_begin = NK_MIN(edit->select_start, edit->select_end); int selection_end = NK_MAX(edit->select_start, edit->select_end); /* calculate total line count + total space + cursor/selection position */ float line_width = 0.0f; if (text && len) { /* utf8 encoding */ float glyph_width; int glyph_len = 0; nk_rune unicode = 0; int text_len = 0; int glyphs = 0; int row_begin = 0; glyph_len = nk_utf_decode(text, &unicode, len); glyph_width = font->width(font->userdata, font->height, text, glyph_len); line_width = 0; /* iterate all lines */ while ((text_len < len) && glyph_len) { /* set cursor 2D position and line */ if (!cursor_ptr && glyphs == edit->cursor) { int glyph_offset; struct nk_vec2 out_offset; struct nk_vec2 row_size; const char *remaining; /* calculate 2d position */ cursor_pos.y = (float)(total_lines-1) * row_height; row_size = nk_text_calculate_text_bounds(font, text+row_begin, text_len-row_begin, row_height, &remaining, &out_offset, &glyph_offset, NK_STOP_ON_NEW_LINE); cursor_pos.x = row_size.x; cursor_ptr = text + text_len; } /* set start selection 2D position and line */ if (!select_begin_ptr && edit->select_start != edit->select_end && glyphs == selection_begin) { int glyph_offset; struct nk_vec2 out_offset; struct nk_vec2 row_size; const char *remaining; /* calculate 2d position */ selection_offset_start.y = (float)(NK_MAX(total_lines-1,0)) * row_height; row_size = nk_text_calculate_text_bounds(font, text+row_begin, text_len-row_begin, row_height, &remaining, &out_offset, &glyph_offset, NK_STOP_ON_NEW_LINE); selection_offset_start.x = row_size.x; select_begin_ptr = text + text_len; } /* set end selection 2D position and line */ if (!select_end_ptr && edit->select_start != edit->select_end && glyphs == selection_end) { int glyph_offset; struct nk_vec2 out_offset; struct nk_vec2 row_size; const char *remaining; /* calculate 2d position */ selection_offset_end.y = (float)(total_lines-1) * row_height; row_size = nk_text_calculate_text_bounds(font, text+row_begin, text_len-row_begin, row_height, &remaining, &out_offset, &glyph_offset, NK_STOP_ON_NEW_LINE); selection_offset_end.x = row_size.x; select_end_ptr = text + text_len; } if (unicode == '\n') { text_size.x = NK_MAX(text_size.x, line_width); total_lines++; line_width = 0; text_len++; glyphs++; row_begin = text_len; glyph_len = nk_utf_decode(text + text_len, &unicode, len-text_len); glyph_width = font->width(font->userdata, font->height, text+text_len, glyph_len); continue; } glyphs++; text_len += glyph_len; line_width += (float)glyph_width; glyph_len = nk_utf_decode(text + text_len, &unicode, len-text_len); glyph_width = font->width(font->userdata, font->height, text+text_len, glyph_len); continue; } text_size.y = (float)total_lines * row_height; /* handle case when cursor is at end of text buffer */ if (!cursor_ptr && edit->cursor == edit->string.len) { cursor_pos.x = line_width; cursor_pos.y = text_size.y - row_height; } } { /* scrollbar */ if (cursor_follow) { /* update scrollbar to follow cursor */ if (!(flags & NK_EDIT_NO_HORIZONTAL_SCROLL)) { /* horizontal scroll */ const float scroll_increment = area.w * 0.25f; if (cursor_pos.x < edit->scrollbar.x) edit->scrollbar.x = (float)(int)NK_MAX(0.0f, cursor_pos.x - scroll_increment); if (cursor_pos.x >= edit->scrollbar.x + area.w) edit->scrollbar.x = (float)(int)NK_MAX(0.0f, edit->scrollbar.x + scroll_increment); } else edit->scrollbar.x = 0; if (flags & NK_EDIT_MULTILINE) { /* vertical scroll */ if (cursor_pos.y < edit->scrollbar.y) edit->scrollbar.y = NK_MAX(0.0f, cursor_pos.y - row_height); if (cursor_pos.y >= edit->scrollbar.y + area.h) edit->scrollbar.y = edit->scrollbar.y + row_height; } else edit->scrollbar.y = 0; } /* scrollbar widget */ if (flags & NK_EDIT_MULTILINE) { nk_flags ws; struct nk_rect scroll; float scroll_target; float scroll_offset; float scroll_step; float scroll_inc; scroll = area; scroll.x = (bounds.x + bounds.w - style->border) - style->scrollbar_size.x; scroll.w = style->scrollbar_size.x; scroll_offset = edit->scrollbar.y; scroll_step = scroll.h * 0.10f; scroll_inc = scroll.h * 0.01f; scroll_target = text_size.y; edit->scrollbar.y = nk_do_scrollbarv(&ws, out, scroll, 0, scroll_offset, scroll_target, scroll_step, scroll_inc, &style->scrollbar, in, font); } } /* draw text */ {struct nk_color background_color; struct nk_color text_color; struct nk_color sel_background_color; struct nk_color sel_text_color; struct nk_color cursor_color; struct nk_color cursor_text_color; const struct nk_style_item *background; nk_push_scissor(out, clip); /* select correct colors to draw */ if (*state & NK_WIDGET_STATE_ACTIVED) { background = &style->active; text_color = style->text_active; sel_text_color = style->selected_text_hover; sel_background_color = style->selected_hover; cursor_color = style->cursor_hover; cursor_text_color = style->cursor_text_hover; } else if (*state & NK_WIDGET_STATE_HOVER) { background = &style->hover; text_color = style->text_hover; sel_text_color = style->selected_text_hover; sel_background_color = style->selected_hover; cursor_text_color = style->cursor_text_hover; cursor_color = style->cursor_hover; } else { background = &style->normal; text_color = style->text_normal; sel_text_color = style->selected_text_normal; sel_background_color = style->selected_normal; cursor_color = style->cursor_normal; cursor_text_color = style->cursor_text_normal; } if (background->type == NK_STYLE_ITEM_IMAGE) background_color = nk_rgba(0,0,0,0); else background_color = background->data.color; if (edit->select_start == edit->select_end) { /* no selection so just draw the complete text */ const char *begin = nk_str_get_const(&edit->string); int l = nk_str_len_char(&edit->string); nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y - edit->scrollbar.y, 0, begin, l, row_height, font, background_color, text_color, nk_false); } else { /* edit has selection so draw 1-3 text chunks */ if (edit->select_start != edit->select_end && selection_begin > 0){ /* draw unselected text before selection */ const char *begin = nk_str_get_const(&edit->string); NK_ASSERT(select_begin_ptr); nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y - edit->scrollbar.y, 0, begin, (int)(select_begin_ptr - begin), row_height, font, background_color, text_color, nk_false); } if (edit->select_start != edit->select_end) { /* draw selected text */ NK_ASSERT(select_begin_ptr); if (!select_end_ptr) { const char *begin = nk_str_get_const(&edit->string); select_end_ptr = begin + nk_str_len_char(&edit->string); } nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y + selection_offset_start.y - edit->scrollbar.y, selection_offset_start.x, select_begin_ptr, (int)(select_end_ptr - select_begin_ptr), row_height, font, sel_background_color, sel_text_color, nk_true); } if ((edit->select_start != edit->select_end && selection_end < edit->string.len)) { /* draw unselected text after selected text */ const char *begin = select_end_ptr; const char *end = nk_str_get_const(&edit->string) + nk_str_len_char(&edit->string); NK_ASSERT(select_end_ptr); nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y + selection_offset_end.y - edit->scrollbar.y, selection_offset_end.x, begin, (int)(end - begin), row_height, font, background_color, text_color, nk_true); } } /* cursor */ if (edit->select_start == edit->select_end) { if (edit->cursor >= nk_str_len(&edit->string) || (cursor_ptr && *cursor_ptr == '\n')) { /* draw cursor at end of line */ struct nk_rect cursor; cursor.w = style->cursor_size; cursor.h = font->height; cursor.x = area.x + cursor_pos.x - edit->scrollbar.x; cursor.y = area.y + cursor_pos.y + row_height/2.0f - cursor.h/2.0f; cursor.y -= edit->scrollbar.y; nk_fill_rect(out, cursor, 0, cursor_color); } else { /* draw cursor inside text */ int glyph_len; struct nk_rect label; struct nk_text txt; nk_rune unicode; NK_ASSERT(cursor_ptr); glyph_len = nk_utf_decode(cursor_ptr, &unicode, 4); label.x = area.x + cursor_pos.x - edit->scrollbar.x; label.y = area.y + cursor_pos.y - edit->scrollbar.y; label.w = font->width(font->userdata, font->height, cursor_ptr, glyph_len); label.h = row_height; txt.padding = nk_vec2(0,0); txt.background = cursor_color;; txt.text = cursor_text_color; nk_fill_rect(out, label, 0, cursor_color); nk_widget_text(out, label, cursor_ptr, glyph_len, &txt, NK_TEXT_LEFT, font); } }} } else { /* not active so just draw text */ int l = nk_str_len_char(&edit->string); const char *begin = nk_str_get_const(&edit->string); const struct nk_style_item *background; struct nk_color background_color; struct nk_color text_color; nk_push_scissor(out, clip); if (*state & NK_WIDGET_STATE_ACTIVED) { background = &style->active; text_color = style->text_active; } else if (*state & NK_WIDGET_STATE_HOVER) { background = &style->hover; text_color = style->text_hover; } else { background = &style->normal; text_color = style->text_normal; } if (background->type == NK_STYLE_ITEM_IMAGE) background_color = nk_rgba(0,0,0,0); else background_color = background->data.color; nk_edit_draw_text(out, style, area.x - edit->scrollbar.x, area.y - edit->scrollbar.y, 0, begin, l, row_height, font, background_color, text_color, nk_false); } nk_push_scissor(out, old_clip);} return ret; } NK_API void nk_edit_focus(struct nk_context *ctx, nk_flags flags) { nk_hash hash; struct nk_window *win; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return; win = ctx->current; hash = win->edit.seq; win->edit.active = nk_true; win->edit.name = hash; if (flags & NK_EDIT_ALWAYS_INSERT_MODE) win->edit.mode = NK_TEXT_EDIT_MODE_INSERT; } NK_API void nk_edit_unfocus(struct nk_context *ctx) { struct nk_window *win; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return; win = ctx->current; win->edit.active = nk_false; win->edit.name = 0; } NK_API nk_flags nk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter) { nk_hash hash; nk_flags state; struct nk_text_edit *edit; struct nk_window *win; NK_ASSERT(ctx); NK_ASSERT(memory); NK_ASSERT(len); if (!ctx || !memory || !len) return 0; filter = (!filter) ? nk_filter_default: filter; win = ctx->current; hash = win->edit.seq; edit = &ctx->text_edit; nk_textedit_clear_state(&ctx->text_edit, (flags & NK_EDIT_MULTILINE)? NK_TEXT_EDIT_MULTI_LINE: NK_TEXT_EDIT_SINGLE_LINE, filter); if (win->edit.active && hash == win->edit.name) { if (flags & NK_EDIT_NO_CURSOR) edit->cursor = nk_utf_len(memory, *len); else edit->cursor = win->edit.cursor; if (!(flags & NK_EDIT_SELECTABLE)) { edit->select_start = win->edit.cursor; edit->select_end = win->edit.cursor; } else { edit->select_start = win->edit.sel_start; edit->select_end = win->edit.sel_end; } edit->mode = win->edit.mode; edit->scrollbar.x = (float)win->edit.scrollbar.x; edit->scrollbar.y = (float)win->edit.scrollbar.y; edit->active = nk_true; } else edit->active = nk_false; max = NK_MAX(1, max); *len = NK_MIN(*len, max-1); nk_str_init_fixed(&edit->string, memory, (nk_size)max); edit->string.buffer.allocated = (nk_size)*len; edit->string.len = nk_utf_len(memory, *len); state = nk_edit_buffer(ctx, flags, edit, filter); *len = (int)edit->string.buffer.allocated; if (edit->active) { win->edit.cursor = edit->cursor; win->edit.sel_start = edit->select_start; win->edit.sel_end = edit->select_end; win->edit.mode = edit->mode; win->edit.scrollbar.x = (nk_uint)edit->scrollbar.x; win->edit.scrollbar.y = (nk_uint)edit->scrollbar.y; } return state; } NK_API nk_flags nk_edit_buffer(struct nk_context *ctx, nk_flags flags, struct nk_text_edit *edit, nk_plugin_filter filter) { struct nk_window *win; struct nk_style *style; struct nk_input *in; enum nk_widget_layout_states state; struct nk_rect bounds; nk_flags ret_flags = 0; unsigned char prev_state; nk_hash hash; /* make sure correct values */ NK_ASSERT(ctx); NK_ASSERT(edit); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; state = nk_widget(&bounds, ctx); if (!state) return state; in = (win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; /* check if edit is currently hot item */ hash = win->edit.seq++; if (win->edit.active && hash == win->edit.name) { if (flags & NK_EDIT_NO_CURSOR) edit->cursor = edit->string.len; if (!(flags & NK_EDIT_SELECTABLE)) { edit->select_start = edit->cursor; edit->select_end = edit->cursor; } if (flags & NK_EDIT_CLIPBOARD) edit->clip = ctx->clip; edit->active = (unsigned char)win->edit.active; } else edit->active = nk_false; edit->mode = win->edit.mode; filter = (!filter) ? nk_filter_default: filter; prev_state = (unsigned char)edit->active; in = (flags & NK_EDIT_READ_ONLY) ? 0: in; ret_flags = nk_do_edit(&ctx->last_widget_state, &win->buffer, bounds, flags, filter, edit, &style->edit, in, style->font); if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_TEXT]; if (edit->active && prev_state != edit->active) { /* current edit is now hot */ win->edit.active = nk_true; win->edit.name = hash; } else if (prev_state && !edit->active) { /* current edit is now cold */ win->edit.active = nk_false; } return ret_flags; } NK_API nk_flags nk_edit_string_zero_terminated(struct nk_context *ctx, nk_flags flags, char *buffer, int max, nk_plugin_filter filter) { nk_flags result; int len = nk_strlen(buffer); result = nk_edit_string(ctx, flags, buffer, &len, max, filter); buffer[NK_MIN(NK_MAX(max-1,0), len)] = '\0'; return result; } /* =============================================================== * * PROPERTY * * ===============================================================*/ NK_LIB void nk_drag_behavior(nk_flags *state, const struct nk_input *in, struct nk_rect drag, struct nk_property_variant *variant, float inc_per_pixel) { int left_mouse_down = in && in->mouse.buttons[NK_BUTTON_LEFT].down; int left_mouse_click_in_cursor = in && nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, drag, nk_true); nk_widget_state_reset(state); if (nk_input_is_mouse_hovering_rect(in, drag)) *state = NK_WIDGET_STATE_HOVERED; if (left_mouse_down && left_mouse_click_in_cursor) { float delta, pixels; pixels = in->mouse.delta.x; delta = pixels * inc_per_pixel; switch (variant->kind) { default: break; case NK_PROPERTY_INT: variant->value.i = variant->value.i + (int)delta; variant->value.i = NK_CLAMP(variant->min_value.i, variant->value.i, variant->max_value.i); break; case NK_PROPERTY_FLOAT: variant->value.f = variant->value.f + (float)delta; variant->value.f = NK_CLAMP(variant->min_value.f, variant->value.f, variant->max_value.f); break; case NK_PROPERTY_DOUBLE: variant->value.d = variant->value.d + (double)delta; variant->value.d = NK_CLAMP(variant->min_value.d, variant->value.d, variant->max_value.d); break; } *state = NK_WIDGET_STATE_ACTIVE; } if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(in, drag)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(in, drag)) *state |= NK_WIDGET_STATE_LEFT; } NK_LIB void nk_property_behavior(nk_flags *ws, const struct nk_input *in, struct nk_rect property, struct nk_rect label, struct nk_rect edit, struct nk_rect empty, int *state, struct nk_property_variant *variant, float inc_per_pixel) { if (in && *state == NK_PROPERTY_DEFAULT) { if (nk_button_behavior(ws, edit, in, NK_BUTTON_DEFAULT)) *state = NK_PROPERTY_EDIT; else if (nk_input_is_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, label, nk_true)) *state = NK_PROPERTY_DRAG; else if (nk_input_is_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, empty, nk_true)) *state = NK_PROPERTY_DRAG; } if (*state == NK_PROPERTY_DRAG) { nk_drag_behavior(ws, in, property, variant, inc_per_pixel); if (!(*ws & NK_WIDGET_STATE_ACTIVED)) *state = NK_PROPERTY_DEFAULT; } } NK_LIB void nk_draw_property(struct nk_command_buffer *out, const struct nk_style_property *style, const struct nk_rect *bounds, const struct nk_rect *label, nk_flags state, const char *name, int len, const struct nk_user_font *font) { struct nk_text text; const struct nk_style_item *background; /* select correct background and text color */ if (state & NK_WIDGET_STATE_ACTIVED) { background = &style->active; text.text = style->label_active; } else if (state & NK_WIDGET_STATE_HOVER) { background = &style->hover; text.text = style->label_hover; } else { background = &style->normal; text.text = style->label_normal; } /* draw background */ if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(out, *bounds, &background->data.image, nk_white); text.background = nk_rgba(0,0,0,0); } else { text.background = background->data.color; nk_fill_rect(out, *bounds, style->rounding, background->data.color); nk_stroke_rect(out, *bounds, style->rounding, style->border, background->data.color); } /* draw label */ text.padding = nk_vec2(0,0); nk_widget_text(out, *label, name, len, &text, NK_TEXT_CENTERED, font); } NK_LIB void nk_do_property(nk_flags *ws, struct nk_command_buffer *out, struct nk_rect property, const char *name, struct nk_property_variant *variant, float inc_per_pixel, char *buffer, int *len, int *state, int *cursor, int *select_begin, int *select_end, const struct nk_style_property *style, enum nk_property_filter filter, struct nk_input *in, const struct nk_user_font *font, struct nk_text_edit *text_edit, enum nk_button_behavior behavior) { const nk_plugin_filter filters[] = { nk_filter_decimal, nk_filter_float }; int active, old; int num_len, name_len; char string[NK_MAX_NUMBER_BUFFER]; float size; char *dst = 0; int *length; struct nk_rect left; struct nk_rect right; struct nk_rect label; struct nk_rect edit; struct nk_rect empty; /* left decrement button */ left.h = font->height/2; left.w = left.h; left.x = property.x + style->border + style->padding.x; left.y = property.y + style->border + property.h/2.0f - left.h/2; /* text label */ name_len = nk_strlen(name); size = font->width(font->userdata, font->height, name, name_len); label.x = left.x + left.w + style->padding.x; label.w = (float)size + 2 * style->padding.x; label.y = property.y + style->border + style->padding.y; label.h = property.h - (2 * style->border + 2 * style->padding.y); /* right increment button */ right.y = left.y; right.w = left.w; right.h = left.h; right.x = property.x + property.w - (right.w + style->padding.x); /* edit */ if (*state == NK_PROPERTY_EDIT) { size = font->width(font->userdata, font->height, buffer, *len); size += style->edit.cursor_size; length = len; dst = buffer; } else { switch (variant->kind) { default: break; case NK_PROPERTY_INT: nk_itoa(string, variant->value.i); num_len = nk_strlen(string); break; case NK_PROPERTY_FLOAT: NK_DTOA(string, (double)variant->value.f); num_len = nk_string_float_limit(string, NK_MAX_FLOAT_PRECISION); break; case NK_PROPERTY_DOUBLE: NK_DTOA(string, variant->value.d); num_len = nk_string_float_limit(string, NK_MAX_FLOAT_PRECISION); break; } size = font->width(font->userdata, font->height, string, num_len); dst = string; length = &num_len; } edit.w = (float)size + 2 * style->padding.x; edit.w = NK_MIN(edit.w, right.x - (label.x + label.w)); edit.x = right.x - (edit.w + style->padding.x); edit.y = property.y + style->border; edit.h = property.h - (2 * style->border); /* empty left space activator */ empty.w = edit.x - (label.x + label.w); empty.x = label.x + label.w; empty.y = property.y; empty.h = property.h; /* update property */ old = (*state == NK_PROPERTY_EDIT); nk_property_behavior(ws, in, property, label, edit, empty, state, variant, inc_per_pixel); /* draw property */ if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_property(out, style, &property, &label, *ws, name, name_len, font); if (style->draw_end) style->draw_end(out, style->userdata); /* execute right button */ if (nk_do_button_symbol(ws, out, left, style->sym_left, behavior, &style->dec_button, in, font)) { switch (variant->kind) { default: break; case NK_PROPERTY_INT: variant->value.i = NK_CLAMP(variant->min_value.i, variant->value.i - variant->step.i, variant->max_value.i); break; case NK_PROPERTY_FLOAT: variant->value.f = NK_CLAMP(variant->min_value.f, variant->value.f - variant->step.f, variant->max_value.f); break; case NK_PROPERTY_DOUBLE: variant->value.d = NK_CLAMP(variant->min_value.d, variant->value.d - variant->step.d, variant->max_value.d); break; } } /* execute left button */ if (nk_do_button_symbol(ws, out, right, style->sym_right, behavior, &style->inc_button, in, font)) { switch (variant->kind) { default: break; case NK_PROPERTY_INT: variant->value.i = NK_CLAMP(variant->min_value.i, variant->value.i + variant->step.i, variant->max_value.i); break; case NK_PROPERTY_FLOAT: variant->value.f = NK_CLAMP(variant->min_value.f, variant->value.f + variant->step.f, variant->max_value.f); break; case NK_PROPERTY_DOUBLE: variant->value.d = NK_CLAMP(variant->min_value.d, variant->value.d + variant->step.d, variant->max_value.d); break; } } if (old != NK_PROPERTY_EDIT && (*state == NK_PROPERTY_EDIT)) { /* property has been activated so setup buffer */ NK_MEMCPY(buffer, dst, (nk_size)*length); *cursor = nk_utf_len(buffer, *length); *len = *length; length = len; dst = buffer; active = 0; } else active = (*state == NK_PROPERTY_EDIT); /* execute and run text edit field */ nk_textedit_clear_state(text_edit, NK_TEXT_EDIT_SINGLE_LINE, filters[filter]); text_edit->active = (unsigned char)active; text_edit->string.len = *length; text_edit->cursor = NK_CLAMP(0, *cursor, *length); text_edit->select_start = NK_CLAMP(0,*select_begin, *length); text_edit->select_end = NK_CLAMP(0,*select_end, *length); text_edit->string.buffer.allocated = (nk_size)*length; text_edit->string.buffer.memory.size = NK_MAX_NUMBER_BUFFER; text_edit->string.buffer.memory.ptr = dst; text_edit->string.buffer.size = NK_MAX_NUMBER_BUFFER; text_edit->mode = NK_TEXT_EDIT_MODE_INSERT; nk_do_edit(ws, out, edit, NK_EDIT_FIELD|NK_EDIT_AUTO_SELECT, filters[filter], text_edit, &style->edit, (*state == NK_PROPERTY_EDIT) ? in: 0, font); *length = text_edit->string.len; *cursor = text_edit->cursor; *select_begin = text_edit->select_start; *select_end = text_edit->select_end; if (text_edit->active && nk_input_is_key_pressed(in, NK_KEY_ENTER)) text_edit->active = nk_false; if (active && !text_edit->active) { /* property is now not active so convert edit text to value*/ *state = NK_PROPERTY_DEFAULT; buffer[*len] = '\0'; switch (variant->kind) { default: break; case NK_PROPERTY_INT: variant->value.i = nk_strtoi(buffer, 0); variant->value.i = NK_CLAMP(variant->min_value.i, variant->value.i, variant->max_value.i); break; case NK_PROPERTY_FLOAT: nk_string_float_limit(buffer, NK_MAX_FLOAT_PRECISION); variant->value.f = nk_strtof(buffer, 0); variant->value.f = NK_CLAMP(variant->min_value.f, variant->value.f, variant->max_value.f); break; case NK_PROPERTY_DOUBLE: nk_string_float_limit(buffer, NK_MAX_FLOAT_PRECISION); variant->value.d = nk_strtod(buffer, 0); variant->value.d = NK_CLAMP(variant->min_value.d, variant->value.d, variant->max_value.d); break; } } } NK_LIB struct nk_property_variant nk_property_variant_int(int value, int min_value, int max_value, int step) { struct nk_property_variant result; result.kind = NK_PROPERTY_INT; result.value.i = value; result.min_value.i = min_value; result.max_value.i = max_value; result.step.i = step; return result; } NK_LIB struct nk_property_variant nk_property_variant_float(float value, float min_value, float max_value, float step) { struct nk_property_variant result; result.kind = NK_PROPERTY_FLOAT; result.value.f = value; result.min_value.f = min_value; result.max_value.f = max_value; result.step.f = step; return result; } NK_LIB struct nk_property_variant nk_property_variant_double(double value, double min_value, double max_value, double step) { struct nk_property_variant result; result.kind = NK_PROPERTY_DOUBLE; result.value.d = value; result.min_value.d = min_value; result.max_value.d = max_value; result.step.d = step; return result; } NK_LIB void nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant *variant, float inc_per_pixel, const enum nk_property_filter filter) { struct nk_window *win; struct nk_panel *layout; struct nk_input *in; const struct nk_style *style; struct nk_rect bounds; enum nk_widget_layout_states s; int *state = 0; nk_hash hash = 0; char *buffer = 0; int *len = 0; int *cursor = 0; int *select_begin = 0; int *select_end = 0; int old_state; char dummy_buffer[NK_MAX_NUMBER_BUFFER]; int dummy_state = NK_PROPERTY_DEFAULT; int dummy_length = 0; int dummy_cursor = 0; int dummy_select_begin = 0; int dummy_select_end = 0; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return; win = ctx->current; layout = win->layout; style = &ctx->style; s = nk_widget(&bounds, ctx); if (!s) return; /* calculate hash from name */ if (name[0] == '#') { hash = nk_murmur_hash(name, (int)nk_strlen(name), win->property.seq++); name++; /* special number hash */ } else hash = nk_murmur_hash(name, (int)nk_strlen(name), 42); /* check if property is currently hot item */ if (win->property.active && hash == win->property.name) { buffer = win->property.buffer; len = &win->property.length; cursor = &win->property.cursor; state = &win->property.state; select_begin = &win->property.select_start; select_end = &win->property.select_end; } else { buffer = dummy_buffer; len = &dummy_length; cursor = &dummy_cursor; state = &dummy_state; select_begin = &dummy_select_begin; select_end = &dummy_select_end; } /* execute property widget */ old_state = *state; ctx->text_edit.clip = ctx->clip; in = ((s == NK_WIDGET_ROM && !win->property.active) || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; nk_do_property(&ctx->last_widget_state, &win->buffer, bounds, name, variant, inc_per_pixel, buffer, len, state, cursor, select_begin, select_end, &style->property, filter, in, style->font, &ctx->text_edit, ctx->button_behavior); if (in && *state != NK_PROPERTY_DEFAULT && !win->property.active) { /* current property is now hot */ win->property.active = 1; NK_MEMCPY(win->property.buffer, buffer, (nk_size)*len); win->property.length = *len; win->property.cursor = *cursor; win->property.state = *state; win->property.name = hash; win->property.select_start = *select_begin; win->property.select_end = *select_end; if (*state == NK_PROPERTY_DRAG) { ctx->input.mouse.grab = nk_true; ctx->input.mouse.grabbed = nk_true; } } /* check if previously active property is now inactive */ if (*state == NK_PROPERTY_DEFAULT && old_state != NK_PROPERTY_DEFAULT) { if (old_state == NK_PROPERTY_DRAG) { ctx->input.mouse.grab = nk_false; ctx->input.mouse.grabbed = nk_false; ctx->input.mouse.ungrab = nk_true; } win->property.select_start = 0; win->property.select_end = 0; win->property.active = 0; } } NK_API void nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel) { struct nk_property_variant variant; NK_ASSERT(ctx); NK_ASSERT(name); NK_ASSERT(val); if (!ctx || !ctx->current || !name || !val) return; variant = nk_property_variant_int(*val, min, max, step); nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_INT); *val = variant.value.i; } NK_API void nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel) { struct nk_property_variant variant; NK_ASSERT(ctx); NK_ASSERT(name); NK_ASSERT(val); if (!ctx || !ctx->current || !name || !val) return; variant = nk_property_variant_float(*val, min, max, step); nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT); *val = variant.value.f; } NK_API void nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, float inc_per_pixel) { struct nk_property_variant variant; NK_ASSERT(ctx); NK_ASSERT(name); NK_ASSERT(val); if (!ctx || !ctx->current || !name || !val) return; variant = nk_property_variant_double(*val, min, max, step); nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT); *val = variant.value.d; } NK_API int nk_propertyi(struct nk_context *ctx, const char *name, int min, int val, int max, int step, float inc_per_pixel) { struct nk_property_variant variant; NK_ASSERT(ctx); NK_ASSERT(name); if (!ctx || !ctx->current || !name) return val; variant = nk_property_variant_int(val, min, max, step); nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_INT); val = variant.value.i; return val; } NK_API float nk_propertyf(struct nk_context *ctx, const char *name, float min, float val, float max, float step, float inc_per_pixel) { struct nk_property_variant variant; NK_ASSERT(ctx); NK_ASSERT(name); if (!ctx || !ctx->current || !name) return val; variant = nk_property_variant_float(val, min, max, step); nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT); val = variant.value.f; return val; } NK_API double nk_propertyd(struct nk_context *ctx, const char *name, double min, double val, double max, double step, float inc_per_pixel) { struct nk_property_variant variant; NK_ASSERT(ctx); NK_ASSERT(name); if (!ctx || !ctx->current || !name) return val; variant = nk_property_variant_double(val, min, max, step); nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT); val = variant.value.d; return val; } /* ============================================================== * * CHART * * ===============================================================*/ NK_API int nk_chart_begin_colored(struct nk_context *ctx, enum nk_chart_type type, struct nk_color color, struct nk_color highlight, int count, float min_value, float max_value) { struct nk_window *win; struct nk_chart *chart; const struct nk_style *config; const struct nk_style_chart *style; const struct nk_style_item *background; struct nk_rect bounds = {0, 0, 0, 0}; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; if (!nk_widget(&bounds, ctx)) { chart = &ctx->current->layout->chart; nk_zero(chart, sizeof(*chart)); return 0; } win = ctx->current; config = &ctx->style; chart = &win->layout->chart; style = &config->chart; /* setup basic generic chart */ nk_zero(chart, sizeof(*chart)); chart->x = bounds.x + style->padding.x; chart->y = bounds.y + style->padding.y; chart->w = bounds.w - 2 * style->padding.x; chart->h = bounds.h - 2 * style->padding.y; chart->w = NK_MAX(chart->w, 2 * style->padding.x); chart->h = NK_MAX(chart->h, 2 * style->padding.y); /* add first slot into chart */ {struct nk_chart_slot *slot = &chart->slots[chart->slot++]; slot->type = type; slot->count = count; slot->color = color; slot->highlight = highlight; slot->min = NK_MIN(min_value, max_value); slot->max = NK_MAX(min_value, max_value); slot->range = slot->max - slot->min;} /* draw chart background */ background = &style->background; if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(&win->buffer, bounds, &background->data.image, nk_white); } else { nk_fill_rect(&win->buffer, bounds, style->rounding, style->border_color); nk_fill_rect(&win->buffer, nk_shrink_rect(bounds, style->border), style->rounding, style->background.data.color); } return 1; } NK_API int nk_chart_begin(struct nk_context *ctx, const enum nk_chart_type type, int count, float min_value, float max_value) { return nk_chart_begin_colored(ctx, type, ctx->style.chart.color, ctx->style.chart.selected_color, count, min_value, max_value); } NK_API void nk_chart_add_slot_colored(struct nk_context *ctx, const enum nk_chart_type type, struct nk_color color, struct nk_color highlight, int count, float min_value, float max_value) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); NK_ASSERT(ctx->current->layout->chart.slot < NK_CHART_MAX_SLOT); if (!ctx || !ctx->current || !ctx->current->layout) return; if (ctx->current->layout->chart.slot >= NK_CHART_MAX_SLOT) return; /* add another slot into the graph */ {struct nk_chart *chart = &ctx->current->layout->chart; struct nk_chart_slot *slot = &chart->slots[chart->slot++]; slot->type = type; slot->count = count; slot->color = color; slot->highlight = highlight; slot->min = NK_MIN(min_value, max_value); slot->max = NK_MAX(min_value, max_value); slot->range = slot->max - slot->min;} } NK_API void nk_chart_add_slot(struct nk_context *ctx, const enum nk_chart_type type, int count, float min_value, float max_value) { nk_chart_add_slot_colored(ctx, type, ctx->style.chart.color, ctx->style.chart.selected_color, count, min_value, max_value); } NK_INTERN nk_flags nk_chart_push_line(struct nk_context *ctx, struct nk_window *win, struct nk_chart *g, float value, int slot) { struct nk_panel *layout = win->layout; const struct nk_input *i = &ctx->input; struct nk_command_buffer *out = &win->buffer; nk_flags ret = 0; struct nk_vec2 cur; struct nk_rect bounds; struct nk_color color; float step; float range; float ratio; NK_ASSERT(slot >= 0 && slot < NK_CHART_MAX_SLOT); step = g->w / (float)g->slots[slot].count; range = g->slots[slot].max - g->slots[slot].min; ratio = (value - g->slots[slot].min) / range; if (g->slots[slot].index == 0) { /* first data point does not have a connection */ g->slots[slot].last.x = g->x; g->slots[slot].last.y = (g->y + g->h) - ratio * (float)g->h; bounds.x = g->slots[slot].last.x - 2; bounds.y = g->slots[slot].last.y - 2; bounds.w = bounds.h = 4; color = g->slots[slot].color; if (!(layout->flags & NK_WINDOW_ROM) && NK_INBOX(i->mouse.pos.x,i->mouse.pos.y, g->slots[slot].last.x-3, g->slots[slot].last.y-3, 6, 6)){ ret = nk_input_is_mouse_hovering_rect(i, bounds) ? NK_CHART_HOVERING : 0; ret |= (i->mouse.buttons[NK_BUTTON_LEFT].down && i->mouse.buttons[NK_BUTTON_LEFT].clicked) ? NK_CHART_CLICKED: 0; color = g->slots[slot].highlight; } nk_fill_rect(out, bounds, 0, color); g->slots[slot].index += 1; return ret; } /* draw a line between the last data point and the new one */ color = g->slots[slot].color; cur.x = g->x + (float)(step * (float)g->slots[slot].index); cur.y = (g->y + g->h) - (ratio * (float)g->h); nk_stroke_line(out, g->slots[slot].last.x, g->slots[slot].last.y, cur.x, cur.y, 1.0f, color); bounds.x = cur.x - 3; bounds.y = cur.y - 3; bounds.w = bounds.h = 6; /* user selection of current data point */ if (!(layout->flags & NK_WINDOW_ROM)) { if (nk_input_is_mouse_hovering_rect(i, bounds)) { ret = NK_CHART_HOVERING; ret |= (!i->mouse.buttons[NK_BUTTON_LEFT].down && i->mouse.buttons[NK_BUTTON_LEFT].clicked) ? NK_CHART_CLICKED: 0; color = g->slots[slot].highlight; } } nk_fill_rect(out, nk_rect(cur.x - 2, cur.y - 2, 4, 4), 0, color); /* save current data point position */ g->slots[slot].last.x = cur.x; g->slots[slot].last.y = cur.y; g->slots[slot].index += 1; return ret; } NK_INTERN nk_flags nk_chart_push_column(const struct nk_context *ctx, struct nk_window *win, struct nk_chart *chart, float value, int slot) { struct nk_command_buffer *out = &win->buffer; const struct nk_input *in = &ctx->input; struct nk_panel *layout = win->layout; float ratio; nk_flags ret = 0; struct nk_color color; struct nk_rect item = {0,0,0,0}; NK_ASSERT(slot >= 0 && slot < NK_CHART_MAX_SLOT); if (chart->slots[slot].index >= chart->slots[slot].count) return nk_false; if (chart->slots[slot].count) { float padding = (float)(chart->slots[slot].count-1); item.w = (chart->w - padding) / (float)(chart->slots[slot].count); } /* calculate bounds of current bar chart entry */ color = chart->slots[slot].color;; item.h = chart->h * NK_ABS((value/chart->slots[slot].range)); if (value >= 0) { ratio = (value + NK_ABS(chart->slots[slot].min)) / NK_ABS(chart->slots[slot].range); item.y = (chart->y + chart->h) - chart->h * ratio; } else { ratio = (value - chart->slots[slot].max) / chart->slots[slot].range; item.y = chart->y + (chart->h * NK_ABS(ratio)) - item.h; } item.x = chart->x + ((float)chart->slots[slot].index * item.w); item.x = item.x + ((float)chart->slots[slot].index); /* user chart bar selection */ if (!(layout->flags & NK_WINDOW_ROM) && NK_INBOX(in->mouse.pos.x,in->mouse.pos.y,item.x,item.y,item.w,item.h)) { ret = NK_CHART_HOVERING; ret |= (!in->mouse.buttons[NK_BUTTON_LEFT].down && in->mouse.buttons[NK_BUTTON_LEFT].clicked) ? NK_CHART_CLICKED: 0; color = chart->slots[slot].highlight; } nk_fill_rect(out, item, 0, color); chart->slots[slot].index += 1; return ret; } NK_API nk_flags nk_chart_push_slot(struct nk_context *ctx, float value, int slot) { nk_flags flags; struct nk_window *win; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(slot >= 0 && slot < NK_CHART_MAX_SLOT); NK_ASSERT(slot < ctx->current->layout->chart.slot); if (!ctx || !ctx->current || slot >= NK_CHART_MAX_SLOT) return nk_false; if (slot >= ctx->current->layout->chart.slot) return nk_false; win = ctx->current; if (win->layout->chart.slot < slot) return nk_false; switch (win->layout->chart.slots[slot].type) { case NK_CHART_LINES: flags = nk_chart_push_line(ctx, win, &win->layout->chart, value, slot); break; case NK_CHART_COLUMN: flags = nk_chart_push_column(ctx, win, &win->layout->chart, value, slot); break; default: case NK_CHART_MAX: flags = 0; } return flags; } NK_API nk_flags nk_chart_push(struct nk_context *ctx, float value) { return nk_chart_push_slot(ctx, value, 0); } NK_API void nk_chart_end(struct nk_context *ctx) { struct nk_window *win; struct nk_chart *chart; NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return; win = ctx->current; chart = &win->layout->chart; NK_MEMSET(chart, 0, sizeof(*chart)); return; } NK_API void nk_plot(struct nk_context *ctx, enum nk_chart_type type, const float *values, int count, int offset) { int i = 0; float min_value; float max_value; NK_ASSERT(ctx); NK_ASSERT(values); if (!ctx || !values || !count) return; min_value = values[offset]; max_value = values[offset]; for (i = 0; i < count; ++i) { min_value = NK_MIN(values[i + offset], min_value); max_value = NK_MAX(values[i + offset], max_value); } if (nk_chart_begin(ctx, type, count, min_value, max_value)) { for (i = 0; i < count; ++i) nk_chart_push(ctx, values[i + offset]); nk_chart_end(ctx); } } NK_API void nk_plot_function(struct nk_context *ctx, enum nk_chart_type type, void *userdata, float(*value_getter)(void* user, int index), int count, int offset) { int i = 0; float min_value; float max_value; NK_ASSERT(ctx); NK_ASSERT(value_getter); if (!ctx || !value_getter || !count) return; max_value = min_value = value_getter(userdata, offset); for (i = 0; i < count; ++i) { float value = value_getter(userdata, i + offset); min_value = NK_MIN(value, min_value); max_value = NK_MAX(value, max_value); } if (nk_chart_begin(ctx, type, count, min_value, max_value)) { for (i = 0; i < count; ++i) nk_chart_push(ctx, value_getter(userdata, i + offset)); nk_chart_end(ctx); } } /* ============================================================== * * COLOR PICKER * * ===============================================================*/ NK_LIB int nk_color_picker_behavior(nk_flags *state, const struct nk_rect *bounds, const struct nk_rect *matrix, const struct nk_rect *hue_bar, const struct nk_rect *alpha_bar, struct nk_colorf *color, const struct nk_input *in) { float hsva[4]; int value_changed = 0; int hsv_changed = 0; NK_ASSERT(state); NK_ASSERT(matrix); NK_ASSERT(hue_bar); NK_ASSERT(color); /* color matrix */ nk_colorf_hsva_fv(hsva, *color); if (nk_button_behavior(state, *matrix, in, NK_BUTTON_REPEATER)) { hsva[1] = NK_SATURATE((in->mouse.pos.x - matrix->x) / (matrix->w-1)); hsva[2] = 1.0f - NK_SATURATE((in->mouse.pos.y - matrix->y) / (matrix->h-1)); value_changed = hsv_changed = 1; } /* hue bar */ if (nk_button_behavior(state, *hue_bar, in, NK_BUTTON_REPEATER)) { hsva[0] = NK_SATURATE((in->mouse.pos.y - hue_bar->y) / (hue_bar->h-1)); value_changed = hsv_changed = 1; } /* alpha bar */ if (alpha_bar) { if (nk_button_behavior(state, *alpha_bar, in, NK_BUTTON_REPEATER)) { hsva[3] = 1.0f - NK_SATURATE((in->mouse.pos.y - alpha_bar->y) / (alpha_bar->h-1)); value_changed = 1; } } nk_widget_state_reset(state); if (hsv_changed) { *color = nk_hsva_colorfv(hsva); *state = NK_WIDGET_STATE_ACTIVE; } if (value_changed) { color->a = hsva[3]; *state = NK_WIDGET_STATE_ACTIVE; } /* set color picker widget state */ if (nk_input_is_mouse_hovering_rect(in, *bounds)) *state = NK_WIDGET_STATE_HOVERED; if (*state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(in, *bounds)) *state |= NK_WIDGET_STATE_ENTERED; else if (nk_input_is_mouse_prev_hovering_rect(in, *bounds)) *state |= NK_WIDGET_STATE_LEFT; return value_changed; } NK_LIB void nk_draw_color_picker(struct nk_command_buffer *o, const struct nk_rect *matrix, const struct nk_rect *hue_bar, const struct nk_rect *alpha_bar, struct nk_colorf col) { NK_STORAGE const struct nk_color black = {0,0,0,255}; NK_STORAGE const struct nk_color white = {255, 255, 255, 255}; NK_STORAGE const struct nk_color black_trans = {0,0,0,0}; const float crosshair_size = 7.0f; struct nk_color temp; float hsva[4]; float line_y; int i; NK_ASSERT(o); NK_ASSERT(matrix); NK_ASSERT(hue_bar); /* draw hue bar */ nk_colorf_hsva_fv(hsva, col); for (i = 0; i < 6; ++i) { NK_GLOBAL const struct nk_color hue_colors[] = { {255, 0, 0, 255}, {255,255,0,255}, {0,255,0,255}, {0, 255,255,255}, {0,0,255,255}, {255, 0, 255, 255}, {255, 0, 0, 255} }; nk_fill_rect_multi_color(o, nk_rect(hue_bar->x, hue_bar->y + (float)i * (hue_bar->h/6.0f) + 0.5f, hue_bar->w, (hue_bar->h/6.0f) + 0.5f), hue_colors[i], hue_colors[i], hue_colors[i+1], hue_colors[i+1]); } line_y = (float)(int)(hue_bar->y + hsva[0] * matrix->h + 0.5f); nk_stroke_line(o, hue_bar->x-1, line_y, hue_bar->x + hue_bar->w + 2, line_y, 1, nk_rgb(255,255,255)); /* draw alpha bar */ if (alpha_bar) { float alpha = NK_SATURATE(col.a); line_y = (float)(int)(alpha_bar->y + (1.0f - alpha) * matrix->h + 0.5f); nk_fill_rect_multi_color(o, *alpha_bar, white, white, black, black); nk_stroke_line(o, alpha_bar->x-1, line_y, alpha_bar->x + alpha_bar->w + 2, line_y, 1, nk_rgb(255,255,255)); } /* draw color matrix */ temp = nk_hsv_f(hsva[0], 1.0f, 1.0f); nk_fill_rect_multi_color(o, *matrix, white, temp, temp, white); nk_fill_rect_multi_color(o, *matrix, black_trans, black_trans, black, black); /* draw cross-hair */ {struct nk_vec2 p; float S = hsva[1]; float V = hsva[2]; p.x = (float)(int)(matrix->x + S * matrix->w); p.y = (float)(int)(matrix->y + (1.0f - V) * matrix->h); nk_stroke_line(o, p.x - crosshair_size, p.y, p.x-2, p.y, 1.0f, white); nk_stroke_line(o, p.x + crosshair_size + 1, p.y, p.x+3, p.y, 1.0f, white); nk_stroke_line(o, p.x, p.y + crosshair_size + 1, p.x, p.y+3, 1.0f, white); nk_stroke_line(o, p.x, p.y - crosshair_size, p.x, p.y-2, 1.0f, white);} } NK_LIB int nk_do_color_picker(nk_flags *state, struct nk_command_buffer *out, struct nk_colorf *col, enum nk_color_format fmt, struct nk_rect bounds, struct nk_vec2 padding, const struct nk_input *in, const struct nk_user_font *font) { int ret = 0; struct nk_rect matrix; struct nk_rect hue_bar; struct nk_rect alpha_bar; float bar_w; NK_ASSERT(out); NK_ASSERT(col); NK_ASSERT(state); NK_ASSERT(font); if (!out || !col || !state || !font) return ret; bar_w = font->height; bounds.x += padding.x; bounds.y += padding.x; bounds.w -= 2 * padding.x; bounds.h -= 2 * padding.y; matrix.x = bounds.x; matrix.y = bounds.y; matrix.h = bounds.h; matrix.w = bounds.w - (3 * padding.x + 2 * bar_w); hue_bar.w = bar_w; hue_bar.y = bounds.y; hue_bar.h = matrix.h; hue_bar.x = matrix.x + matrix.w + padding.x; alpha_bar.x = hue_bar.x + hue_bar.w + padding.x; alpha_bar.y = bounds.y; alpha_bar.w = bar_w; alpha_bar.h = matrix.h; ret = nk_color_picker_behavior(state, &bounds, &matrix, &hue_bar, (fmt == NK_RGBA) ? &alpha_bar:0, col, in); nk_draw_color_picker(out, &matrix, &hue_bar, (fmt == NK_RGBA) ? &alpha_bar:0, *col); return ret; } NK_API int nk_color_pick(struct nk_context * ctx, struct nk_colorf *color, enum nk_color_format fmt) { struct nk_window *win; struct nk_panel *layout; const struct nk_style *config; const struct nk_input *in; enum nk_widget_layout_states state; struct nk_rect bounds; NK_ASSERT(ctx); NK_ASSERT(color); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !color) return 0; win = ctx->current; config = &ctx->style; layout = win->layout; state = nk_widget(&bounds, ctx); if (!state) return 0; in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input; return nk_do_color_picker(&ctx->last_widget_state, &win->buffer, color, fmt, bounds, nk_vec2(0,0), in, config->font); } NK_API struct nk_colorf nk_color_picker(struct nk_context *ctx, struct nk_colorf color, enum nk_color_format fmt) { nk_color_pick(ctx, &color, fmt); return color; } /* ============================================================== * * COMBO * * ===============================================================*/ NK_INTERN int nk_combo_begin(struct nk_context *ctx, struct nk_window *win, struct nk_vec2 size, int is_clicked, struct nk_rect header) { struct nk_window *popup; int is_open = 0; int is_active = 0; struct nk_rect body; nk_hash hash; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; popup = win->popup.win; body.x = header.x; body.w = size.x; body.y = header.y + header.h-ctx->style.window.combo_border; body.h = size.y; hash = win->popup.combo_count++; is_open = (popup) ? nk_true:nk_false; is_active = (popup && (win->popup.name == hash) && win->popup.type == NK_PANEL_COMBO); if ((is_clicked && is_open && !is_active) || (is_open && !is_active) || (!is_open && !is_active && !is_clicked)) return 0; if (!nk_nonblock_begin(ctx, 0, body, (is_clicked && is_open)?nk_rect(0,0,0,0):header, NK_PANEL_COMBO)) return 0; win->popup.type = NK_PANEL_COMBO; win->popup.name = hash; return 1; } NK_API int nk_combo_begin_text(struct nk_context *ctx, const char *selected, int len, struct nk_vec2 size) { const struct nk_input *in; struct nk_window *win; struct nk_style *style; enum nk_widget_layout_states s; int is_clicked = nk_false; struct nk_rect header; const struct nk_style_item *background; struct nk_text text; NK_ASSERT(ctx); NK_ASSERT(selected); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout || !selected) return 0; win = ctx->current; style = &ctx->style; s = nk_widget(&header, ctx); if (s == NK_WIDGET_INVALID) return 0; in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input; if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT)) is_clicked = nk_true; /* draw combo box header background and border */ if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) { background = &style->combo.active; text.text = style->combo.label_active; } else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) { background = &style->combo.hover; text.text = style->combo.label_hover; } else { background = &style->combo.normal; text.text = style->combo.label_normal; } if (background->type == NK_STYLE_ITEM_IMAGE) { text.background = nk_rgba(0,0,0,0); nk_draw_image(&win->buffer, header, &background->data.image, nk_white); } else { text.background = background->data.color; nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color); nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color); } { /* print currently selected text item */ struct nk_rect label; struct nk_rect button; struct nk_rect content; enum nk_symbol_type sym; if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) sym = style->combo.sym_hover; else if (is_clicked) sym = style->combo.sym_active; else sym = style->combo.sym_normal; /* calculate button */ button.w = header.h - 2 * style->combo.button_padding.y; button.x = (header.x + header.w - header.h) - style->combo.button_padding.x; button.y = header.y + style->combo.button_padding.y; button.h = button.w; content.x = button.x + style->combo.button.padding.x; content.y = button.y + style->combo.button.padding.y; content.w = button.w - 2 * style->combo.button.padding.x; content.h = button.h - 2 * style->combo.button.padding.y; /* draw selected label */ text.padding = nk_vec2(0,0); label.x = header.x + style->combo.content_padding.x; label.y = header.y + style->combo.content_padding.y; label.w = button.x - (style->combo.content_padding.x + style->combo.spacing.x) - label.x;; label.h = header.h - 2 * style->combo.content_padding.y; nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, ctx->style.font); /* draw open/close button */ nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state, &ctx->style.combo.button, sym, style->font); } return nk_combo_begin(ctx, win, size, is_clicked, header); } NK_API int nk_combo_begin_label(struct nk_context *ctx, const char *selected, struct nk_vec2 size) { return nk_combo_begin_text(ctx, selected, nk_strlen(selected), size); } NK_API int nk_combo_begin_color(struct nk_context *ctx, struct nk_color color, struct nk_vec2 size) { struct nk_window *win; struct nk_style *style; const struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; enum nk_widget_layout_states s; const struct nk_style_item *background; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; s = nk_widget(&header, ctx); if (s == NK_WIDGET_INVALID) return 0; in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input; if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT)) is_clicked = nk_true; /* draw combo box header background and border */ if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) background = &style->combo.active; else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) background = &style->combo.hover; else background = &style->combo.normal; if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(&win->buffer, header, &background->data.image,nk_white); } else { nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color); nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color); } { struct nk_rect content; struct nk_rect button; struct nk_rect bounds; enum nk_symbol_type sym; if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) sym = style->combo.sym_hover; else if (is_clicked) sym = style->combo.sym_active; else sym = style->combo.sym_normal; /* calculate button */ button.w = header.h - 2 * style->combo.button_padding.y; button.x = (header.x + header.w - header.h) - style->combo.button_padding.x; button.y = header.y + style->combo.button_padding.y; button.h = button.w; content.x = button.x + style->combo.button.padding.x; content.y = button.y + style->combo.button.padding.y; content.w = button.w - 2 * style->combo.button.padding.x; content.h = button.h - 2 * style->combo.button.padding.y; /* draw color */ bounds.h = header.h - 4 * style->combo.content_padding.y; bounds.y = header.y + 2 * style->combo.content_padding.y; bounds.x = header.x + 2 * style->combo.content_padding.x; bounds.w = (button.x - (style->combo.content_padding.x + style->combo.spacing.x)) - bounds.x; nk_fill_rect(&win->buffer, bounds, 0, color); /* draw open/close button */ nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state, &ctx->style.combo.button, sym, style->font); } return nk_combo_begin(ctx, win, size, is_clicked, header); } NK_API int nk_combo_begin_symbol(struct nk_context *ctx, enum nk_symbol_type symbol, struct nk_vec2 size) { struct nk_window *win; struct nk_style *style; const struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; enum nk_widget_layout_states s; const struct nk_style_item *background; struct nk_color sym_background; struct nk_color symbol_color; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; s = nk_widget(&header, ctx); if (s == NK_WIDGET_INVALID) return 0; in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input; if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT)) is_clicked = nk_true; /* draw combo box header background and border */ if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) { background = &style->combo.active; symbol_color = style->combo.symbol_active; } else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) { background = &style->combo.hover; symbol_color = style->combo.symbol_hover; } else { background = &style->combo.normal; symbol_color = style->combo.symbol_hover; } if (background->type == NK_STYLE_ITEM_IMAGE) { sym_background = nk_rgba(0,0,0,0); nk_draw_image(&win->buffer, header, &background->data.image, nk_white); } else { sym_background = background->data.color; nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color); nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color); } { struct nk_rect bounds = {0,0,0,0}; struct nk_rect content; struct nk_rect button; enum nk_symbol_type sym; if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) sym = style->combo.sym_hover; else if (is_clicked) sym = style->combo.sym_active; else sym = style->combo.sym_normal; /* calculate button */ button.w = header.h - 2 * style->combo.button_padding.y; button.x = (header.x + header.w - header.h) - style->combo.button_padding.y; button.y = header.y + style->combo.button_padding.y; button.h = button.w; content.x = button.x + style->combo.button.padding.x; content.y = button.y + style->combo.button.padding.y; content.w = button.w - 2 * style->combo.button.padding.x; content.h = button.h - 2 * style->combo.button.padding.y; /* draw symbol */ bounds.h = header.h - 2 * style->combo.content_padding.y; bounds.y = header.y + style->combo.content_padding.y; bounds.x = header.x + style->combo.content_padding.x; bounds.w = (button.x - style->combo.content_padding.y) - bounds.x; nk_draw_symbol(&win->buffer, symbol, bounds, sym_background, symbol_color, 1.0f, style->font); /* draw open/close button */ nk_draw_button_symbol(&win->buffer, &bounds, &content, ctx->last_widget_state, &ctx->style.combo.button, sym, style->font); } return nk_combo_begin(ctx, win, size, is_clicked, header); } NK_API int nk_combo_begin_symbol_text(struct nk_context *ctx, const char *selected, int len, enum nk_symbol_type symbol, struct nk_vec2 size) { struct nk_window *win; struct nk_style *style; struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; enum nk_widget_layout_states s; const struct nk_style_item *background; struct nk_color symbol_color; struct nk_text text; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; s = nk_widget(&header, ctx); if (!s) return 0; in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input; if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT)) is_clicked = nk_true; /* draw combo box header background and border */ if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) { background = &style->combo.active; symbol_color = style->combo.symbol_active; text.text = style->combo.label_active; } else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) { background = &style->combo.hover; symbol_color = style->combo.symbol_hover; text.text = style->combo.label_hover; } else { background = &style->combo.normal; symbol_color = style->combo.symbol_normal; text.text = style->combo.label_normal; } if (background->type == NK_STYLE_ITEM_IMAGE) { text.background = nk_rgba(0,0,0,0); nk_draw_image(&win->buffer, header, &background->data.image, nk_white); } else { text.background = background->data.color; nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color); nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color); } { struct nk_rect content; struct nk_rect button; struct nk_rect label; struct nk_rect image; enum nk_symbol_type sym; if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) sym = style->combo.sym_hover; else if (is_clicked) sym = style->combo.sym_active; else sym = style->combo.sym_normal; /* calculate button */ button.w = header.h - 2 * style->combo.button_padding.y; button.x = (header.x + header.w - header.h) - style->combo.button_padding.x; button.y = header.y + style->combo.button_padding.y; button.h = button.w; content.x = button.x + style->combo.button.padding.x; content.y = button.y + style->combo.button.padding.y; content.w = button.w - 2 * style->combo.button.padding.x; content.h = button.h - 2 * style->combo.button.padding.y; nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state, &ctx->style.combo.button, sym, style->font); /* draw symbol */ image.x = header.x + style->combo.content_padding.x; image.y = header.y + style->combo.content_padding.y; image.h = header.h - 2 * style->combo.content_padding.y; image.w = image.h; nk_draw_symbol(&win->buffer, symbol, image, text.background, symbol_color, 1.0f, style->font); /* draw label */ text.padding = nk_vec2(0,0); label.x = image.x + image.w + style->combo.spacing.x + style->combo.content_padding.x; label.y = header.y + style->combo.content_padding.y; label.w = (button.x - style->combo.content_padding.x) - label.x; label.h = header.h - 2 * style->combo.content_padding.y; nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, style->font); } return nk_combo_begin(ctx, win, size, is_clicked, header); } NK_API int nk_combo_begin_image(struct nk_context *ctx, struct nk_image img, struct nk_vec2 size) { struct nk_window *win; struct nk_style *style; const struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; enum nk_widget_layout_states s; const struct nk_style_item *background; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; s = nk_widget(&header, ctx); if (s == NK_WIDGET_INVALID) return 0; in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input; if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT)) is_clicked = nk_true; /* draw combo box header background and border */ if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) background = &style->combo.active; else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) background = &style->combo.hover; else background = &style->combo.normal; if (background->type == NK_STYLE_ITEM_IMAGE) { nk_draw_image(&win->buffer, header, &background->data.image, nk_white); } else { nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color); nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color); } { struct nk_rect bounds = {0,0,0,0}; struct nk_rect content; struct nk_rect button; enum nk_symbol_type sym; if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) sym = style->combo.sym_hover; else if (is_clicked) sym = style->combo.sym_active; else sym = style->combo.sym_normal; /* calculate button */ button.w = header.h - 2 * style->combo.button_padding.y; button.x = (header.x + header.w - header.h) - style->combo.button_padding.y; button.y = header.y + style->combo.button_padding.y; button.h = button.w; content.x = button.x + style->combo.button.padding.x; content.y = button.y + style->combo.button.padding.y; content.w = button.w - 2 * style->combo.button.padding.x; content.h = button.h - 2 * style->combo.button.padding.y; /* draw image */ bounds.h = header.h - 2 * style->combo.content_padding.y; bounds.y = header.y + style->combo.content_padding.y; bounds.x = header.x + style->combo.content_padding.x; bounds.w = (button.x - style->combo.content_padding.y) - bounds.x; nk_draw_image(&win->buffer, bounds, &img, nk_white); /* draw open/close button */ nk_draw_button_symbol(&win->buffer, &bounds, &content, ctx->last_widget_state, &ctx->style.combo.button, sym, style->font); } return nk_combo_begin(ctx, win, size, is_clicked, header); } NK_API int nk_combo_begin_image_text(struct nk_context *ctx, const char *selected, int len, struct nk_image img, struct nk_vec2 size) { struct nk_window *win; struct nk_style *style; struct nk_input *in; struct nk_rect header; int is_clicked = nk_false; enum nk_widget_layout_states s; const struct nk_style_item *background; struct nk_text text; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; win = ctx->current; style = &ctx->style; s = nk_widget(&header, ctx); if (!s) return 0; in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input; if (nk_button_behavior(&ctx->last_widget_state, header, in, NK_BUTTON_DEFAULT)) is_clicked = nk_true; /* draw combo box header background and border */ if (ctx->last_widget_state & NK_WIDGET_STATE_ACTIVED) { background = &style->combo.active; text.text = style->combo.label_active; } else if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) { background = &style->combo.hover; text.text = style->combo.label_hover; } else { background = &style->combo.normal; text.text = style->combo.label_normal; } if (background->type == NK_STYLE_ITEM_IMAGE) { text.background = nk_rgba(0,0,0,0); nk_draw_image(&win->buffer, header, &background->data.image, nk_white); } else { text.background = background->data.color; nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color); nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color); } { struct nk_rect content; struct nk_rect button; struct nk_rect label; struct nk_rect image; enum nk_symbol_type sym; if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER) sym = style->combo.sym_hover; else if (is_clicked) sym = style->combo.sym_active; else sym = style->combo.sym_normal; /* calculate button */ button.w = header.h - 2 * style->combo.button_padding.y; button.x = (header.x + header.w - header.h) - style->combo.button_padding.x; button.y = header.y + style->combo.button_padding.y; button.h = button.w; content.x = button.x + style->combo.button.padding.x; content.y = button.y + style->combo.button.padding.y; content.w = button.w - 2 * style->combo.button.padding.x; content.h = button.h - 2 * style->combo.button.padding.y; nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state, &ctx->style.combo.button, sym, style->font); /* draw image */ image.x = header.x + style->combo.content_padding.x; image.y = header.y + style->combo.content_padding.y; image.h = header.h - 2 * style->combo.content_padding.y; image.w = image.h; nk_draw_image(&win->buffer, image, &img, nk_white); /* draw label */ text.padding = nk_vec2(0,0); label.x = image.x + image.w + style->combo.spacing.x + style->combo.content_padding.x; label.y = header.y + style->combo.content_padding.y; label.w = (button.x - style->combo.content_padding.x) - label.x; label.h = header.h - 2 * style->combo.content_padding.y; nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, style->font); } return nk_combo_begin(ctx, win, size, is_clicked, header); } NK_API int nk_combo_begin_symbol_label(struct nk_context *ctx, const char *selected, enum nk_symbol_type type, struct nk_vec2 size) { return nk_combo_begin_symbol_text(ctx, selected, nk_strlen(selected), type, size); } NK_API int nk_combo_begin_image_label(struct nk_context *ctx, const char *selected, struct nk_image img, struct nk_vec2 size) { return nk_combo_begin_image_text(ctx, selected, nk_strlen(selected), img, size); } NK_API int nk_combo_item_text(struct nk_context *ctx, const char *text, int len,nk_flags align) { return nk_contextual_item_text(ctx, text, len, align); } NK_API int nk_combo_item_label(struct nk_context *ctx, const char *label, nk_flags align) { return nk_contextual_item_label(ctx, label, align); } NK_API int nk_combo_item_image_text(struct nk_context *ctx, struct nk_image img, const char *text, int len, nk_flags alignment) { return nk_contextual_item_image_text(ctx, img, text, len, alignment); } NK_API int nk_combo_item_image_label(struct nk_context *ctx, struct nk_image img, const char *text, nk_flags alignment) { return nk_contextual_item_image_label(ctx, img, text, alignment); } NK_API int nk_combo_item_symbol_text(struct nk_context *ctx, enum nk_symbol_type sym, const char *text, int len, nk_flags alignment) { return nk_contextual_item_symbol_text(ctx, sym, text, len, alignment); } NK_API int nk_combo_item_symbol_label(struct nk_context *ctx, enum nk_symbol_type sym, const char *label, nk_flags alignment) { return nk_contextual_item_symbol_label(ctx, sym, label, alignment); } NK_API void nk_combo_end(struct nk_context *ctx) { nk_contextual_end(ctx); } NK_API void nk_combo_close(struct nk_context *ctx) { nk_contextual_close(ctx); } NK_API int nk_combo(struct nk_context *ctx, const char **items, int count, int selected, int item_height, struct nk_vec2 size) { int i = 0; int max_height; struct nk_vec2 item_spacing; struct nk_vec2 window_padding; NK_ASSERT(ctx); NK_ASSERT(items); NK_ASSERT(ctx->current); if (!ctx || !items ||!count) return selected; item_spacing = ctx->style.window.spacing; window_padding = nk_panel_get_padding(&ctx->style, ctx->current->layout->type); max_height = count * item_height + count * (int)item_spacing.y; max_height += (int)item_spacing.y * 2 + (int)window_padding.y * 2; size.y = NK_MIN(size.y, (float)max_height); if (nk_combo_begin_label(ctx, items[selected], size)) { nk_layout_row_dynamic(ctx, (float)item_height, 1); for (i = 0; i < count; ++i) { if (nk_combo_item_label(ctx, items[i], NK_TEXT_LEFT)) selected = i; } nk_combo_end(ctx); } return selected; } NK_API int nk_combo_separator(struct nk_context *ctx, const char *items_separated_by_separator, int separator, int selected, int count, int item_height, struct nk_vec2 size) { int i; int max_height; struct nk_vec2 item_spacing; struct nk_vec2 window_padding; const char *current_item; const char *iter; int length = 0; NK_ASSERT(ctx); NK_ASSERT(items_separated_by_separator); if (!ctx || !items_separated_by_separator) return selected; /* calculate popup window */ item_spacing = ctx->style.window.spacing; window_padding = nk_panel_get_padding(&ctx->style, ctx->current->layout->type); max_height = count * item_height + count * (int)item_spacing.y; max_height += (int)item_spacing.y * 2 + (int)window_padding.y * 2; size.y = NK_MIN(size.y, (float)max_height); /* find selected item */ current_item = items_separated_by_separator; for (i = 0; i < count; ++i) { iter = current_item; while (*iter && *iter != separator) iter++; length = (int)(iter - current_item); if (i == selected) break; current_item = iter + 1; } if (nk_combo_begin_text(ctx, current_item, length, size)) { current_item = items_separated_by_separator; nk_layout_row_dynamic(ctx, (float)item_height, 1); for (i = 0; i < count; ++i) { iter = current_item; while (*iter && *iter != separator) iter++; length = (int)(iter - current_item); if (nk_combo_item_text(ctx, current_item, length, NK_TEXT_LEFT)) selected = i; current_item = current_item + length + 1; } nk_combo_end(ctx); } return selected; } NK_API int nk_combo_string(struct nk_context *ctx, const char *items_separated_by_zeros, int selected, int count, int item_height, struct nk_vec2 size) { return nk_combo_separator(ctx, items_separated_by_zeros, '\0', selected, count, item_height, size); } NK_API int nk_combo_callback(struct nk_context *ctx, void(*item_getter)(void*, int, const char**), void *userdata, int selected, int count, int item_height, struct nk_vec2 size) { int i; int max_height; struct nk_vec2 item_spacing; struct nk_vec2 window_padding; const char *item; NK_ASSERT(ctx); NK_ASSERT(item_getter); if (!ctx || !item_getter) return selected; /* calculate popup window */ item_spacing = ctx->style.window.spacing; window_padding = nk_panel_get_padding(&ctx->style, ctx->current->layout->type); max_height = count * item_height + count * (int)item_spacing.y; max_height += (int)item_spacing.y * 2 + (int)window_padding.y * 2; size.y = NK_MIN(size.y, (float)max_height); item_getter(userdata, selected, &item); if (nk_combo_begin_label(ctx, item, size)) { nk_layout_row_dynamic(ctx, (float)item_height, 1); for (i = 0; i < count; ++i) { item_getter(userdata, i, &item); if (nk_combo_item_label(ctx, item, NK_TEXT_LEFT)) selected = i; } nk_combo_end(ctx); } return selected; } NK_API void nk_combobox(struct nk_context *ctx, const char **items, int count, int *selected, int item_height, struct nk_vec2 size) { *selected = nk_combo(ctx, items, count, *selected, item_height, size); } NK_API void nk_combobox_string(struct nk_context *ctx, const char *items_separated_by_zeros, int *selected, int count, int item_height, struct nk_vec2 size) { *selected = nk_combo_string(ctx, items_separated_by_zeros, *selected, count, item_height, size); } NK_API void nk_combobox_separator(struct nk_context *ctx, const char *items_separated_by_separator, int separator,int *selected, int count, int item_height, struct nk_vec2 size) { *selected = nk_combo_separator(ctx, items_separated_by_separator, separator, *selected, count, item_height, size); } NK_API void nk_combobox_callback(struct nk_context *ctx, void(*item_getter)(void* data, int id, const char **out_text), void *userdata, int *selected, int count, int item_height, struct nk_vec2 size) { *selected = nk_combo_callback(ctx, item_getter, userdata, *selected, count, item_height, size); } /* =============================================================== * * TOOLTIP * * ===============================================================*/ NK_API int nk_tooltip_begin(struct nk_context *ctx, float width) { int x,y,w,h; struct nk_window *win; const struct nk_input *in; struct nk_rect bounds; int ret; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); if (!ctx || !ctx->current || !ctx->current->layout) return 0; /* make sure that no nonblocking popup is currently active */ win = ctx->current; in = &ctx->input; if (win->popup.win && (win->popup.type & NK_PANEL_SET_NONBLOCK)) return 0; w = nk_iceilf(width); h = nk_iceilf(nk_null_rect.h); x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x; y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y; bounds.x = (float)x; bounds.y = (float)y; bounds.w = (float)w; bounds.h = (float)h; ret = nk_popup_begin(ctx, NK_POPUP_DYNAMIC, "__##Tooltip##__", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER, bounds); if (ret) win->layout->flags &= ~(nk_flags)NK_WINDOW_ROM; win->popup.type = NK_PANEL_TOOLTIP; ctx->current->layout->type = NK_PANEL_TOOLTIP; return ret; } NK_API void nk_tooltip_end(struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); if (!ctx || !ctx->current) return; ctx->current->seq--; nk_popup_close(ctx); nk_popup_end(ctx); } NK_API void nk_tooltip(struct nk_context *ctx, const char *text) { const struct nk_style *style; struct nk_vec2 padding; int text_len; float text_width; float text_height; NK_ASSERT(ctx); NK_ASSERT(ctx->current); NK_ASSERT(ctx->current->layout); NK_ASSERT(text); if (!ctx || !ctx->current || !ctx->current->layout || !text) return; /* fetch configuration data */ style = &ctx->style; padding = style->window.padding; /* calculate size of the text and tooltip */ text_len = nk_strlen(text); text_width = style->font->width(style->font->userdata, style->font->height, text, text_len); text_width += (4 * padding.x); text_height = (style->font->height + 2 * padding.y); /* execute tooltip and fill with text */ if (nk_tooltip_begin(ctx, (float)text_width)) { nk_layout_row_dynamic(ctx, (float)text_height, 1); nk_text(ctx, text, text_len, NK_TEXT_LEFT); nk_tooltip_end(ctx); } } #ifdef NK_INCLUDE_STANDARD_VARARGS NK_API void nk_tooltipf(struct nk_context *ctx, const char *fmt, ...) { va_list args; va_start(args, fmt); nk_tooltipfv(ctx, fmt, args); va_end(args); } NK_API void nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) { char buf[256]; nk_strfmt(buf, NK_LEN(buf), fmt, args); nk_tooltip(ctx, buf); } #endif #endif /* NK_IMPLEMENTATION */ /* /// ## License /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~none /// ------------------------------------------------------------------------------ /// This software is available under 2 licenses -- choose whichever you prefer. /// ------------------------------------------------------------------------------ /// ALTERNATIVE A - MIT License /// Copyright (c) 2016-2018 Micha Mettke /// 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. /// ------------------------------------------------------------------------------ /// ALTERNATIVE B - Public Domain (www.unlicense.org) /// This is free and unencumbered software released into the public domain. /// Anyone is free to copy, modify, publish, use, compile, sell, or distribute this /// software, either in source code form or as a compiled binary, for any purpose, /// commercial or non-commercial, and by any means. /// In jurisdictions that recognize copyright laws, the author or authors of this /// software dedicate any and all copyright interest in the software to the public /// domain. We make this dedication for the benefit of the public at large and to /// the detriment of our heirs and successors. We intend this dedication to be an /// overt act of relinquishment in perpetuity of all present and future rights to /// this software under copyright law. /// 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 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. /// ------------------------------------------------------------------------------ /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// ## Changelog /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~none /// [date][x.yy.zz]-[description] /// -[date]: date on which the change has been pushed /// -[x.yy.zz]: Numerical version string representation. Each version number on the right /// resets back to zero if version on the left is incremented. /// - [x]: Major version with API and library breaking changes /// - [yy]: Minor version with non-breaking API and library changes /// - [zz]: Bug fix version with no direct changes to API /// /// - 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame /// - 2018/04/01 (4.00.0) - BREAKING CHANGE: nk_draw_list_clear no longer tries to /// clear provided buffers. So make sure to either free /// or clear each passed buffer after calling nk_convert. /// - 2018/02/23 (3.00.6) - Fixed slider dragging behavior /// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process /// - 2018/01/31 (3.00.4) - Removed name collision with stb_truetype /// - 2018/01/28 (3.00.3) - Fixed panel window border drawing bug /// - 2018/01/12 (3.00.2) - Added `nk_group_begin_titled` for separed group identifier and title /// - 2018/01/07 (3.00.1) - Started to change documentation style /// - 2018/01/05 (3.00.0) - BREAKING CHANGE: The previous color picker API was broken /// because of conversions between float and byte color representation. /// Color pickers now use floating point values to represent /// HSV values. To get back the old behavior I added some additional /// color conversion functions to cast between nk_color and /// nk_colorf. /// - 2017/12/23 (2.00.7) - Fixed small warning /// - 2017/12/23 (2.00.7) - Fixed nk_edit_buffer behavior if activated to allow input /// - 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior /// - 2017/12/04 (2.00.6) - Added formated string tooltip widget /// - 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag NK_WINDOW_NO_INPUT /// - 2017/11/15 (2.00.4) - Fixed font merging /// - 2017/11/07 (2.00.3) - Fixed window size and position modifier functions /// - 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior /// - 2017/09/14 (2.00.1) - Fixed window closing behavior /// - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now /// require the name of the window and must happen outside the window /// building process (between function call nk_begin and nk_end). /// - 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last /// - 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows /// - 2017/08/27 (1.40.7) - Fixed window background flag /// - 2017/07/07 (1.40.6) - Fixed missing clipping rect check for hovering/clicked /// query for widgets /// - 2017/07/07 (1.40.5) - Fixed drawing bug for vertex output for lines and stroked /// and filled rectangles /// - 2017/07/07 (1.40.4) - Fixed bug in nk_convert trying to add windows that are in /// process of being destroyed. /// - 2017/07/07 (1.40.3) - Fixed table internal bug caused by storing table size in /// window instead of directly in table. /// - 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro /// - 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero /// - 2017/06/08 (1.40.0) - Removed the breaking part of last commit. Auto layout now only /// comes in effect if you pass in zero was row height argument /// - 2017/06/08 (1.40.0) - BREAKING CHANGE: while not directly API breaking it will change /// how layouting works. From now there will be an internal minimum /// row height derived from font height. If you need a row smaller than /// that you can directly set it by `nk_layout_set_min_row_height` and /// reset the value back by calling `nk_layout_reset_min_row_height. /// - 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix /// - 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a nk_layout_xxx function /// - 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer /// - 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped /// - 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries /// - 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space /// - 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size /// - 2017/05/06 (1.38.0) - Added platform double-click support /// - 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends /// - 2017/04/20 (1.37.0) - Extended properties with selection and clipbard support /// - 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing /// - 2017/04/09 (1.36.1) - Fixed #403 with another widget float error /// - 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags /// - 2017/04/09 (1.35.3) - Fixed buffer heap corruption /// - 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows /// - 2017/03/25 (1.35.1) - Fixed windows closing behavior /// - 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377 /// - 2017/03/18 (1.34.3) - Fixed long window header titles /// - 2017/03/04 (1.34.2) - Fixed text edit filtering /// - 2017/03/04 (1.34.1) - Fixed group closable flag /// - 2017/02/25 (1.34.0) - Added custom draw command for better language binding support /// - 2017/01/24 (1.33.0) - Added programatic way of remove edit focus /// - 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows /// - 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows /// - 2017/01/21 (1.32.1) - Fixed slider behavior and drawing /// - 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner /// - 2017/01/13 (1.31.0) - Added additional row layouting method to combine both /// dynamic and static widgets. /// - 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit /// - 2016/12/31 (1.29.2)- Fixed closing window bug of minimized windows /// - 2016/12/03 (1.29.1)- Fixed wrapped text with no seperator and C89 error /// - 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters /// - 2016/11/22 (1.28.6)- Fixed window minimized closing bug /// - 2016/11/19 (1.28.5)- Fixed abstract combo box closing behavior /// - 2016/11/19 (1.28.4)- Fixed tooltip flickering /// - 2016/11/19 (1.28.3)- Fixed memory leak caused by popup repeated closing /// - 2016/11/18 (1.28.2)- Fixed memory leak caused by popup panel allocation /// - 2016/11/10 (1.28.1)- Fixed some warnings and C++ error /// - 2016/11/10 (1.28.0)- Added additional `nk_button` versions which allows to directly /// pass in a style struct to change buttons visual. /// - 2016/11/10 (1.27.0)- Added additional 'nk_tree' versions to support external state /// storage. Just like last the `nk_group` commit the main /// advantage is that you optionally can minimize nuklears runtime /// memory consumption or handle hash collisions. /// - 2016/11/09 (1.26.0)- Added additional `nk_group` version to support external scrollbar /// offset storage. Main advantage is that you can externalize /// the memory management for the offset. It could also be helpful /// if you have a hash collision in `nk_group_begin` but really /// want the name. In addition I added `nk_list_view` which allows /// to draw big lists inside a group without actually having to /// commit the whole list to nuklear (issue #269). /// - 2016/10/30 (1.25.1)- Fixed clipping rectangle bug inside `nk_draw_list` /// - 2016/10/29 (1.25.0)- Pulled `nk_panel` memory management into nuklear and out of /// the hands of the user. From now on users don't have to care /// about panels unless they care about some information. If you /// still need the panel just call `nk_window_get_panel`. /// - 2016/10/21 (1.24.0)- Changed widget border drawing to stroked rectangle from filled /// rectangle for less overdraw and widget background transparency. /// - 2016/10/18 (1.23.0)- Added `nk_edit_focus` for manually edit widget focus control /// - 2016/09/29 (1.22.7)- Fixed deduction of basic type in non `` compilation /// - 2016/09/29 (1.22.6)- Fixed edit widget UTF-8 text cursor drawing bug /// - 2016/09/28 (1.22.5)- Fixed edit widget UTF-8 text appending/inserting/removing /// - 2016/09/28 (1.22.4)- Fixed drawing bug inside edit widgets which offset all text /// text in every edit widget if one of them is scrolled. /// - 2016/09/28 (1.22.3)- Fixed small bug in edit widgets if not active. The wrong /// text length is passed. It should have been in bytes but /// was passed as glyphes. /// - 2016/09/20 (1.22.2)- Fixed color button size calculation /// - 2016/09/20 (1.22.1)- Fixed some `nk_vsnprintf` behavior bugs and removed /// `` again from `NK_INCLUDE_STANDARD_VARARGS`. /// - 2016/09/18 (1.22.0)- C89 does not support vsnprintf only C99 and newer as well /// as C++11 and newer. In addition to use vsnprintf you have /// to include . So just defining `NK_INCLUDE_STD_VAR_ARGS` /// is not enough. That behavior is now fixed. By default if /// both varargs as well as stdio is selected I try to use /// vsnprintf if not possible I will revert to vsprintf. If /// varargs but not stdio was defined I will use my own function. /// - 2016/09/15 (1.21.2)- Fixed panel `close` behavior for deeper panel levels /// - 2016/09/15 (1.21.1)- Fixed C++ errors and wrong argument to `nk_panel_get_xxxx` /// - 2016/09/13 (1.21.0) - !BREAKING! Fixed nonblocking popup behavior in menu, combo, /// and contextual which prevented closing in y-direction if /// popup did not reach max height. /// In addition the height parameter was changed into vec2 /// for width and height to have more control over the popup size. /// - 2016/09/13 (1.20.3) - Cleaned up and extended type selection /// - 2016/09/13 (1.20.2)- Fixed slider behavior hopefully for the last time. This time /// all calculation are correct so no more hackery. /// - 2016/09/13 (1.20.1)- Internal change to divide window/panel flags into panel flags and types. /// Suprisinly spend years in C and still happened to confuse types /// with flags. Probably something to take note. /// - 2016/09/08 (1.20.0)- Added additional helper function to make it easier to just /// take the produced buffers from `nk_convert` and unplug the /// iteration process from `nk_context`. So now you can /// just use the vertex,element and command buffer + two pointer /// inside the command buffer retrieved by calls `nk__draw_begin` /// and `nk__draw_end` and macro `nk_draw_foreach_bounded`. /// - 2016/09/08 (1.19.0)- Added additional asserts to make sure every `nk_xxx_begin` call /// for windows, popups, combobox, menu and contextual is guarded by /// `if` condition and does not produce false drawing output. /// - 2016/09/08 (1.18.0)- Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT` /// to hopefully easier to understand `NK_SYMBOL_RECT_FILLED` and /// `NK_SYMBOL_RECT_OUTLINE`. /// - 2016/09/08 (1.17.0)- Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE` /// to hopefully easier to understand `NK_SYMBOL_CIRCLE_FILLED` and /// `NK_SYMBOL_CIRCLE_OUTLINE`. /// - 2016/09/08 (1.16.0)- Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES` /// is not defined by supporting the biggest compiler GCC, clang and MSVC. /// - 2016/09/07 (1.15.3)- Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error /// - 2016/09/04 (1.15.2)- Fixed wrong combobox height calculation /// - 2016/09/03 (1.15.1)- Fixed gaps inside combo boxes in OpenGL /// - 2016/09/02 (1.15.0) - Changed nuklear to not have any default vertex layout and /// instead made it user provided. The range of types to convert /// to is quite limited at the moment, but I would be more than /// happy to accept PRs to add additional. /// - 2016/08/30 (1.14.2) - Removed unused variables /// - 2016/08/30 (1.14.1) - Fixed C++ build errors /// - 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly /// - 2016/08/30 (1.13.4) - Tweaked some default styling variables /// - 2016/08/30 (1.13.3) - Hopefully fixed drawing bug in slider, in general I would /// refrain from using slider with a big number of steps. /// - 2016/08/30 (1.13.2) - Fixed close and minimize button which would fire even if the /// window was in Read Only Mode. /// - 2016/08/30 (1.13.1) - Fixed popup panel padding handling which was previously just /// a hack for combo box and menu. /// - 2016/08/30 (1.13.0) - Removed `NK_WINDOW_DYNAMIC` flag from public API since /// it is bugged and causes issues in window selection. /// - 2016/08/30 (1.12.0) - Removed scaler size. The size of the scaler is now /// determined by the scrollbar size /// - 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11 /// - 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection /// - 2016/08/30 (1.11.0) - Removed some internal complexity and overly complex code /// handling panel padding and panel border. /// - 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx` /// - 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups /// - 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes /// - 2016/08/26 (1.10.0) - Added window name string prepresentation to account for /// hash collisions. Currently limited to NK_WINDOW_MAX_NAME /// which in term can be redefined if not big enough. /// - 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code /// - 2016/08/25 (1.10.0) - Changed `nk_input_is_key_pressed` and 'nk_input_is_key_released' /// to account for key press and release happening in one frame. /// - 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate /// - 2016/08/17 (1.09.6)- Removed invalid check for value zero in nk_propertyx /// - 2016/08/16 (1.09.5)- Fixed ROM mode for deeper levels of popup windows parents. /// - 2016/08/15 (1.09.4)- Editbox are now still active if enter was pressed with flag /// `NK_EDIT_SIG_ENTER`. Main reasoning is to be able to keep /// typing after commiting. /// - 2016/08/15 (1.09.4)- Removed redundant code /// - 2016/08/15 (1.09.4)- Fixed negative numbers in `nk_strtoi` and remove unused variable /// - 2016/08/15 (1.09.3)- Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background /// window only as selected by hovering and not by clicking. /// - 2016/08/14 (1.09.2)- Fixed a bug in font atlas which caused wrong loading /// of glyphes for font with multiple ranges. /// - 2016/08/12 (1.09.1)- Added additional function to check if window is currently /// hidden and therefore not visible. /// - 2016/08/12 (1.09.1)- nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED` /// instead of the old flag `NK_WINDOW_HIDDEN` /// - 2016/08/09 (1.09.0) - Added additional double version to nk_property and changed /// the underlying implementation to not cast to float and instead /// work directly on the given values. /// - 2016/08/09 (1.08.0) - Added additional define to overwrite library internal /// floating pointer number to string conversion for additional /// precision. /// - 2016/08/09 (1.08.0) - Added additional define to overwrite library internal /// string to floating point number conversion for additional /// precision. /// - 2016/08/08 (1.07.2)- Fixed compiling error without define NK_INCLUDE_FIXED_TYPE /// - 2016/08/08 (1.07.1)- Fixed possible floating point error inside `nk_widget` leading /// to wrong wiget width calculation which results in widgets falsly /// becomming tagged as not inside window and cannot be accessed. /// - 2016/08/08 (1.07.0) - Nuklear now differentiates between hiding a window (NK_WINDOW_HIDDEN) and /// closing a window (NK_WINDOW_CLOSED). A window can be hidden/shown /// by using `nk_window_show` and closed by either clicking the close /// icon in a window or by calling `nk_window_close`. Only closed /// windows get removed at the end of the frame while hidden windows /// remain. /// - 2016/08/08 (1.06.0) - Added `nk_edit_string_zero_terminated` as a second option to /// `nk_edit_string` which takes, edits and outputs a '\0' terminated string. /// - 2016/08/08 (1.05.4)- Fixed scrollbar auto hiding behavior /// - 2016/08/08 (1.05.3)- Fixed wrong panel padding selection in `nk_layout_widget_space` /// - 2016/08/07 (1.05.2)- Fixed old bug in dynamic immediate mode layout API, calculating /// wrong item spacing and panel width. ///- 2016/08/07 (1.05.1)- Hopefully finally fixed combobox popup drawing bug ///- 2016/08/07 (1.05.0) - Split varargs away from NK_INCLUDE_STANDARD_IO into own /// define NK_INCLUDE_STANDARD_VARARGS to allow more fine /// grained controlled over library includes. /// - 2016/08/06 (1.04.5)- Changed memset calls to NK_MEMSET /// - 2016/08/04 (1.04.4)- Fixed fast window scaling behavior /// - 2016/08/04 (1.04.3)- Fixed window scaling, movement bug which appears if you /// move/scale a window and another window is behind it. /// If you are fast enough then the window behind gets activated /// and the operation is blocked. I now require activating /// by hovering only if mouse is not pressed. /// - 2016/08/04 (1.04.2)- Fixed changing fonts /// - 2016/08/03 (1.04.1)- Fixed `NK_WINDOW_BACKGROUND` behavior /// - 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image` /// - 2016/08/03 (1.04.0) - Added additional window padding style attributes for /// sub windows (combo, menu, ...) /// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor /// - 2016/08/03 (1.04.0) - Added `NK_WINDOW_BACKGROUND` flag to force a window /// to be always in the background of the screen /// - 2016/08/03 (1.03.2)- Removed invalid assert macro for NK_RGB color picker /// - 2016/08/01 (1.03.1)- Added helper macros into header include guard /// - 2016/07/29 (1.03.0) - Moved the window/table pool into the header part to /// simplify memory management by removing the need to /// allocate the pool. /// - 2016/07/29 (1.02.0) - Added auto scrollbar hiding window flag which if enabled /// will hide the window scrollbar after NK_SCROLLBAR_HIDING_TIMEOUT /// seconds without window interaction. To make it work /// you have to also set a delta time inside the `nk_context`. /// - 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs /// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context` /// - 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument /// - 2016/07/15 (1.01.0) - Removed internal font baking API and simplified /// font atlas memory management by converting pointer /// arrays for fonts and font configurations to lists. /// - 2016/07/15 (1.00.0) - Changed button API to use context dependend button /// behavior instead of passing it for every function call. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// ## Gallery /// ![Figure [blue]: Feature overview with blue color styling](https://cloud.githubusercontent.com/assets/8057201/13538240/acd96876-e249-11e5-9547-5ac0b19667a0.png) /// ![Figure [red]: Feature overview with red color styling](https://cloud.githubusercontent.com/assets/8057201/13538243/b04acd4c-e249-11e5-8fd2-ad7744a5b446.png) /// ![Figure [widgets]: Widget overview](https://cloud.githubusercontent.com/assets/8057201/11282359/3325e3c6-8eff-11e5-86cb-cf02b0596087.png) /// ![Figure [blackwhite]: Black and white](https://cloud.githubusercontent.com/assets/8057201/11033668/59ab5d04-86e5-11e5-8091-c56f16411565.png) /// ![Figure [filexp]: File explorer](https://cloud.githubusercontent.com/assets/8057201/10718115/02a9ba08-7b6b-11e5-950f-adacdd637739.png) /// ![Figure [opengl]: OpenGL Editor](https://cloud.githubusercontent.com/assets/8057201/12779619/2a20d72c-ca69-11e5-95fe-4edecf820d5c.png) /// ![Figure [nodedit]: Node Editor](https://cloud.githubusercontent.com/assets/8057201/9976995/e81ac04a-5ef7-11e5-872b-acd54fbeee03.gif) /// ![Figure [skinning]: Using skinning in Nuklear](https://cloud.githubusercontent.com/assets/8057201/15991632/76494854-30b8-11e6-9555-a69840d0d50b.png) /// ![Figure [bf]: Heavy modified version](https://cloud.githubusercontent.com/assets/8057201/14902576/339926a8-0d9c-11e6-9fee-a8b73af04473.png) /// /// ## Credits /// Developed by Micha Mettke and every direct or indirect github contributor.

/// /// Embeds [stb_texedit](https://github.com/nothings/stb/blob/master/stb_textedit.h), [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) and [stb_rectpack](https://github.com/nothings/stb/blob/master/stb_rect_pack.h) by Sean Barret (public domain)
/// Uses [stddoc.c](https://github.com/r-lyeh/stddoc.c) from r-lyeh@github.com for documentation generation

/// Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license).
/// /// Big thank you to Omar Cornut (ocornut@github) for his [imgui library](https://github.com/ocornut/imgui) and /// giving me the inspiration for this library, Casey Muratori for handmade hero /// and his original immediate mode graphical user interface idea and Sean /// Barret for his amazing single header libraries which restored my faith /// in libraries and brought me to create some of my own. Finally Apoorva Joshi /// for his single header file packer. */ ================================================ FILE: thirdparty/glfw/deps/nuklear_glfw_gl2.h ================================================ /* * Nuklear - v1.32.0 - public domain * no warrenty implied; use at your own risk. * authored from 2015-2017 by Micha Mettke */ /* * ============================================================== * * API * * =============================================================== */ #ifndef NK_GLFW_GL2_H_ #define NK_GLFW_GL2_H_ #include enum nk_glfw_init_state{ NK_GLFW3_DEFAULT = 0, NK_GLFW3_INSTALL_CALLBACKS }; NK_API struct nk_context* nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state); NK_API void nk_glfw3_font_stash_begin(struct nk_font_atlas **atlas); NK_API void nk_glfw3_font_stash_end(void); NK_API void nk_glfw3_new_frame(void); NK_API void nk_glfw3_render(enum nk_anti_aliasing); NK_API void nk_glfw3_shutdown(void); NK_API void nk_glfw3_char_callback(GLFWwindow *win, unsigned int codepoint); NK_API void nk_gflw3_scroll_callback(GLFWwindow *win, double xoff, double yoff); #endif /* * ============================================================== * * IMPLEMENTATION * * =============================================================== */ #ifdef NK_GLFW_GL2_IMPLEMENTATION #ifndef NK_GLFW_TEXT_MAX #define NK_GLFW_TEXT_MAX 256 #endif #ifndef NK_GLFW_DOUBLE_CLICK_LO #define NK_GLFW_DOUBLE_CLICK_LO 0.02 #endif #ifndef NK_GLFW_DOUBLE_CLICK_HI #define NK_GLFW_DOUBLE_CLICK_HI 0.2 #endif struct nk_glfw_device { struct nk_buffer cmds; struct nk_draw_null_texture null; GLuint font_tex; }; struct nk_glfw_vertex { float position[2]; float uv[2]; nk_byte col[4]; }; static struct nk_glfw { GLFWwindow *win; int width, height; int display_width, display_height; struct nk_glfw_device ogl; struct nk_context ctx; struct nk_font_atlas atlas; struct nk_vec2 fb_scale; unsigned int text[NK_GLFW_TEXT_MAX]; int text_len; struct nk_vec2 scroll; double last_button_click; int is_double_click_down; struct nk_vec2 double_click_pos; } glfw; NK_INTERN void nk_glfw3_device_upload_atlas(const void *image, int width, int height) { struct nk_glfw_device *dev = &glfw.ogl; glGenTextures(1, &dev->font_tex); glBindTexture(GL_TEXTURE_2D, dev->font_tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image); } NK_API void nk_glfw3_render(enum nk_anti_aliasing AA) { /* setup global state */ struct nk_glfw_device *dev = &glfw.ogl; glPushAttrib(GL_ENABLE_BIT|GL_COLOR_BUFFER_BIT|GL_TRANSFORM_BIT); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glEnable(GL_SCISSOR_TEST); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* setup viewport/project */ glViewport(0,0,(GLsizei)glfw.display_width,(GLsizei)glfw.display_height); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0.0f, glfw.width, glfw.height, 0.0f, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_COLOR_ARRAY); { GLsizei vs = sizeof(struct nk_glfw_vertex); size_t vp = offsetof(struct nk_glfw_vertex, position); size_t vt = offsetof(struct nk_glfw_vertex, uv); size_t vc = offsetof(struct nk_glfw_vertex, col); /* convert from command queue into draw list and draw to screen */ const struct nk_draw_command *cmd; const nk_draw_index *offset = NULL; struct nk_buffer vbuf, ebuf; /* fill convert configuration */ struct nk_convert_config config; static const struct nk_draw_vertex_layout_element vertex_layout[] = { {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct nk_glfw_vertex, position)}, {NK_VERTEX_TEXCOORD, NK_FORMAT_FLOAT, NK_OFFSETOF(struct nk_glfw_vertex, uv)}, {NK_VERTEX_COLOR, NK_FORMAT_R8G8B8A8, NK_OFFSETOF(struct nk_glfw_vertex, col)}, {NK_VERTEX_LAYOUT_END} }; NK_MEMSET(&config, 0, sizeof(config)); config.vertex_layout = vertex_layout; config.vertex_size = sizeof(struct nk_glfw_vertex); config.vertex_alignment = NK_ALIGNOF(struct nk_glfw_vertex); config.null = dev->null; config.circle_segment_count = 22; config.curve_segment_count = 22; config.arc_segment_count = 22; config.global_alpha = 1.0f; config.shape_AA = AA; config.line_AA = AA; /* convert shapes into vertexes */ nk_buffer_init_default(&vbuf); nk_buffer_init_default(&ebuf); nk_convert(&glfw.ctx, &dev->cmds, &vbuf, &ebuf, &config); /* setup vertex buffer pointer */ {const void *vertices = nk_buffer_memory_const(&vbuf); glVertexPointer(2, GL_FLOAT, vs, (const void*)((const nk_byte*)vertices + vp)); glTexCoordPointer(2, GL_FLOAT, vs, (const void*)((const nk_byte*)vertices + vt)); glColorPointer(4, GL_UNSIGNED_BYTE, vs, (const void*)((const nk_byte*)vertices + vc));} /* iterate over and execute each draw command */ offset = (const nk_draw_index*)nk_buffer_memory_const(&ebuf); nk_draw_foreach(cmd, &glfw.ctx, &dev->cmds) { if (!cmd->elem_count) continue; glBindTexture(GL_TEXTURE_2D, (GLuint)cmd->texture.id); glScissor( (GLint)(cmd->clip_rect.x * glfw.fb_scale.x), (GLint)((glfw.height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h)) * glfw.fb_scale.y), (GLint)(cmd->clip_rect.w * glfw.fb_scale.x), (GLint)(cmd->clip_rect.h * glfw.fb_scale.y)); glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_SHORT, offset); offset += cmd->elem_count; } nk_clear(&glfw.ctx); nk_buffer_free(&vbuf); nk_buffer_free(&ebuf); } /* default OpenGL state */ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 0); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glPopAttrib(); } NK_API void nk_glfw3_char_callback(GLFWwindow *win, unsigned int codepoint) { (void)win; if (glfw.text_len < NK_GLFW_TEXT_MAX) glfw.text[glfw.text_len++] = codepoint; } NK_API void nk_gflw3_scroll_callback(GLFWwindow *win, double xoff, double yoff) { (void)win; (void)xoff; glfw.scroll.x += (float)xoff; glfw.scroll.y += (float)yoff; } NK_API void nk_glfw3_mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { double x, y; if (button != GLFW_MOUSE_BUTTON_LEFT) return; glfwGetCursorPos(window, &x, &y); if (action == GLFW_PRESS) { double dt = glfwGetTime() - glfw.last_button_click; if (dt > NK_GLFW_DOUBLE_CLICK_LO && dt < NK_GLFW_DOUBLE_CLICK_HI) { glfw.is_double_click_down = nk_true; glfw.double_click_pos = nk_vec2((float)x, (float)y); } glfw.last_button_click = glfwGetTime(); } else glfw.is_double_click_down = nk_false; } NK_INTERN void nk_glfw3_clipbard_paste(nk_handle usr, struct nk_text_edit *edit) { const char *text = glfwGetClipboardString(glfw.win); if (text) nk_textedit_paste(edit, text, nk_strlen(text)); (void)usr; } NK_INTERN void nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len) { char *str = 0; (void)usr; if (!len) return; str = (char*)malloc((size_t)len+1); if (!str) return; NK_MEMCPY(str, text, (size_t)len); str[len] = '\0'; glfwSetClipboardString(glfw.win, str); free(str); } NK_API struct nk_context* nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state init_state) { glfw.win = win; if (init_state == NK_GLFW3_INSTALL_CALLBACKS) { glfwSetScrollCallback(win, nk_gflw3_scroll_callback); glfwSetCharCallback(win, nk_glfw3_char_callback); glfwSetMouseButtonCallback(win, nk_glfw3_mouse_button_callback); } nk_init_default(&glfw.ctx, 0); glfw.ctx.clip.copy = nk_glfw3_clipbard_copy; glfw.ctx.clip.paste = nk_glfw3_clipbard_paste; glfw.ctx.clip.userdata = nk_handle_ptr(0); nk_buffer_init_default(&glfw.ogl.cmds); glfw.is_double_click_down = nk_false; glfw.double_click_pos = nk_vec2(0, 0); return &glfw.ctx; } NK_API void nk_glfw3_font_stash_begin(struct nk_font_atlas **atlas) { nk_font_atlas_init_default(&glfw.atlas); nk_font_atlas_begin(&glfw.atlas); *atlas = &glfw.atlas; } NK_API void nk_glfw3_font_stash_end(void) { const void *image; int w, h; image = nk_font_atlas_bake(&glfw.atlas, &w, &h, NK_FONT_ATLAS_RGBA32); nk_glfw3_device_upload_atlas(image, w, h); nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex), &glfw.ogl.null); if (glfw.atlas.default_font) nk_style_set_font(&glfw.ctx, &glfw.atlas.default_font->handle); } NK_API void nk_glfw3_new_frame(void) { int i; double x, y; struct nk_context *ctx = &glfw.ctx; struct GLFWwindow *win = glfw.win; glfwGetWindowSize(win, &glfw.width, &glfw.height); glfwGetFramebufferSize(win, &glfw.display_width, &glfw.display_height); glfw.fb_scale.x = (float)glfw.display_width/(float)glfw.width; glfw.fb_scale.y = (float)glfw.display_height/(float)glfw.height; nk_input_begin(ctx); for (i = 0; i < glfw.text_len; ++i) nk_input_unicode(ctx, glfw.text[i]); /* optional grabbing behavior */ if (ctx->input.mouse.grab) glfwSetInputMode(glfw.win, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); else if (ctx->input.mouse.ungrab) glfwSetInputMode(glfw.win, GLFW_CURSOR, GLFW_CURSOR_NORMAL); nk_input_key(ctx, NK_KEY_DEL, glfwGetKey(win, GLFW_KEY_DELETE) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_ENTER, glfwGetKey(win, GLFW_KEY_ENTER) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TAB, glfwGetKey(win, GLFW_KEY_TAB) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_BACKSPACE, glfwGetKey(win, GLFW_KEY_BACKSPACE) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_UP, glfwGetKey(win, GLFW_KEY_UP) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_DOWN, glfwGetKey(win, GLFW_KEY_DOWN) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_START, glfwGetKey(win, GLFW_KEY_HOME) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_END, glfwGetKey(win, GLFW_KEY_END) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_SCROLL_START, glfwGetKey(win, GLFW_KEY_HOME) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_SCROLL_END, glfwGetKey(win, GLFW_KEY_END) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_SCROLL_DOWN, glfwGetKey(win, GLFW_KEY_PAGE_DOWN) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_SCROLL_UP, glfwGetKey(win, GLFW_KEY_PAGE_UP) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_SHIFT, glfwGetKey(win, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS|| glfwGetKey(win, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS); if (glfwGetKey(win, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || glfwGetKey(win, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS) { nk_input_key(ctx, NK_KEY_COPY, glfwGetKey(win, GLFW_KEY_C) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_PASTE, glfwGetKey(win, GLFW_KEY_V) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_CUT, glfwGetKey(win, GLFW_KEY_X) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_UNDO, glfwGetKey(win, GLFW_KEY_Z) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_REDO, glfwGetKey(win, GLFW_KEY_R) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, glfwGetKey(win, GLFW_KEY_LEFT) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_WORD_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_LINE_START, glfwGetKey(win, GLFW_KEY_B) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_TEXT_LINE_END, glfwGetKey(win, GLFW_KEY_E) == GLFW_PRESS); } else { nk_input_key(ctx, NK_KEY_LEFT, glfwGetKey(win, GLFW_KEY_LEFT) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS); nk_input_key(ctx, NK_KEY_COPY, 0); nk_input_key(ctx, NK_KEY_PASTE, 0); nk_input_key(ctx, NK_KEY_CUT, 0); nk_input_key(ctx, NK_KEY_SHIFT, 0); } glfwGetCursorPos(win, &x, &y); nk_input_motion(ctx, (int)x, (int)y); if (ctx->input.mouse.grabbed) { glfwSetCursorPos(glfw.win, (double)ctx->input.mouse.prev.x, (double)ctx->input.mouse.prev.y); ctx->input.mouse.pos.x = ctx->input.mouse.prev.x; ctx->input.mouse.pos.y = ctx->input.mouse.prev.y; } nk_input_button(ctx, NK_BUTTON_LEFT, (int)x, (int)y, glfwGetMouseButton(win, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS); nk_input_button(ctx, NK_BUTTON_MIDDLE, (int)x, (int)y, glfwGetMouseButton(win, GLFW_MOUSE_BUTTON_MIDDLE) == GLFW_PRESS); nk_input_button(ctx, NK_BUTTON_RIGHT, (int)x, (int)y, glfwGetMouseButton(win, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS); nk_input_button(ctx, NK_BUTTON_DOUBLE, (int)glfw.double_click_pos.x, (int)glfw.double_click_pos.y, glfw.is_double_click_down); nk_input_scroll(ctx, glfw.scroll); nk_input_end(&glfw.ctx); glfw.text_len = 0; glfw.scroll = nk_vec2(0,0); } NK_API void nk_glfw3_shutdown(void) { struct nk_glfw_device *dev = &glfw.ogl; nk_font_atlas_clear(&glfw.atlas); nk_free(&glfw.ctx); glDeleteTextures(1, &dev->font_tex); nk_buffer_free(&dev->cmds); NK_MEMSET(&glfw, 0, sizeof(glfw)); } #endif ================================================ FILE: thirdparty/glfw/deps/stb_image_write.h ================================================ /* stb_image_write - v1.02 - public domain - http://nothings.org/stb/stb_image_write.h writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010-2015 no warranty implied; use at your own risk Before #including, #define STB_IMAGE_WRITE_IMPLEMENTATION in the file that you want to have the implementation. Will probably not work correctly with strict-aliasing optimizations. ABOUT: This header file is a library for writing images to C stdio. It could be adapted to write to memory or a general streaming interface; let me know. The PNG output is not optimal; it is 20-50% larger than the file written by a decent optimizing implementation. This library is designed for source code compactness and simplicity, not optimal image file size or run-time performance. BUILDING: You can #define STBIW_ASSERT(x) before the #include to avoid using assert.h. You can #define STBIW_MALLOC(), STBIW_REALLOC(), and STBIW_FREE() to replace malloc,realloc,free. You can define STBIW_MEMMOVE() to replace memmove() USAGE: There are four functions, one for each image file format: int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); There are also four equivalent functions that use an arbitrary write function. You are expected to open/close your file-equivalent before and after calling these: int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); where the callback is: void stbi_write_func(void *context, void *data, int size); You can define STBI_WRITE_NO_STDIO to disable the file variant of these functions, so the library will not use stdio.h at all. However, this will also disable HDR writing, because it requires stdio for formatted output. Each function returns 0 on failure and non-0 on success. The functions create an image file defined by the parameters. The image is a rectangle of pixels stored from left-to-right, top-to-bottom. Each pixel contains 'comp' channels of data stored interleaved with 8-bits per channel, in the following order: 1=Y, 2=YA, 3=RGB, 4=RGBA. (Y is monochrome color.) The rectangle is 'w' pixels wide and 'h' pixels tall. The *data pointer points to the first byte of the top-left-most pixel. For PNG, "stride_in_bytes" is the distance in bytes from the first byte of a row of pixels to the first byte of the next row of pixels. PNG creates output files with the same number of components as the input. The BMP format expands Y to RGB in the file format and does not output alpha. PNG supports writing rectangles of data even when the bytes storing rows of data are not consecutive in memory (e.g. sub-rectangles of a larger image), by supplying the stride between the beginning of adjacent rows. The other formats do not. (Thus you cannot write a native-format BMP through the BMP writer, both because it is in BGR order and because it may have padding at the end of the line.) HDR expects linear float data. Since the format is always 32-bit rgb(e) data, alpha (if provided) is discarded, and for monochrome data it is replicated across all three channels. TGA supports RLE or non-RLE compressed data. To use non-RLE-compressed data, set the global variable 'stbi_write_tga_with_rle' to 0. CREDITS: PNG/BMP/TGA Sean Barrett HDR Baldur Karlsson TGA monochrome: Jean-Sebastien Guay misc enhancements: Tim Kelsey TGA RLE Alan Hickman initial file IO callback implementation Emmanuel Julien bugfixes: github:Chribba Guillaume Chereau github:jry2 github:romigrou Sergio Gonzalez Jonas Karlsson Filip Wasil Thatcher Ulrich LICENSE This software is dual-licensed to the public domain and under the following license: you are granted a perpetual, irrevocable license to copy, modify, publish, and distribute this file as you see fit. */ #ifndef INCLUDE_STB_IMAGE_WRITE_H #define INCLUDE_STB_IMAGE_WRITE_H #ifdef __cplusplus extern "C" { #endif #ifdef STB_IMAGE_WRITE_STATIC #define STBIWDEF static #else #define STBIWDEF extern extern int stbi_write_tga_with_rle; #endif #ifndef STBI_WRITE_NO_STDIO STBIWDEF int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); STBIWDEF int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); #endif typedef void stbi_write_func(void *context, void *data, int size); STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); #ifdef __cplusplus } #endif #endif//INCLUDE_STB_IMAGE_WRITE_H #ifdef STB_IMAGE_WRITE_IMPLEMENTATION #ifdef _WIN32 #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif #ifndef _CRT_NONSTDC_NO_DEPRECATE #define _CRT_NONSTDC_NO_DEPRECATE #endif #endif #ifndef STBI_WRITE_NO_STDIO #include #endif // STBI_WRITE_NO_STDIO #include #include #include #include #if defined(STBIW_MALLOC) && defined(STBIW_FREE) && (defined(STBIW_REALLOC) || defined(STBIW_REALLOC_SIZED)) // ok #elif !defined(STBIW_MALLOC) && !defined(STBIW_FREE) && !defined(STBIW_REALLOC) && !defined(STBIW_REALLOC_SIZED) // ok #else #error "Must define all or none of STBIW_MALLOC, STBIW_FREE, and STBIW_REALLOC (or STBIW_REALLOC_SIZED)." #endif #ifndef STBIW_MALLOC #define STBIW_MALLOC(sz) malloc(sz) #define STBIW_REALLOC(p,newsz) realloc(p,newsz) #define STBIW_FREE(p) free(p) #endif #ifndef STBIW_REALLOC_SIZED #define STBIW_REALLOC_SIZED(p,oldsz,newsz) STBIW_REALLOC(p,newsz) #endif #ifndef STBIW_MEMMOVE #define STBIW_MEMMOVE(a,b,sz) memmove(a,b,sz) #endif #ifndef STBIW_ASSERT #include #define STBIW_ASSERT(x) assert(x) #endif #define STBIW_UCHAR(x) (unsigned char) ((x) & 0xff) typedef struct { stbi_write_func *func; void *context; } stbi__write_context; // initialize a callback-based context static void stbi__start_write_callbacks(stbi__write_context *s, stbi_write_func *c, void *context) { s->func = c; s->context = context; } #ifndef STBI_WRITE_NO_STDIO static void stbi__stdio_write(void *context, void *data, int size) { fwrite(data,1,size,(FILE*) context); } static int stbi__start_write_file(stbi__write_context *s, const char *filename) { FILE *f = fopen(filename, "wb"); stbi__start_write_callbacks(s, stbi__stdio_write, (void *) f); return f != NULL; } static void stbi__end_write_file(stbi__write_context *s) { fclose((FILE *)s->context); } #endif // !STBI_WRITE_NO_STDIO typedef unsigned int stbiw_uint32; typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; #ifdef STB_IMAGE_WRITE_STATIC static int stbi_write_tga_with_rle = 1; #else int stbi_write_tga_with_rle = 1; #endif static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_list v) { while (*fmt) { switch (*fmt++) { case ' ': break; case '1': { unsigned char x = STBIW_UCHAR(va_arg(v, int)); s->func(s->context,&x,1); break; } case '2': { int x = va_arg(v,int); unsigned char b[2]; b[0] = STBIW_UCHAR(x); b[1] = STBIW_UCHAR(x>>8); s->func(s->context,b,2); break; } case '4': { stbiw_uint32 x = va_arg(v,int); unsigned char b[4]; b[0]=STBIW_UCHAR(x); b[1]=STBIW_UCHAR(x>>8); b[2]=STBIW_UCHAR(x>>16); b[3]=STBIW_UCHAR(x>>24); s->func(s->context,b,4); break; } default: STBIW_ASSERT(0); return; } } } static void stbiw__writef(stbi__write_context *s, const char *fmt, ...) { va_list v; va_start(v, fmt); stbiw__writefv(s, fmt, v); va_end(v); } static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c) { unsigned char arr[3]; arr[0] = a, arr[1] = b, arr[2] = c; s->func(s->context, arr, 3); } static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, int write_alpha, int expand_mono, unsigned char *d) { unsigned char bg[3] = { 255, 0, 255}, px[3]; int k; if (write_alpha < 0) s->func(s->context, &d[comp - 1], 1); switch (comp) { case 1: s->func(s->context,d,1); break; case 2: if (expand_mono) stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp else s->func(s->context, d, 1); // monochrome TGA break; case 4: if (!write_alpha) { // composite against pink background for (k = 0; k < 3; ++k) px[k] = bg[k] + ((d[k] - bg[k]) * d[3]) / 255; stbiw__write3(s, px[1 - rgb_dir], px[1], px[1 + rgb_dir]); break; } /* FALLTHROUGH */ case 3: stbiw__write3(s, d[1 - rgb_dir], d[1], d[1 + rgb_dir]); break; } if (write_alpha > 0) s->func(s->context, &d[comp - 1], 1); } static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono) { stbiw_uint32 zero = 0; int i,j, j_end; if (y <= 0) return; 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) { unsigned char *d = (unsigned char *) data + (j*x+i)*comp; stbiw__write_pixel(s, rgb_dir, comp, write_alpha, expand_mono, d); } s->func(s->context, &zero, scanline_pad); } } static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, int expand_mono, void *data, int alpha, int pad, const char *fmt, ...) { if (y < 0 || x < 0) { return 0; } else { va_list v; va_start(v, fmt); stbiw__writefv(s, fmt, v); va_end(v); stbiw__write_pixels(s,rgb_dir,vdir,x,y,comp,data,alpha,pad, expand_mono); return 1; } } static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data) { int pad = (-x*3) & 3; return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) 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 } STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) { stbi__write_context s; stbi__start_write_callbacks(&s, func, context); return stbi_write_bmp_core(&s, x, y, comp, data); } #ifndef STBI_WRITE_NO_STDIO STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data) { stbi__write_context s; if (stbi__start_write_file(&s,filename)) { int r = stbi_write_bmp_core(&s, x, y, comp, data); stbi__end_write_file(&s); return r; } else return 0; } #endif //!STBI_WRITE_NO_STDIO static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, void *data) { int has_alpha = (comp == 2 || comp == 4); int colorbytes = has_alpha ? comp-1 : comp; int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3 if (y < 0 || x < 0) return 0; if (!stbi_write_tga_with_rle) { return stbiw__outfile(s, -1, -1, x, y, comp, 0, (void *) data, has_alpha, 0, "111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8); } else { int i,j,k; stbiw__writef(s, "111 221 2222 11", 0,0,format+8, 0,0,0, 0,0,x,y, (colorbytes + has_alpha) * 8, has_alpha * 8); for (j = y - 1; j >= 0; --j) { unsigned char *row = (unsigned char *) data + j * x * comp; int len; for (i = 0; i < x; i += len) { unsigned char *begin = row + i * comp; int diff = 1; len = 1; if (i < x - 1) { ++len; diff = memcmp(begin, row + (i + 1) * comp, comp); if (diff) { const unsigned char *prev = begin; for (k = i + 2; k < x && len < 128; ++k) { if (memcmp(prev, row + k * comp, comp)) { prev += comp; ++len; } else { --len; break; } } } else { for (k = i + 2; k < x && len < 128; ++k) { if (!memcmp(begin, row + k * comp, comp)) { ++len; } else { break; } } } } if (diff) { unsigned char header = STBIW_UCHAR(len - 1); s->func(s->context, &header, 1); for (k = 0; k < len; ++k) { stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp); } } else { unsigned char header = STBIW_UCHAR(len - 129); s->func(s->context, &header, 1); stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin); } } } } return 1; } int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) { stbi__write_context s; stbi__start_write_callbacks(&s, func, context); return stbi_write_tga_core(&s, x, y, comp, (void *) data); } #ifndef STBI_WRITE_NO_STDIO int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data) { stbi__write_context s; if (stbi__start_write_file(&s,filename)) { int r = stbi_write_tga_core(&s, x, y, comp, (void *) data); stbi__end_write_file(&s); return r; } else return 0; } #endif // ************************************************************************************************* // Radiance RGBE HDR writer // by Baldur Karlsson #ifndef STBI_WRITE_NO_STDIO #define stbiw__max(a, b) ((a) > (b) ? (a) : (b)) void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) { int exponent; float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2])); if (maxcomp < 1e-32f) { rgbe[0] = rgbe[1] = rgbe[2] = rgbe[3] = 0; } else { float normalize = (float) frexp(maxcomp, &exponent) * 256.0f/maxcomp; rgbe[0] = (unsigned char)(linear[0] * normalize); rgbe[1] = (unsigned char)(linear[1] * normalize); rgbe[2] = (unsigned char)(linear[2] * normalize); rgbe[3] = (unsigned char)(exponent + 128); } } void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte) { unsigned char lengthbyte = STBIW_UCHAR(length+128); STBIW_ASSERT(length+128 <= 255); s->func(s->context, &lengthbyte, 1); s->func(s->context, &databyte, 1); } void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data) { unsigned char lengthbyte = STBIW_UCHAR(length); STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code s->func(s->context, &lengthbyte, 1); s->func(s->context, data, length); } void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline) { unsigned char scanlineheader[4] = { 2, 2, 0, 0 }; unsigned char rgbe[4]; float linear[3]; int x; scanlineheader[2] = (width&0xff00)>>8; scanlineheader[3] = (width&0x00ff); /* skip RLE for images too small or large */ if (width < 8 || width >= 32768) { for (x=0; x < width; x++) { switch (ncomp) { case 4: /* fallthrough */ case 3: linear[2] = scanline[x*ncomp + 2]; linear[1] = scanline[x*ncomp + 1]; linear[0] = scanline[x*ncomp + 0]; break; default: linear[0] = linear[1] = linear[2] = scanline[x*ncomp + 0]; break; } stbiw__linear_to_rgbe(rgbe, linear); s->func(s->context, rgbe, 4); } } else { int c,r; /* encode into scratch buffer */ for (x=0; x < width; x++) { switch(ncomp) { case 4: /* fallthrough */ case 3: linear[2] = scanline[x*ncomp + 2]; linear[1] = scanline[x*ncomp + 1]; linear[0] = scanline[x*ncomp + 0]; break; default: linear[0] = linear[1] = linear[2] = scanline[x*ncomp + 0]; break; } stbiw__linear_to_rgbe(rgbe, linear); scratch[x + width*0] = rgbe[0]; scratch[x + width*1] = rgbe[1]; scratch[x + width*2] = rgbe[2]; scratch[x + width*3] = rgbe[3]; } s->func(s->context, scanlineheader, 4); /* RLE each component separately */ for (c=0; c < 4; c++) { unsigned char *comp = &scratch[width*c]; x = 0; while (x < width) { // find first run r = x; while (r+2 < width) { if (comp[r] == comp[r+1] && comp[r] == comp[r+2]) break; ++r; } if (r+2 >= width) r = width; // dump up to first run while (x < r) { int len = r-x; if (len > 128) len = 128; stbiw__write_dump_data(s, len, &comp[x]); x += len; } // if there's a run, output it if (r+2 < width) { // same test as what we break out of in search loop, so only true if we break'd // find next byte after run while (r < width && comp[r] == comp[x]) ++r; // output run up to r while (x < r) { int len = r-x; if (len > 127) len = 127; stbiw__write_run_data(s, len, comp[x]); x += len; } } } } } } static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data) { if (y <= 0 || x <= 0 || data == NULL) return 0; else { // Each component is stored separately. Allocate scratch space for full output scanline. unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4); int i, len; char buffer[128]; char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n"; s->func(s->context, header, sizeof(header)-1); len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); s->func(s->context, buffer, len); for(i=0; i < y; i++) stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*i*x); STBIW_FREE(scratch); return 1; } } int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data) { stbi__write_context s; stbi__start_write_callbacks(&s, func, context); return stbi_write_hdr_core(&s, x, y, comp, (float *) data); } int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data) { stbi__write_context s; if (stbi__start_write_file(&s,filename)) { int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data); stbi__end_write_file(&s); return r; } else return 0; } #endif // STBI_WRITE_NO_STDIO ////////////////////////////////////////////////////////////////////////////// // // PNG writer // // stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size() #define stbiw__sbraw(a) ((int *) (a) - 2) #define stbiw__sbm(a) stbiw__sbraw(a)[0] #define stbiw__sbn(a) stbiw__sbraw(a)[1] #define stbiw__sbneedgrow(a,n) ((a)==0 || stbiw__sbn(a)+n >= stbiw__sbm(a)) #define stbiw__sbmaybegrow(a,n) (stbiw__sbneedgrow(a,(n)) ? stbiw__sbgrow(a,n) : 0) #define stbiw__sbgrow(a,n) stbiw__sbgrowf((void **) &(a), (n), sizeof(*(a))) #define stbiw__sbpush(a, v) (stbiw__sbmaybegrow(a,1), (a)[stbiw__sbn(a)++] = (v)) #define stbiw__sbcount(a) ((a) ? stbiw__sbn(a) : 0) #define stbiw__sbfree(a) ((a) ? STBIW_FREE(stbiw__sbraw(a)),0 : 0) static void *stbiw__sbgrowf(void **arr, int increment, int itemsize) { int m = *arr ? 2*stbiw__sbm(*arr)+increment : increment+1; void *p = STBIW_REALLOC_SIZED(*arr ? stbiw__sbraw(*arr) : 0, *arr ? (stbiw__sbm(*arr)*itemsize + sizeof(int)*2) : 0, itemsize * m + sizeof(int)*2); STBIW_ASSERT(p); if (p) { if (!*arr) ((int *) p)[1] = 0; *arr = (void *) ((int *) p + 2); stbiw__sbm(*arr) = m; } return *arr; } static unsigned char *stbiw__zlib_flushf(unsigned char *data, unsigned int *bitbuffer, int *bitcount) { while (*bitcount >= 8) { stbiw__sbpush(data, STBIW_UCHAR(*bitbuffer)); *bitbuffer >>= 8; *bitcount -= 8; } return data; } static int stbiw__zlib_bitrev(int code, int codebits) { int res=0; while (codebits--) { res = (res << 1) | (code & 1); code >>= 1; } return res; } static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *b, int limit) { int i; for (i=0; i < limit && i < 258; ++i) if (a[i] != b[i]) break; return i; } static unsigned int stbiw__zhash(unsigned char *data) { stbiw_uint32 hash = data[0] + (data[1] << 8) + (data[2] << 16); hash ^= hash << 3; hash += hash >> 5; hash ^= hash << 4; hash += hash >> 17; hash ^= hash << 25; hash += hash >> 6; return hash; } #define stbiw__zlib_flush() (out = stbiw__zlib_flushf(out, &bitbuf, &bitcount)) #define stbiw__zlib_add(code,codebits) \ (bitbuf |= (code) << bitcount, bitcount += (codebits), stbiw__zlib_flush()) #define stbiw__zlib_huffa(b,c) stbiw__zlib_add(stbiw__zlib_bitrev(b,c),c) // default huffman tables #define stbiw__zlib_huff1(n) stbiw__zlib_huffa(0x30 + (n), 8) #define stbiw__zlib_huff2(n) stbiw__zlib_huffa(0x190 + (n)-144, 9) #define stbiw__zlib_huff3(n) stbiw__zlib_huffa(0 + (n)-256,7) #define stbiw__zlib_huff4(n) stbiw__zlib_huffa(0xc0 + (n)-280,8) #define stbiw__zlib_huff(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : (n) <= 255 ? stbiw__zlib_huff2(n) : (n) <= 279 ? stbiw__zlib_huff3(n) : stbiw__zlib_huff4(n)) #define stbiw__zlib_huffb(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : stbiw__zlib_huff2(n)) #define stbiw__ZHASH 16384 unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality) { static unsigned short lengthc[] = { 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, 259 }; static unsigned char lengtheb[]= { 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 }; static unsigned short distc[] = { 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, 32768 }; static unsigned char disteb[] = { 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 }; unsigned int bitbuf=0; int i,j, bitcount=0; unsigned char *out = NULL; unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**)); if (quality < 5) quality = 5; stbiw__sbpush(out, 0x78); // DEFLATE 32K window stbiw__sbpush(out, 0x5e); // FLEVEL = 1 stbiw__zlib_add(1,1); // BFINAL = 1 stbiw__zlib_add(1,2); // BTYPE = 1 -- fixed huffman for (i=0; i < stbiw__ZHASH; ++i) hash_table[i] = NULL; i=0; while (i < data_len-3) { // hash next 3 bytes of data to be compressed int h = stbiw__zhash(data+i)&(stbiw__ZHASH-1), best=3; unsigned char *bestloc = 0; unsigned char **hlist = hash_table[h]; int n = stbiw__sbcount(hlist); for (j=0; j < n; ++j) { if (hlist[j]-data > i-32768) { // if entry lies within window int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i); if (d >= best) best=d,bestloc=hlist[j]; } } // when hash table entry is too long, delete half the entries if (hash_table[h] && stbiw__sbn(hash_table[h]) == 2*quality) { STBIW_MEMMOVE(hash_table[h], hash_table[h]+quality, sizeof(hash_table[h][0])*quality); stbiw__sbn(hash_table[h]) = quality; } stbiw__sbpush(hash_table[h],data+i); if (bestloc) { // "lazy matching" - check match at *next* byte, and if it's better, do cur byte as literal h = stbiw__zhash(data+i+1)&(stbiw__ZHASH-1); hlist = hash_table[h]; n = stbiw__sbcount(hlist); for (j=0; j < n; ++j) { if (hlist[j]-data > i-32767) { int e = stbiw__zlib_countm(hlist[j], data+i+1, data_len-i-1); if (e > best) { // if next match is better, bail on current match bestloc = NULL; break; } } } } if (bestloc) { int d = (int) (data+i - bestloc); // distance back STBIW_ASSERT(d <= 32767 && best <= 258); for (j=0; best > lengthc[j+1]-1; ++j); stbiw__zlib_huff(j+257); if (lengtheb[j]) stbiw__zlib_add(best - lengthc[j], lengtheb[j]); for (j=0; d > distc[j+1]-1; ++j); stbiw__zlib_add(stbiw__zlib_bitrev(j,5),5); if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]); i += best; } else { stbiw__zlib_huffb(data[i]); ++i; } } // write out final bytes for (;i < data_len; ++i) stbiw__zlib_huffb(data[i]); stbiw__zlib_huff(256); // end of block // pad with 0 bits to byte boundary while (bitcount) stbiw__zlib_add(0,1); for (i=0; i < stbiw__ZHASH; ++i) (void) stbiw__sbfree(hash_table[i]); STBIW_FREE(hash_table); { // compute adler32 on input unsigned int s1=1, s2=0; int blocklen = (int) (data_len % 5552); j=0; while (j < data_len) { for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1; s1 %= 65521, s2 %= 65521; j += blocklen; blocklen = 5552; } stbiw__sbpush(out, STBIW_UCHAR(s2 >> 8)); stbiw__sbpush(out, STBIW_UCHAR(s2)); stbiw__sbpush(out, STBIW_UCHAR(s1 >> 8)); stbiw__sbpush(out, STBIW_UCHAR(s1)); } *out_len = stbiw__sbn(out); // make returned pointer freeable STBIW_MEMMOVE(stbiw__sbraw(out), out, *out_len); return (unsigned char *) stbiw__sbraw(out); } static unsigned int stbiw__crc32(unsigned char *buffer, int len) { static unsigned int crc_table[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0eDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; unsigned int crc = ~0u; int i; for (i=0; i < len; ++i) crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)]; return ~crc; } #define stbiw__wpng4(o,a,b,c,d) ((o)[0]=STBIW_UCHAR(a),(o)[1]=STBIW_UCHAR(b),(o)[2]=STBIW_UCHAR(c),(o)[3]=STBIW_UCHAR(d),(o)+=4) #define stbiw__wp32(data,v) stbiw__wpng4(data, (v)>>24,(v)>>16,(v)>>8,(v)); #define stbiw__wptag(data,s) stbiw__wpng4(data, s[0],s[1],s[2],s[3]) static void stbiw__wpcrc(unsigned char **data, int len) { unsigned int crc = stbiw__crc32(*data - len - 4, len+4); stbiw__wp32(*data, crc); } static unsigned char stbiw__paeth(int a, int b, int c) { int p = a + b - c, pa = abs(p-a), pb = abs(p-b), pc = abs(p-c); if (pa <= pb && pa <= pc) return STBIW_UCHAR(a); if (pb <= pc) return STBIW_UCHAR(b); return STBIW_UCHAR(c); } unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) { int ctype[5] = { -1, 0, 4, 2, 6 }; unsigned char sig[8] = { 137,80,78,71,13,10,26,10 }; unsigned char *out,*o, *filt, *zlib; signed char *line_buffer; int i,j,k,p,zlen; if (stride_bytes == 0) stride_bytes = x * n; filt = (unsigned char *) STBIW_MALLOC((x*n+1) * y); if (!filt) return 0; line_buffer = (signed char *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; } for (j=0; j < y; ++j) { static int mapping[] = { 0,1,2,3,4 }; static int firstmap[] = { 0,1,0,5,6 }; int *mymap = j ? mapping : firstmap; int best = 0, bestval = 0x7fffffff; for (p=0; p < 2; ++p) { for (k= p?best:0; k < 5; ++k) { int type = mymap[k],est=0; unsigned char *z = pixels + stride_bytes*j; for (i=0; i < n; ++i) switch (type) { case 0: line_buffer[i] = z[i]; break; case 1: line_buffer[i] = z[i]; break; case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break; case 3: line_buffer[i] = z[i] - (z[i-stride_bytes]>>1); break; case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-stride_bytes],0)); break; case 5: line_buffer[i] = z[i]; break; case 6: line_buffer[i] = z[i]; break; } for (i=n; i < x*n; ++i) { switch (type) { case 0: line_buffer[i] = z[i]; break; case 1: line_buffer[i] = z[i] - z[i-n]; break; case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break; case 3: line_buffer[i] = z[i] - ((z[i-n] + z[i-stride_bytes])>>1); break; case 4: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-stride_bytes], z[i-stride_bytes-n]); break; case 5: line_buffer[i] = z[i] - (z[i-n]>>1); break; case 6: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break; } } if (p) break; for (i=0; i < x*n; ++i) est += abs((signed char) line_buffer[i]); if (est < bestval) { bestval = est; best = k; } } } // when we get here, best contains the filter type, and line_buffer contains the data filt[j*(x*n+1)] = (unsigned char) best; STBIW_MEMMOVE(filt+j*(x*n+1)+1, line_buffer, x*n); } STBIW_FREE(line_buffer); zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, 8); // increase 8 to get smaller but use more memory STBIW_FREE(filt); if (!zlib) return 0; // each tag requires 12 bytes of overhead out = (unsigned char *) STBIW_MALLOC(8 + 12+13 + 12+zlen + 12); if (!out) return 0; *out_len = 8 + 12+13 + 12+zlen + 12; o=out; STBIW_MEMMOVE(o,sig,8); o+= 8; stbiw__wp32(o, 13); // header length stbiw__wptag(o, "IHDR"); stbiw__wp32(o, x); stbiw__wp32(o, y); *o++ = 8; *o++ = STBIW_UCHAR(ctype[n]); *o++ = 0; *o++ = 0; *o++ = 0; stbiw__wpcrc(&o,13); stbiw__wp32(o, zlen); stbiw__wptag(o, "IDAT"); STBIW_MEMMOVE(o, zlib, zlen); o += zlen; STBIW_FREE(zlib); stbiw__wpcrc(&o, zlen); stbiw__wp32(o,0); stbiw__wptag(o, "IEND"); stbiw__wpcrc(&o,0); STBIW_ASSERT(o == out + *out_len); return out; } #ifndef STBI_WRITE_NO_STDIO STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes) { FILE *f; int len; unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); if (png == NULL) return 0; f = fopen(filename, "wb"); if (!f) { STBIW_FREE(png); return 0; } fwrite(png, 1, len, f); fclose(f); STBIW_FREE(png); return 1; } #endif STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int stride_bytes) { int len; unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); if (png == NULL) return 0; func(context, png, len); STBIW_FREE(png); return 1; } #endif // STB_IMAGE_WRITE_IMPLEMENTATION /* Revision history 1.02 (2016-04-02) avoid allocating large structures on the stack 1.01 (2016-01-16) STBIW_REALLOC_SIZED: support allocators with no realloc support avoid race-condition in crc initialization minor compile issues 1.00 (2015-09-14) installable file IO function 0.99 (2015-09-13) warning fixes; TGA rle support 0.98 (2015-04-08) added STBIW_MALLOC, STBIW_ASSERT etc 0.97 (2015-01-18) fixed HDR asserts, rewrote HDR rle logic 0.96 (2015-01-17) add HDR output fix monochrome BMP 0.95 (2014-08-17) add monochrome TGA output 0.94 (2014-05-31) rename private functions to avoid conflicts with stb_image.h 0.93 (2014-05-27) warning fixes 0.92 (2010-08-01) casts to unsigned char to fix warnings 0.91 (2010-07-17) first public release 0.90 first internal release */ ================================================ FILE: thirdparty/glfw/deps/tinycthread.c ================================================ /* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*- Copyright (c) 2012 Marcus Geelnard This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* 2013-01-06 Camilla Löwy * * Added casts from time_t to DWORD to avoid warnings on VC++. * Fixed time retrieval on POSIX systems. */ #include "tinycthread.h" #include /* Platform specific includes */ #if defined(_TTHREAD_POSIX_) #include #include #include #include #include #elif defined(_TTHREAD_WIN32_) #include #include #endif /* Standard, good-to-have defines */ #ifndef NULL #define NULL (void*)0 #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif int mtx_init(mtx_t *mtx, int type) { #if defined(_TTHREAD_WIN32_) mtx->mAlreadyLocked = FALSE; mtx->mRecursive = type & mtx_recursive; InitializeCriticalSection(&mtx->mHandle); return thrd_success; #else int ret; pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); if (type & mtx_recursive) { pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); } ret = pthread_mutex_init(mtx, &attr); pthread_mutexattr_destroy(&attr); return ret == 0 ? thrd_success : thrd_error; #endif } void mtx_destroy(mtx_t *mtx) { #if defined(_TTHREAD_WIN32_) DeleteCriticalSection(&mtx->mHandle); #else pthread_mutex_destroy(mtx); #endif } int mtx_lock(mtx_t *mtx) { #if defined(_TTHREAD_WIN32_) EnterCriticalSection(&mtx->mHandle); if (!mtx->mRecursive) { while(mtx->mAlreadyLocked) Sleep(1000); /* Simulate deadlock... */ mtx->mAlreadyLocked = TRUE; } return thrd_success; #else return pthread_mutex_lock(mtx) == 0 ? thrd_success : thrd_error; #endif } int mtx_timedlock(mtx_t *mtx, const struct timespec *ts) { /* FIXME! */ (void)mtx; (void)ts; return thrd_error; } int mtx_trylock(mtx_t *mtx) { #if defined(_TTHREAD_WIN32_) int ret = TryEnterCriticalSection(&mtx->mHandle) ? thrd_success : thrd_busy; if ((!mtx->mRecursive) && (ret == thrd_success) && mtx->mAlreadyLocked) { LeaveCriticalSection(&mtx->mHandle); ret = thrd_busy; } return ret; #else return (pthread_mutex_trylock(mtx) == 0) ? thrd_success : thrd_busy; #endif } int mtx_unlock(mtx_t *mtx) { #if defined(_TTHREAD_WIN32_) mtx->mAlreadyLocked = FALSE; LeaveCriticalSection(&mtx->mHandle); return thrd_success; #else return pthread_mutex_unlock(mtx) == 0 ? thrd_success : thrd_error;; #endif } #if defined(_TTHREAD_WIN32_) #define _CONDITION_EVENT_ONE 0 #define _CONDITION_EVENT_ALL 1 #endif int cnd_init(cnd_t *cond) { #if defined(_TTHREAD_WIN32_) cond->mWaitersCount = 0; /* Init critical section */ InitializeCriticalSection(&cond->mWaitersCountLock); /* Init events */ cond->mEvents[_CONDITION_EVENT_ONE] = CreateEvent(NULL, FALSE, FALSE, NULL); if (cond->mEvents[_CONDITION_EVENT_ONE] == NULL) { cond->mEvents[_CONDITION_EVENT_ALL] = NULL; return thrd_error; } cond->mEvents[_CONDITION_EVENT_ALL] = CreateEvent(NULL, TRUE, FALSE, NULL); if (cond->mEvents[_CONDITION_EVENT_ALL] == NULL) { CloseHandle(cond->mEvents[_CONDITION_EVENT_ONE]); cond->mEvents[_CONDITION_EVENT_ONE] = NULL; return thrd_error; } return thrd_success; #else return pthread_cond_init(cond, NULL) == 0 ? thrd_success : thrd_error; #endif } void cnd_destroy(cnd_t *cond) { #if defined(_TTHREAD_WIN32_) if (cond->mEvents[_CONDITION_EVENT_ONE] != NULL) { CloseHandle(cond->mEvents[_CONDITION_EVENT_ONE]); } if (cond->mEvents[_CONDITION_EVENT_ALL] != NULL) { CloseHandle(cond->mEvents[_CONDITION_EVENT_ALL]); } DeleteCriticalSection(&cond->mWaitersCountLock); #else pthread_cond_destroy(cond); #endif } int cnd_signal(cnd_t *cond) { #if defined(_TTHREAD_WIN32_) int haveWaiters; /* Are there any waiters? */ EnterCriticalSection(&cond->mWaitersCountLock); haveWaiters = (cond->mWaitersCount > 0); LeaveCriticalSection(&cond->mWaitersCountLock); /* If we have any waiting threads, send them a signal */ if(haveWaiters) { if (SetEvent(cond->mEvents[_CONDITION_EVENT_ONE]) == 0) { return thrd_error; } } return thrd_success; #else return pthread_cond_signal(cond) == 0 ? thrd_success : thrd_error; #endif } int cnd_broadcast(cnd_t *cond) { #if defined(_TTHREAD_WIN32_) int haveWaiters; /* Are there any waiters? */ EnterCriticalSection(&cond->mWaitersCountLock); haveWaiters = (cond->mWaitersCount > 0); LeaveCriticalSection(&cond->mWaitersCountLock); /* If we have any waiting threads, send them a signal */ if(haveWaiters) { if (SetEvent(cond->mEvents[_CONDITION_EVENT_ALL]) == 0) { return thrd_error; } } return thrd_success; #else return pthread_cond_signal(cond) == 0 ? thrd_success : thrd_error; #endif } #if defined(_TTHREAD_WIN32_) static int _cnd_timedwait_win32(cnd_t *cond, mtx_t *mtx, DWORD timeout) { int result, lastWaiter; /* Increment number of waiters */ EnterCriticalSection(&cond->mWaitersCountLock); ++ cond->mWaitersCount; LeaveCriticalSection(&cond->mWaitersCountLock); /* Release the mutex while waiting for the condition (will decrease the number of waiters when done)... */ mtx_unlock(mtx); /* Wait for either event to become signaled due to cnd_signal() or cnd_broadcast() being called */ result = WaitForMultipleObjects(2, cond->mEvents, FALSE, timeout); if (result == WAIT_TIMEOUT) { return thrd_timeout; } else if (result == (int)WAIT_FAILED) { return thrd_error; } /* Check if we are the last waiter */ EnterCriticalSection(&cond->mWaitersCountLock); -- cond->mWaitersCount; lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) && (cond->mWaitersCount == 0); LeaveCriticalSection(&cond->mWaitersCountLock); /* If we are the last waiter to be notified to stop waiting, reset the event */ if (lastWaiter) { if (ResetEvent(cond->mEvents[_CONDITION_EVENT_ALL]) == 0) { return thrd_error; } } /* Re-acquire the mutex */ mtx_lock(mtx); return thrd_success; } #endif int cnd_wait(cnd_t *cond, mtx_t *mtx) { #if defined(_TTHREAD_WIN32_) return _cnd_timedwait_win32(cond, mtx, INFINITE); #else return pthread_cond_wait(cond, mtx) == 0 ? thrd_success : thrd_error; #endif } int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts) { #if defined(_TTHREAD_WIN32_) struct timespec now; if (clock_gettime(CLOCK_REALTIME, &now) == 0) { DWORD delta = (DWORD) ((ts->tv_sec - now.tv_sec) * 1000 + (ts->tv_nsec - now.tv_nsec + 500000) / 1000000); return _cnd_timedwait_win32(cond, mtx, delta); } else return thrd_error; #else int ret; ret = pthread_cond_timedwait(cond, mtx, ts); if (ret == ETIMEDOUT) { return thrd_timeout; } return ret == 0 ? thrd_success : thrd_error; #endif } /** Information to pass to the new thread (what to run). */ typedef struct { thrd_start_t mFunction; /**< Pointer to the function to be executed. */ void * mArg; /**< Function argument for the thread function. */ } _thread_start_info; /* Thread wrapper function. */ #if defined(_TTHREAD_WIN32_) static unsigned WINAPI _thrd_wrapper_function(void * aArg) #elif defined(_TTHREAD_POSIX_) static void * _thrd_wrapper_function(void * aArg) #endif { thrd_start_t fun; void *arg; int res; #if defined(_TTHREAD_POSIX_) void *pres; #endif /* Get thread startup information */ _thread_start_info *ti = (_thread_start_info *) aArg; fun = ti->mFunction; arg = ti->mArg; /* The thread is responsible for freeing the startup information */ free((void *)ti); /* Call the actual client thread function */ res = fun(arg); #if defined(_TTHREAD_WIN32_) return res; #else pres = malloc(sizeof(int)); if (pres != NULL) { *(int*)pres = res; } return pres; #endif } int thrd_create(thrd_t *thr, thrd_start_t func, void *arg) { /* Fill out the thread startup information (passed to the thread wrapper, which will eventually free it) */ _thread_start_info* ti = (_thread_start_info*)malloc(sizeof(_thread_start_info)); if (ti == NULL) { return thrd_nomem; } ti->mFunction = func; ti->mArg = arg; /* Create the thread */ #if defined(_TTHREAD_WIN32_) *thr = (HANDLE)_beginthreadex(NULL, 0, _thrd_wrapper_function, (void *)ti, 0, NULL); #elif defined(_TTHREAD_POSIX_) if(pthread_create(thr, NULL, _thrd_wrapper_function, (void *)ti) != 0) { *thr = 0; } #endif /* Did we fail to create the thread? */ if(!*thr) { free(ti); return thrd_error; } return thrd_success; } thrd_t thrd_current(void) { #if defined(_TTHREAD_WIN32_) return GetCurrentThread(); #else return pthread_self(); #endif } int thrd_detach(thrd_t thr) { /* FIXME! */ (void)thr; return thrd_error; } int thrd_equal(thrd_t thr0, thrd_t thr1) { #if defined(_TTHREAD_WIN32_) return thr0 == thr1; #else return pthread_equal(thr0, thr1); #endif } void thrd_exit(int res) { #if defined(_TTHREAD_WIN32_) ExitThread(res); #else void *pres = malloc(sizeof(int)); if (pres != NULL) { *(int*)pres = res; } pthread_exit(pres); #endif } int thrd_join(thrd_t thr, int *res) { #if defined(_TTHREAD_WIN32_) if (WaitForSingleObject(thr, INFINITE) == WAIT_FAILED) { return thrd_error; } if (res != NULL) { DWORD dwRes; GetExitCodeThread(thr, &dwRes); *res = dwRes; } #elif defined(_TTHREAD_POSIX_) void *pres; int ires = 0; if (pthread_join(thr, &pres) != 0) { return thrd_error; } if (pres != NULL) { ires = *(int*)pres; free(pres); } if (res != NULL) { *res = ires; } #endif return thrd_success; } int thrd_sleep(const struct timespec *time_point, struct timespec *remaining) { struct timespec now; #if defined(_TTHREAD_WIN32_) DWORD delta; #else long delta; #endif /* Get the current time */ if (clock_gettime(CLOCK_REALTIME, &now) != 0) return -2; // FIXME: Some specific error code? #if defined(_TTHREAD_WIN32_) /* Delta in milliseconds */ delta = (DWORD) ((time_point->tv_sec - now.tv_sec) * 1000 + (time_point->tv_nsec - now.tv_nsec + 500000) / 1000000); if (delta > 0) { Sleep(delta); } #else /* Delta in microseconds */ delta = (time_point->tv_sec - now.tv_sec) * 1000000L + (time_point->tv_nsec - now.tv_nsec + 500L) / 1000L; /* On some systems, the usleep argument must be < 1000000 */ while (delta > 999999L) { usleep(999999); delta -= 999999L; } if (delta > 0L) { usleep((useconds_t)delta); } #endif /* We don't support waking up prematurely (yet) */ if (remaining) { remaining->tv_sec = 0; remaining->tv_nsec = 0; } return 0; } void thrd_yield(void) { #if defined(_TTHREAD_WIN32_) Sleep(0); #else sched_yield(); #endif } int tss_create(tss_t *key, tss_dtor_t dtor) { #if defined(_TTHREAD_WIN32_) /* FIXME: The destructor function is not supported yet... */ if (dtor != NULL) { return thrd_error; } *key = TlsAlloc(); if (*key == TLS_OUT_OF_INDEXES) { return thrd_error; } #else if (pthread_key_create(key, dtor) != 0) { return thrd_error; } #endif return thrd_success; } void tss_delete(tss_t key) { #if defined(_TTHREAD_WIN32_) TlsFree(key); #else pthread_key_delete(key); #endif } void *tss_get(tss_t key) { #if defined(_TTHREAD_WIN32_) return TlsGetValue(key); #else return pthread_getspecific(key); #endif } int tss_set(tss_t key, void *val) { #if defined(_TTHREAD_WIN32_) if (TlsSetValue(key, val) == 0) { return thrd_error; } #else if (pthread_setspecific(key, val) != 0) { return thrd_error; } #endif return thrd_success; } #if defined(_TTHREAD_EMULATE_CLOCK_GETTIME_) int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts) { #if defined(_TTHREAD_WIN32_) struct _timeb tb; _ftime(&tb); ts->tv_sec = (time_t)tb.time; ts->tv_nsec = 1000000L * (long)tb.millitm; #else struct timeval tv; gettimeofday(&tv, NULL); ts->tv_sec = (time_t)tv.tv_sec; ts->tv_nsec = 1000L * (long)tv.tv_usec; #endif return 0; } #endif // _TTHREAD_EMULATE_CLOCK_GETTIME_ ================================================ FILE: thirdparty/glfw/deps/tinycthread.h ================================================ /* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*- Copyright (c) 2012 Marcus Geelnard This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as 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 _TINYCTHREAD_H_ #define _TINYCTHREAD_H_ /** * @file * @mainpage TinyCThread API Reference * * @section intro_sec Introduction * TinyCThread is a minimal, portable implementation of basic threading * classes for C. * * They closely mimic the functionality and naming of the C11 standard, and * should be easily replaceable with the corresponding standard variants. * * @section port_sec Portability * The Win32 variant uses the native Win32 API for implementing the thread * classes, while for other systems, the POSIX threads API (pthread) is used. * * @section misc_sec Miscellaneous * The following special keywords are available: #_Thread_local. * * For more detailed information, browse the different sections of this * documentation. A good place to start is: * tinycthread.h. */ /* Which platform are we on? */ #if !defined(_TTHREAD_PLATFORM_DEFINED_) #if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__) #define _TTHREAD_WIN32_ #else #define _TTHREAD_POSIX_ #endif #define _TTHREAD_PLATFORM_DEFINED_ #endif /* Activate some POSIX functionality (e.g. clock_gettime and recursive mutexes) */ #if defined(_TTHREAD_POSIX_) #undef _FEATURES_H #if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif #if !defined(_POSIX_C_SOURCE) || ((_POSIX_C_SOURCE - 0) < 199309L) #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199309L #endif #if !defined(_XOPEN_SOURCE) || ((_XOPEN_SOURCE - 0) < 500) #undef _XOPEN_SOURCE #define _XOPEN_SOURCE 500 #endif #endif /* Generic includes */ #include /* Platform specific includes */ #if defined(_TTHREAD_POSIX_) #include #include #elif defined(_TTHREAD_WIN32_) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #define __UNDEF_LEAN_AND_MEAN #endif #include #ifdef __UNDEF_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN #undef __UNDEF_LEAN_AND_MEAN #endif #endif /* Workaround for missing TIME_UTC: If time.h doesn't provide TIME_UTC, it's quite likely that libc does not support it either. Hence, fall back to the only other supported time specifier: CLOCK_REALTIME (and if that fails, we're probably emulating clock_gettime anyway, so anything goes). */ #ifndef TIME_UTC #ifdef CLOCK_REALTIME #define TIME_UTC CLOCK_REALTIME #else #define TIME_UTC 0 #endif #endif /* Workaround for missing clock_gettime (most Windows compilers, afaik) */ #if defined(_TTHREAD_WIN32_) || defined(__APPLE_CC__) #define _TTHREAD_EMULATE_CLOCK_GETTIME_ /* Emulate struct timespec */ #if defined(_TTHREAD_WIN32_) struct _ttherad_timespec { time_t tv_sec; long tv_nsec; }; #define timespec _ttherad_timespec #endif /* Emulate clockid_t */ typedef int _tthread_clockid_t; #define clockid_t _tthread_clockid_t /* Emulate clock_gettime */ int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts); #define clock_gettime _tthread_clock_gettime #ifndef CLOCK_REALTIME #define CLOCK_REALTIME 0 #endif #endif /** TinyCThread version (major number). */ #define TINYCTHREAD_VERSION_MAJOR 1 /** TinyCThread version (minor number). */ #define TINYCTHREAD_VERSION_MINOR 1 /** TinyCThread version (full version). */ #define TINYCTHREAD_VERSION (TINYCTHREAD_VERSION_MAJOR * 100 + TINYCTHREAD_VERSION_MINOR) /** * @def _Thread_local * Thread local storage keyword. * A variable that is declared with the @c _Thread_local keyword makes the * value of the variable local to each thread (known as thread-local storage, * or TLS). Example usage: * @code * // This variable is local to each thread. * _Thread_local int variable; * @endcode * @note The @c _Thread_local keyword is a macro that maps to the corresponding * compiler directive (e.g. @c __declspec(thread)). * @note This directive is currently not supported on Mac OS X (it will give * a compiler error), since compile-time TLS is not supported in the Mac OS X * executable format. Also, some older versions of MinGW (before GCC 4.x) do * not support this directive. * @hideinitializer */ /* FIXME: Check for a PROPER value of __STDC_VERSION__ to know if we have C11 */ #if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201102L)) && !defined(_Thread_local) #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_CC) || defined(__IBMCPP__) #define _Thread_local __thread #else #define _Thread_local __declspec(thread) #endif #endif /* Macros */ #define TSS_DTOR_ITERATIONS 0 /* Function return values */ #define thrd_error 0 /**< The requested operation failed */ #define thrd_success 1 /**< The requested operation succeeded */ #define thrd_timeout 2 /**< The time specified in the call was reached without acquiring the requested resource */ #define thrd_busy 3 /**< The requested operation failed because a tesource requested by a test and return function is already in use */ #define thrd_nomem 4 /**< The requested operation failed because it was unable to allocate memory */ /* Mutex types */ #define mtx_plain 1 #define mtx_timed 2 #define mtx_try 4 #define mtx_recursive 8 /* Mutex */ #if defined(_TTHREAD_WIN32_) typedef struct { CRITICAL_SECTION mHandle; /* Critical section handle */ int mAlreadyLocked; /* TRUE if the mutex is already locked */ int mRecursive; /* TRUE if the mutex is recursive */ } mtx_t; #else typedef pthread_mutex_t mtx_t; #endif /** Create a mutex object. * @param mtx A mutex object. * @param type Bit-mask that must have one of the following six values: * @li @c mtx_plain for a simple non-recursive mutex * @li @c mtx_timed for a non-recursive mutex that supports timeout * @li @c mtx_try for a non-recursive mutex that supports test and return * @li @c mtx_plain | @c mtx_recursive (same as @c mtx_plain, but recursive) * @li @c mtx_timed | @c mtx_recursive (same as @c mtx_timed, but recursive) * @li @c mtx_try | @c mtx_recursive (same as @c mtx_try, but recursive) * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int mtx_init(mtx_t *mtx, int type); /** Release any resources used by the given mutex. * @param mtx A mutex object. */ void mtx_destroy(mtx_t *mtx); /** Lock the given mutex. * Blocks until the given mutex can be locked. If the mutex is non-recursive, and * the calling thread already has a lock on the mutex, this call will block * forever. * @param mtx A mutex object. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int mtx_lock(mtx_t *mtx); /** NOT YET IMPLEMENTED. */ int mtx_timedlock(mtx_t *mtx, const struct timespec *ts); /** Try to lock the given mutex. * The specified mutex shall support either test and return or timeout. If the * mutex is already locked, the function returns without blocking. * @param mtx A mutex object. * @return @ref thrd_success on success, or @ref thrd_busy if the resource * requested is already in use, or @ref thrd_error if the request could not be * honored. */ int mtx_trylock(mtx_t *mtx); /** Unlock the given mutex. * @param mtx A mutex object. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int mtx_unlock(mtx_t *mtx); /* Condition variable */ #if defined(_TTHREAD_WIN32_) typedef struct { HANDLE mEvents[2]; /* Signal and broadcast event HANDLEs. */ unsigned int mWaitersCount; /* Count of the number of waiters. */ CRITICAL_SECTION mWaitersCountLock; /* Serialize access to mWaitersCount. */ } cnd_t; #else typedef pthread_cond_t cnd_t; #endif /** Create a condition variable object. * @param cond A condition variable object. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int cnd_init(cnd_t *cond); /** Release any resources used by the given condition variable. * @param cond A condition variable object. */ void cnd_destroy(cnd_t *cond); /** Signal a condition variable. * Unblocks one of the threads that are blocked on the given condition variable * at the time of the call. If no threads are blocked on the condition variable * at the time of the call, the function does nothing and return success. * @param cond A condition variable object. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int cnd_signal(cnd_t *cond); /** Broadcast a condition variable. * Unblocks all of the threads that are blocked on the given condition variable * at the time of the call. If no threads are blocked on the condition variable * at the time of the call, the function does nothing and return success. * @param cond A condition variable object. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int cnd_broadcast(cnd_t *cond); /** Wait for a condition variable to become signaled. * The function atomically unlocks the given mutex and endeavors to block until * the given condition variable is signaled by a call to cnd_signal or to * cnd_broadcast. When the calling thread becomes unblocked it locks the mutex * before it returns. * @param cond A condition variable object. * @param mtx A mutex object. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int cnd_wait(cnd_t *cond, mtx_t *mtx); /** Wait for a condition variable to become signaled. * The function atomically unlocks the given mutex and endeavors to block until * the given condition variable is signaled by a call to cnd_signal or to * cnd_broadcast, or until after the specified time. When the calling thread * becomes unblocked it locks the mutex before it returns. * @param cond A condition variable object. * @param mtx A mutex object. * @param xt A point in time at which the request will time out (absolute time). * @return @ref thrd_success upon success, or @ref thrd_timeout if the time * specified in the call was reached without acquiring the requested resource, or * @ref thrd_error if the request could not be honored. */ int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts); /* Thread */ #if defined(_TTHREAD_WIN32_) typedef HANDLE thrd_t; #else typedef pthread_t thrd_t; #endif /** Thread start function. * Any thread that is started with the @ref thrd_create() function must be * started through a function of this type. * @param arg The thread argument (the @c arg argument of the corresponding * @ref thrd_create() call). * @return The thread return value, which can be obtained by another thread * by using the @ref thrd_join() function. */ typedef int (*thrd_start_t)(void *arg); /** Create a new thread. * @param thr Identifier of the newly created thread. * @param func A function pointer to the function that will be executed in * the new thread. * @param arg An argument to the thread function. * @return @ref thrd_success on success, or @ref thrd_nomem if no memory could * be allocated for the thread requested, or @ref thrd_error if the request * could not be honored. * @note A thread’s identifier may be reused for a different thread once the * original thread has exited and either been detached or joined to another * thread. */ int thrd_create(thrd_t *thr, thrd_start_t func, void *arg); /** Identify the calling thread. * @return The identifier of the calling thread. */ thrd_t thrd_current(void); /** NOT YET IMPLEMENTED. */ int thrd_detach(thrd_t thr); /** Compare two thread identifiers. * The function determines if two thread identifiers refer to the same thread. * @return Zero if the two thread identifiers refer to different threads. * Otherwise a nonzero value is returned. */ int thrd_equal(thrd_t thr0, thrd_t thr1); /** Terminate execution of the calling thread. * @param res Result code of the calling thread. */ void thrd_exit(int res); /** Wait for a thread to terminate. * The function joins the given thread with the current thread by blocking * until the other thread has terminated. * @param thr The thread to join with. * @param res If this pointer is not NULL, the function will store the result * code of the given thread in the integer pointed to by @c res. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int thrd_join(thrd_t thr, int *res); /** Put the calling thread to sleep. * Suspend execution of the calling thread. * @param time_point A point in time at which the thread will resume (absolute time). * @param remaining If non-NULL, this parameter will hold the remaining time until * time_point upon return. This will typically be zero, but if * the thread was woken up by a signal that is not ignored before * time_point was reached @c remaining will hold a positive * time. * @return 0 (zero) on successful sleep, or -1 if an interrupt occurred. */ int thrd_sleep(const struct timespec *time_point, struct timespec *remaining); /** Yield execution to another thread. * Permit other threads to run, even if the current thread would ordinarily * continue to run. */ void thrd_yield(void); /* Thread local storage */ #if defined(_TTHREAD_WIN32_) typedef DWORD tss_t; #else typedef pthread_key_t tss_t; #endif /** Destructor function for a thread-specific storage. * @param val The value of the destructed thread-specific storage. */ typedef void (*tss_dtor_t)(void *val); /** Create a thread-specific storage. * @param key The unique key identifier that will be set if the function is * successful. * @param dtor Destructor function. This can be NULL. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. * @note The destructor function is not supported under Windows. If @c dtor is * not NULL when calling this function under Windows, the function will fail * and return @ref thrd_error. */ int tss_create(tss_t *key, tss_dtor_t dtor); /** Delete a thread-specific storage. * The function releases any resources used by the given thread-specific * storage. * @param key The key that shall be deleted. */ void tss_delete(tss_t key); /** Get the value for a thread-specific storage. * @param key The thread-specific storage identifier. * @return The value for the current thread held in the given thread-specific * storage. */ void *tss_get(tss_t key); /** Set the value for a thread-specific storage. * @param key The thread-specific storage identifier. * @param val The value of the thread-specific storage to set for the current * thread. * @return @ref thrd_success on success, or @ref thrd_error if the request could * not be honored. */ int tss_set(tss_t key, void *val); #endif /* _TINYTHREAD_H_ */ ================================================ FILE: thirdparty/glfw/deps/vs2008/stdint.h ================================================ // ISO C9x compliant stdint.h for Microsoft Visual Studio // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 // // Copyright (c) 2006-2008 Alexander Chemeris // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. 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 AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR 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 _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" #endif // _MSC_VER ] #ifndef _MSC_STDINT_H_ // [ #define _MSC_STDINT_H_ #if _MSC_VER > 1000 #pragma once #endif #include // For Visual Studio 6 in C++ mode and for many Visual Studio versions when // compiling for ARM we should wrap include with 'extern "C++" {}' // or compiler give many errors like this: // error C2733: second C linkage of overloaded function 'wmemchr' not allowed #ifdef __cplusplus extern "C" { #endif # include #ifdef __cplusplus } #endif // Define _W64 macros to mark types changing their size, like intptr_t. #ifndef _W64 # if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 # define _W64 __w64 # else # define _W64 # endif #endif // 7.18.1 Integer types // 7.18.1.1 Exact-width integer types // Visual Studio 6 and Embedded Visual C++ 4 doesn't // realize that, e.g. char has the same size as __int8 // so we give up on __intX for them. #if (_MSC_VER < 1300) typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #else typedef signed __int8 int8_t; typedef signed __int16 int16_t; typedef signed __int32 int32_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; #endif typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; // 7.18.1.2 Minimum-width integer types typedef int8_t int_least8_t; typedef int16_t int_least16_t; typedef int32_t int_least32_t; typedef int64_t int_least64_t; typedef uint8_t uint_least8_t; typedef uint16_t uint_least16_t; typedef uint32_t uint_least32_t; typedef uint64_t uint_least64_t; // 7.18.1.3 Fastest minimum-width integer types typedef int8_t int_fast8_t; typedef int16_t int_fast16_t; typedef int32_t int_fast32_t; typedef int64_t int_fast64_t; typedef uint8_t uint_fast8_t; typedef uint16_t uint_fast16_t; typedef uint32_t uint_fast32_t; typedef uint64_t uint_fast64_t; // 7.18.1.4 Integer types capable of holding object pointers #ifdef _WIN64 // [ typedef signed __int64 intptr_t; typedef unsigned __int64 uintptr_t; #else // _WIN64 ][ typedef _W64 signed int intptr_t; typedef _W64 unsigned int uintptr_t; #endif // _WIN64 ] // 7.18.1.5 Greatest-width integer types typedef int64_t intmax_t; typedef uint64_t uintmax_t; // 7.18.2 Limits of specified-width integer types #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 // 7.18.2.1 Limits of exact-width integer types #define INT8_MIN ((int8_t)_I8_MIN) #define INT8_MAX _I8_MAX #define INT16_MIN ((int16_t)_I16_MIN) #define INT16_MAX _I16_MAX #define INT32_MIN ((int32_t)_I32_MIN) #define INT32_MAX _I32_MAX #define INT64_MIN ((int64_t)_I64_MIN) #define INT64_MAX _I64_MAX #define UINT8_MAX _UI8_MAX #define UINT16_MAX _UI16_MAX #define UINT32_MAX _UI32_MAX #define UINT64_MAX _UI64_MAX // 7.18.2.2 Limits of minimum-width integer types #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MIN INT64_MIN #define INT_LEAST64_MAX INT64_MAX #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX // 7.18.2.3 Limits of fastest minimum-width integer types #define INT_FAST8_MIN INT8_MIN #define INT_FAST8_MAX INT8_MAX #define INT_FAST16_MIN INT16_MIN #define INT_FAST16_MAX INT16_MAX #define INT_FAST32_MIN INT32_MIN #define INT_FAST32_MAX INT32_MAX #define INT_FAST64_MIN INT64_MIN #define INT_FAST64_MAX INT64_MAX #define UINT_FAST8_MAX UINT8_MAX #define UINT_FAST16_MAX UINT16_MAX #define UINT_FAST32_MAX UINT32_MAX #define UINT_FAST64_MAX UINT64_MAX // 7.18.2.4 Limits of integer types capable of holding object pointers #ifdef _WIN64 // [ # define INTPTR_MIN INT64_MIN # define INTPTR_MAX INT64_MAX # define UINTPTR_MAX UINT64_MAX #else // _WIN64 ][ # define INTPTR_MIN INT32_MIN # define INTPTR_MAX INT32_MAX # define UINTPTR_MAX UINT32_MAX #endif // _WIN64 ] // 7.18.2.5 Limits of greatest-width integer types #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX // 7.18.3 Limits of other integer types #ifdef _WIN64 // [ # define PTRDIFF_MIN _I64_MIN # define PTRDIFF_MAX _I64_MAX #else // _WIN64 ][ # define PTRDIFF_MIN _I32_MIN # define PTRDIFF_MAX _I32_MAX #endif // _WIN64 ] #define SIG_ATOMIC_MIN INT_MIN #define SIG_ATOMIC_MAX INT_MAX #ifndef SIZE_MAX // [ # ifdef _WIN64 // [ # define SIZE_MAX _UI64_MAX # else // _WIN64 ][ # define SIZE_MAX _UI32_MAX # endif // _WIN64 ] #endif // SIZE_MAX ] // WCHAR_MIN and WCHAR_MAX are also defined in #ifndef WCHAR_MIN // [ # define WCHAR_MIN 0 #endif // WCHAR_MIN ] #ifndef WCHAR_MAX // [ # define WCHAR_MAX _UI16_MAX #endif // WCHAR_MAX ] #define WINT_MIN 0 #define WINT_MAX _UI16_MAX #endif // __STDC_LIMIT_MACROS ] // 7.18.4 Limits of other integer types #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 // 7.18.4.1 Macros for minimum-width integer constants #define INT8_C(val) val##i8 #define INT16_C(val) val##i16 #define INT32_C(val) val##i32 #define INT64_C(val) val##i64 #define UINT8_C(val) val##ui8 #define UINT16_C(val) val##ui16 #define UINT32_C(val) val##ui32 #define UINT64_C(val) val##ui64 // 7.18.4.2 Macros for greatest-width integer constants #define INTMAX_C INT64_C #define UINTMAX_C UINT64_C #endif // __STDC_CONSTANT_MACROS ] #endif // _MSC_STDINT_H_ ] ================================================ FILE: thirdparty/glfw/docs/CMakeLists.txt ================================================ # NOTE: The order of this list determines the order of items in the Guides # (i.e. Pages) list in the generated documentation set(GLFW_DOXYGEN_SOURCES "include/GLFW/glfw3.h" "include/GLFW/glfw3native.h" "docs/main.dox" "docs/news.dox" "docs/quick.dox" "docs/moving.dox" "docs/compile.dox" "docs/build.dox" "docs/intro.dox" "docs/context.dox" "docs/monitor.dox" "docs/window.dox" "docs/input.dox" "docs/vulkan.dox" "docs/compat.dox" "docs/internal.dox") # Format the source list into a Doxyfile INPUT value that Doxygen can parse foreach(path IN LISTS GLFW_DOXYGEN_SOURCES) set(GLFW_DOXYGEN_INPUT "${GLFW_DOXYGEN_INPUT} \\\n\"${GLFW_SOURCE_DIR}/${path}\"") endforeach() configure_file(Doxyfile.in Doxyfile @ONLY) add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}" WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs" COMMENT "Generating HTML documentation" VERBATIM) ================================================ FILE: thirdparty/glfw/docs/CODEOWNERS ================================================ * @elmindreda src/wl_* @linkmauve docs/*.css @glfw/webdev docs/*.less @glfw/webdev docs/*.html @glfw/webdev docs/*.xml @glfw/webdev ================================================ FILE: thirdparty/glfw/docs/CONTRIBUTING.md ================================================ # Contribution Guide ## Contents - [Asking a question](#asking-a-question) - [Reporting a bug](#reporting-a-bug) - [Reporting a compile or link bug](#reporting-a-compile-or-link-bug) - [Reporting a segfault or other crash bug](#reporting-a-segfault-or-other-crash-bug) - [Reporting a context creation bug](#reporting-a-context-creation-bug) - [Reporting a monitor or video mode bug](#reporting-a-monitor-or-video-mode-bug) - [Reporting a window, input or event bug](#reporting-a-window-input-or-event-bug) - [Reporting some other library bug](#reporting-some-other-library-bug) - [Reporting a documentation bug](#reporting-a-documentation-bug) - [Reporting a website bug](#reporting-a-website-bug) - [Requesting a feature](#requesting-a-feature) - [Contributing a bug fix](#contributing-a-bug-fix) - [Contributing a feature](#contributing-a-feature) ## Asking a question Questions about how to use GLFW should be asked either in the [support section](https://discourse.glfw.org/c/support) of the forum, under the [Stack Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on Stack Exchange or in the IRC channel `#glfw` on [Freenode](http://freenode.net/). Questions about the design or implementation of GLFW or about future plans should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the forum or in the IRC channel. Please don't open a GitHub issue to discuss design questions without first checking with a maintainer. ## Reporting a bug If GLFW is behaving unexpectedly at run-time, start by setting an [error callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling). GLFW will often tell you the cause of an error via this callback. If it doesn't, that might be a separate bug. If GLFW is crashing or triggering asserts, make sure that all your object handles and other pointers are valid. For bugs where it makes sense, a short, self contained example is absolutely invaluable. Just put it inline in the body text. Note that if the bug is reproducible with one of the test programs that come with GLFW, just mention that instead. __Don't worry about adding too much information__. Unimportant information can be abbreviated or removed later, but missing information can stall bug fixing, especially when your schedule doesn't align with that of the maintainer. __Please provide text as text, not as images__. This includes code, error messages and any other text. Text in images cannot be found by other users searching for the same problem and may have to be re-typed by maintainers when debugging. You don't need to manually indent your code or other text to quote it with GitHub Markdown; just surround it with triple backticks: ``` Some quoted text. ``` You can also add syntax highlighting by appending the common file extension: ```c int five(void) { return 5; } ``` There are issue labels for both platforms and GPU manufacturers, so there is no need to mention these in the subject line. If you do, it will be removed when the issue is labeled. If your bug is already reported, please add any new information you have, or if it already has everything, give it a :+1:. ### Reporting a compile or link bug __Note:__ GLFW needs many system APIs to do its job, which on some platforms means linking to many system libraries. If you are using GLFW as a static library, that means your application needs to link to these in addition to GLFW. __Note:__ Check the [Compiling GLFW](https://www.glfw.org/docs/latest/compile.html) guide and or [Building applications](https://www.glfw.org/docs/latest/build.html) guide for before opening an issue of this kind. Most issues are caused by a missing package or linker flag. Always include the __operating system name and version__ (e.g. `Windows 7 64-bit` or `Ubuntu 15.10`) and the __compiler name and version__ (e.g. `Visual C++ 2015 Update 2`). If you are using an official release of GLFW, include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. Please also include the __complete build log__ from your compiler and linker, even if it's long. It can always be shortened later, if necessary. #### Quick template ``` OS and version: Compiler version: Release or commit: Build log: ``` ### Reporting a segfault or other crash bug Always include the __operating system name and version__ (e.g. `Windows 7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. Please also include any __error messages__ provided to your application via the [error callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and the __full call stack__ of the crash, or if the crash does not occur in debug mode, mention that instead. #### Quick template ``` OS and version: Release or commit: Error messages: Call stack: ``` ### Reporting a context creation bug __Note:__ Windows ships with graphics drivers that do not support OpenGL. If GLFW says that your machine lacks support for OpenGL, it very likely does. Install drivers from the computer manufacturer or graphics card manufacturer ([Nvidia](https://www.geforce.com/drivers), [AMD](https://www.amd.com/en/support), [Intel](https://www-ssl.intel.com/content/www/us/en/support/detect.html)) to fix this. __Note:__ AMD only supports OpenGL ES on Windows via EGL. See the [GLFW\_CONTEXT\_CREATION\_API](https://www.glfw.org/docs/latest/window_guide.html#window_hints_ctx) hint for how to select EGL. Please verify that context creation also fails with the `glfwinfo` tool before reporting it as a bug. This tool is included in the GLFW source tree as `tests/glfwinfo.c` and is built along with the library. It has switches for all GLFW context and framebuffer hints. Run `glfwinfo -h` for a complete list. Always include the __operating system name and version__ (e.g. `Windows 7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. If you are running your program in a virtual machine, please mention this and include the __VM name and version__ (e.g. `VirtualBox 5.1`). Please also include the __GLFW version string__ (`3.2.0 X11 EGL clock_gettime /dev/js`), as described [here](https://www.glfw.org/docs/latest/intro.html#intro_version_string), the __GPU model and driver version__ (e.g. `GeForce GTX660 with 352.79`), and the __output of `glfwinfo`__ (with switches matching any hints you set in your code) when reporting this kind of bug. If this tool doesn't run on the machine, mention that instead. #### Quick template ``` OS and version: GPU and driver: Release or commit: Version string: glfwinfo output: ``` ### Reporting a monitor or video mode bug __Note:__ On headless systems on some platforms, no monitors are reported. This causes glfwGetPrimaryMonitor to return `NULL`, which not all applications are prepared for. __Note:__ Some third-party tools report more video modes than are approved of by the OS. For safety and compatibility, GLFW only reports video modes the OS wants programs to use. This is not a bug. The `monitors` tool is included in the GLFW source tree as `tests/monitors.c` and is built along with the library. It lists all information GLFW provides about monitors it detects. Always include the __operating system name and version__ (e.g. `Windows 7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. If you are running your program in a virtual machine, please mention this and include the __VM name and version__ (e.g. `VirtualBox 5.1`). Please also include any __error messages__ provided to your application via the [error callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and the __output of `monitors`__ when reporting this kind of bug. If this tool doesn't run on the machine, mention this instead. #### Quick template ``` OS and version: Release or commit: Error messages: monitors output: ``` ### Reporting a window, input or event bug __Note:__ The exact ordering of related window events will sometimes differ. __Note:__ Window moving and resizing (by the user) will block the main thread on some platforms. This is not a bug. Set a [refresh callback](https://www.glfw.org/docs/latest/window.html#window_refresh) if you want to keep the window contents updated during a move or size operation. The `events` tool is included in the GLFW source tree as `tests/events.c` and is built along with the library. It prints all information provided to every callback supported by GLFW as events occur. Each event is listed with the time and a unique number to make discussions about event logs easier. The tool has command-line options for creating multiple windows and full screen windows. Always include the __operating system name and version__ (e.g. `Windows 7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. If you are running your program in a virtual machine, please mention this and include the __VM name and version__ (e.g. `VirtualBox 5.1`). Please also include any __error messages__ provided to your application via the [error callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and if relevant, the __output of `events`__ when reporting this kind of bug. If this tool doesn't run on the machine, mention this instead. __X11:__ If possible, please include what desktop environment (e.g. GNOME, Unity, KDE) and/or window manager (e.g. Openbox, dwm, Window Maker) you are running. If the bug is related to keyboard input, please include any input method (e.g. ibus, SCIM) you are using. #### Quick template ``` OS and version: Release or commit: Error messages: events output: ``` ### Reporting some other library bug Always include the __operating system name and version__ (e.g. `Windows 7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. Please also include any __error messages__ provided to your application via the [error callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling), if relevant. #### Quick template ``` OS and version: Release or commit: Error messages: ``` ### Reporting a documentation bug If you found a bug in the documentation, including this file, then it's fine to just link to that web page or mention that source file. You don't need to match the source to the output or vice versa. ### Reporting a website bug If the bug is in the documentation (anything under `/docs/`) then please see the section above. Bugs in the rest of the site are reported to the [website source repository](https://github.com/glfw/website/issues). ## Requesting a feature Please explain why you need the feature and how you intend to use it. If you have a specific API design in mind, please add that as well. If you have or are planning to write code for the feature, see the section below. If there already is a request for the feature you need, add your specific use case unless it is already mentioned. If it is, give it a :+1:. ## Contributing a bug fix __Note:__ You must have all necessary [intellectual property rights](https://en.wikipedia.org/wiki/Intellectual_property) to any code you contribute. If you did not write the code yourself, you must explain where it came from and under what license you received it. Even code using the same license as GLFW may not be copied without attribution. __There is no preferred patch size__. A one character fix is just as welcome as a thousand line one, if that is the appropriate size for the fix. In addition to the code, a complete bug fix includes: - Change log entry in `README.md`, describing the incorrect behavior - Credits entries for all authors of the bug fix Bug fixes will not be rejected because they don't include all the above parts, but please keep in mind that maintainer time is finite and that there are many other bugs and features to work on. If the patch fixes a bug introduced after the last release, it should not get a change log entry. If you haven't already, read the excellent article [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/). ## Contributing a feature __Note:__ You must have all necessary rights to any code you contribute. If you did not write the code yourself, you must explain where it came from and under what license. Even code using the same license as GLFW may not be copied without attribution. __Note:__ If you haven't already implemented the feature, check first if there already is an open issue for it and if it's already being developed in an [experimental branch](https://github.com/glfw/glfw/branches/all). __There is no preferred patch size__. A one character change is just as welcome as one adding a thousand line one, if that is the appropriate size for the feature. In addition to the code, a complete feature includes: - Change log entry in `README.md`, listing all new symbols - News page entry, briefly describing the feature - Guide documentation, with minimal examples, in the relevant guide - Reference documentation, with all applicable tags - Cross-references and mentions in appropriate places - Credits entries for all authors of the feature If the feature requires platform-specific code, at minimum stubs must be added for the new platform function to all supported and experimental platforms. If it adds a new callback, support for it must be added to `tests/event.c`. If it adds a new monitor property, support for it must be added to `tests/monitor.c`. If it adds a new OpenGL, OpenGL ES or Vulkan option or extension, support for it must be added to `tests/glfwinfo.c` and the behavior of the library when the extension is missing documented in `docs/compat.dox`. If you haven't already, read the excellent article [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/). Features will not be rejected because they don't include all the above parts, but please keep in mind that maintainer time is finite and that there are many other features and bugs to work on. Please also keep in mind that any part of the public API that has been included in a release cannot be changed until the next _major_ version. Features can be added and existing parts can sometimes be overloaded (in the general sense of doing more things, not in the C++ sense), but code written to the API of one minor release should both compile and run on subsequent minor releases. ================================================ FILE: thirdparty/glfw/docs/Doxyfile.in ================================================ # Doxyfile 1.8.3.1 # 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 sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "GLFW" # 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 = @GLFW_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "A multi-platform library for OpenGL, window and input" # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # 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 = "@GLFW_BINARY_DIR@/docs" # 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, Esperanto, 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-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 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 = NO # 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 = # 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 = NO # 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. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. 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 if your file system # 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 = NO # 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 = 8 # 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 = "thread_safety=@par Thread safety^^" \ "pointer_lifetime=@par Pointer lifetime^^" \ "analysis=@par Analysis^^" \ "reentrancy=@par Reentrancy^^" \ "errors=@par Errors^^" \ "callback_signature=@par Callback signature^^" \ "glfw3=__GLFW 3:__" \ "x11=__X11:__" \ "wayland=__Wayland:__" \ "win32=__Windows:__" \ "macos=__macOS:__" \ "linux=__Linux:__" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # 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 = YES # 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, CSharp, 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. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be # prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # 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 makes 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 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 = NO # 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 the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # 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 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_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 = YES # 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_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # 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 namespaces 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 = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # 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 = NO # 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_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = 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 = YES # 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 # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = 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 section-label ... \endif # and \cond section-label ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro 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 macros 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 # 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 = NO # 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. To 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 = "@GLFW_SOURCE_DIR@/docs/DoxygenLayout.xml" # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. Do not use # file names with spaces, bibtex cannot handle them. CITE_BIB_FILES = #--------------------------------------------------------------------------- # 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 = YES # 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 # The WARN_NO_PARAMDOC option can be enabled 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 = "@GLFW_BINARY_DIR@/docs/warnings.txt" #--------------------------------------------------------------------------- # 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 = @GLFW_DOXYGEN_INPUT@ # 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++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.h *.dox # 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 = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # 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. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system 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 = # 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 = APIENTRY GLFWAPI # 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 = "@GLFW_SOURCE_DIR@/examples" # 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 or if # non of the patterns match the file name, INPUT_FILTER is applied. 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 # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = # If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page (index.html). # This can be useful if you have a project on for instance GitHub and want reuse # the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # 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 = NO # 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, C++ and Fortran 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 = YES # 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 = glfw GLFW_ #--------------------------------------------------------------------------- # 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 = .html # 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. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = "@GLFW_SOURCE_DIR@/docs/header.html" # 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 = "@GLFW_SOURCE_DIR@/docs/footer.html" # 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 left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = 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. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # 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 # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # 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 = NO # 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 = # 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 = # 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 = org.doxygen.Project # 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 = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # 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 YES, 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 (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # 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 = 300 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # 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 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and # SVG. The default value is HTML-CSS, which is slower, but has the best # compatibility. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. # There are two flavours of web server based search depending on the # EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for # searching and an index file used by the script. When EXTERNAL_SEARCH is # enabled the indexing and searching needs to be provided by external tools. # See the manual for details. SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file # which needs to be processed by an external indexer. Doxygen will invoke an # external search engine pointed to by the SEARCHENGINE_URL option to obtain # the search results. Doxygen ships with an example indexer (doxyindexer) and # search engine (doxysearch.cgi) which are based on the open source search engine # library Xapian. See the manual for configuration details. EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will returned the search results when EXTERNAL_SEARCH is enabled. # Doxygen ships with an example search engine (doxysearch) which is based on # the open source search engine library Xapian. See the manual for configuration # details. SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the # SEARCHDATA_FILE tag the name of this file can be specified. SEARCHDATA_FILE = searchdata.xml # When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple # projects and redirect the results back to the right project. EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are # all added to the same external search index. Each project needs to have a # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id # of to a relative location where the documentation can be found. # The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # 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. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. 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, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # 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 = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # 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 = YES # 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 = YES # 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 # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # 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 style sheet 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 # 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 = YES # 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 = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when 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 = GLFWAPI= \ GLFW_EXPOSE_NATIVE_WIN32 \ GLFW_EXPOSE_NATIVE_WGL \ GLFW_EXPOSE_NATIVE_X11 \ GLFW_EXPOSE_NATIVE_WAYLAND \ GLFW_EXPOSE_NATIVE_GLX \ GLFW_EXPOSE_NATIVE_COCOA \ GLFW_EXPOSE_NATIVE_NSGL \ GLFW_EXPOSE_NATIVE_EGL \ GLFW_EXPOSE_NATIVE_OSMESA \ VK_VERSION_1_0 # 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 that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these 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. For each # tag file the location of the external documentation should be added. 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. 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 #--------------------------------------------------------------------------- # 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 also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # 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 # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You 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 = Helvetica # 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 Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. 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 # 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 the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # manageable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # 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 generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH 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 svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # 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 MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_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 ================================================ FILE: thirdparty/glfw/docs/DoxygenLayout.xml ================================================ ================================================ FILE: thirdparty/glfw/docs/SUPPORT.md ================================================ # Support resources See the [latest documentation](http://www.glfw.org/docs/latest/) for tutorials, guides and the API reference. If you have questions about using GLFW, we have a [forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on [Freenode](http://freenode.net/). Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues). Please check the [contribution guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for information on what to include when reporting a bug. ================================================ FILE: thirdparty/glfw/docs/build.dox ================================================ /*! @page build_guide Building applications @tableofcontents This is about compiling and linking applications that use GLFW. For information on how to write such applications, start with the [introductory tutorial](@ref quick_guide). For information on how to compile the GLFW library itself, see @ref compile_guide. This is not a tutorial on compilation or linking. It assumes basic understanding of how to compile and link a C program as well as how to use the specific compiler of your chosen development environment. The compilation and linking process should be explained in your C programming material and in the documentation for your development environment. @section build_include Including the GLFW header file You should include the GLFW header in the source files where you use OpenGL or GLFW. @code #include @endcode This header declares the GLFW API and by default also includes the OpenGL header from your development environment. See below for how to control this. The GLFW header also defines any platform-specific macros needed by your OpenGL header, so it can be included without needing any window system headers. For example, under Windows you are normally required to include `windows.h` before the OpenGL header, which would bring in the whole Win32 API. The GLFW header duplicates the small number of macros needed. It does this only when needed, so if `windows.h` _is_ included, the GLFW header does not try to redefine those symbols. The reverse is not true, i.e. `windows.h` cannot cope if any of its symbols have already been defined. In other words: - Do _not_ include the OpenGL headers yourself, as GLFW does this for you - Do _not_ include `windows.h` or other platform-specific headers unless you plan on using those APIs directly - If you _do_ need to include such headers, do it _before_ including the GLFW header and it will handle this If you are using an OpenGL extension loading library such as [glad](https://github.com/Dav1dde/glad), the extension loader header should be included _before_ the GLFW one. @code #include #include @endcode Alternatively the @ref GLFW_INCLUDE_NONE macro (described below) can be used to prevent the GLFW header from including the OpenGL header. @code #define GLFW_INCLUDE_NONE #include #include @endcode @subsection build_macros GLFW header option macros These macros may be defined before the inclusion of the GLFW header and affect its behavior. @anchor GLFW_DLL __GLFW_DLL__ is required on Windows when using the GLFW DLL, to tell the compiler that the GLFW functions are defined in a DLL. The following macros control which OpenGL or OpenGL ES API header is included. Only one of these may be defined at a time. @note GLFW does not provide any of the API headers mentioned below. They are provided by your development environment or your OpenGL, OpenGL ES or Vulkan SDK, and most of them can be downloaded from the [Khronos Registry](https://www.khronos.org/registry/). @anchor GLFW_INCLUDE_GLCOREARB __GLFW_INCLUDE_GLCOREARB__ makes the GLFW header include the modern `GL/glcorearb.h` header (`OpenGL/gl3.h` on macOS) instead of the regular OpenGL header. @anchor GLFW_INCLUDE_ES1 __GLFW_INCLUDE_ES1__ makes the GLFW header include the OpenGL ES 1.x `GLES/gl.h` header instead of the regular OpenGL header. @anchor GLFW_INCLUDE_ES2 __GLFW_INCLUDE_ES2__ makes the GLFW header include the OpenGL ES 2.0 `GLES2/gl2.h` header instead of the regular OpenGL header. @anchor GLFW_INCLUDE_ES3 __GLFW_INCLUDE_ES3__ makes the GLFW header include the OpenGL ES 3.0 `GLES3/gl3.h` header instead of the regular OpenGL header. @anchor GLFW_INCLUDE_ES31 __GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.1 `GLES3/gl31.h` header instead of the regular OpenGL header. @anchor GLFW_INCLUDE_ES32 __GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.2 `GLES3/gl32.h` header instead of the regular OpenGL header. @anchor GLFW_INCLUDE_NONE __GLFW_INCLUDE_NONE__ makes the GLFW header not include any OpenGL or OpenGL ES API header. This is useful in combination with an extension loading library. If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h` header (`OpenGL/gl.h` on macOS) is included. The following macros control the inclusion of additional API headers. Any number of these may be defined simultaneously, and/or together with one of the above macros. @anchor GLFW_INCLUDE_VULKAN __GLFW_INCLUDE_VULKAN__ makes the GLFW header include the Vulkan `vulkan/vulkan.h` header in addition to any selected OpenGL or OpenGL ES header. @anchor GLFW_INCLUDE_GLEXT __GLFW_INCLUDE_GLEXT__ makes the GLFW header include the appropriate extension header for the OpenGL or OpenGL ES header selected above after and in addition to that header. @anchor GLFW_INCLUDE_GLU __GLFW_INCLUDE_GLU__ makes the header include the GLU header in addition to the header selected above. This should only be used with the standard OpenGL header and only for compatibility with legacy code. GLU has been deprecated and should not be used in new code. @note None of these macros may be defined during the compilation of GLFW itself. If your build includes GLFW and you define any these in your build files, make sure they are not applied to the GLFW sources. @section build_link Link with the right libraries GLFW is essentially a wrapper of various platform-specific APIs and therefore needs to link against many different system libraries. If you are using GLFW as a shared library / dynamic library / DLL then it takes care of these links. However, if you are using GLFW as a static library then your executable will need to link against these libraries. On Windows and macOS, the list of system libraries is static and can be hard-coded into your build environment. See the section for your development environment below. On Linux and other Unix-like operating systems, the list varies but can be retrieved in various ways as described below. A good general introduction to linking is [Beginner's Guide to Linkers](https://www.lurklurk.org/linkers/linkers.html) by David Drysdale. @subsection build_link_win32 With MinGW or Visual C++ on Windows The static version of the GLFW library is named `glfw3`. When using this version, it is also necessary to link with some libraries that GLFW uses. When using MinGW to link an application with the static version of GLFW, you must also explicitly link with `gdi32`. Other toolchains including MinGW-w64 include it in the set of default libraries along with other dependencies like `user32` and `kernel32`. The link library for the GLFW DLL is named `glfw3dll`. When compiling an application that uses the DLL version of GLFW, you need to define the @ref GLFW_DLL macro _before_ any inclusion of the GLFW header. This can be done either with a compiler switch or by defining it in your source code. @subsection build_link_cmake_source With CMake and GLFW source This section is about using CMake to compile and link GLFW along with your application. If you want to use an installed binary instead, see @ref build_link_cmake_package. With a few changes to your `CMakeLists.txt` you can have the GLFW source tree built along with your application. When including GLFW as part of your build, you probably don't want to build the GLFW tests, examples and documentation. To disable these, set the corresponding cache variables before adding the GLFW source tree. @code set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) @endcode Add the root directory of the GLFW source tree to your project. This will add the `glfw` target to your project. @code{.cmake} add_subdirectory(path/to/glfw) @endcode Once GLFW has been added, link your application against the `glfw` target. This adds the GLFW library and its link-time dependencies as it is currently configured, the include directory for the GLFW header and, when applicable, the @ref GLFW_DLL macro. @code{.cmake} target_link_libraries(myapp glfw) @endcode Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime. If your application calls OpenGL directly, instead of using a modern [extension loader library](@ref context_glext_auto), use the OpenGL CMake package. @code{.cmake} find_package(OpenGL REQUIRED) @endcode If OpenGL is found, the `OpenGL::GL` target is added to your project, containing library and include directory paths. Link against this like above. @code{.cmake} target_link_libraries(myapp OpenGL::GL) @endcode @subsection build_link_cmake_package With CMake and installed GLFW binaries This section is about using CMake to link GLFW after it has been built and installed. If you want to build it along with your application instead, see @ref build_link_cmake_source. With a few changes to your `CMakeLists.txt` you can locate the package and target files generated when GLFW is installed. @code{.cmake} find_package(glfw3 3.3 REQUIRED) @endcode Once GLFW has been added to the project, link against it with the `glfw` target. This adds the GLFW library and its link-time dependencies, the include directory for the GLFW header and, when applicable, the @ref GLFW_DLL macro. @code{.cmake} target_link_libraries(myapp glfw) @endcode Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime. If your application calls OpenGL directly, instead of using a modern [extension loader library](@ref context_glext_auto), use the OpenGL CMake package. @code{.cmake} find_package(OpenGL REQUIRED) @endcode If OpenGL is found, the `OpenGL::GL` target is added to your project, containing library and include directory paths. Link against this like above. @code{.cmake} target_link_libraries(myapp OpenGL::GL) @endcode @subsection build_link_pkgconfig With makefiles and pkg-config on Unix GLFW supports [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/), and the `glfw3.pc` pkg-config file is generated when the GLFW library is built and is installed along with it. A pkg-config file describes all necessary compile-time and link-time flags and dependencies needed to use a library. When they are updated or if they differ between systems, you will get the correct ones automatically. A typical compile and link command-line when using the static version of the GLFW library may look like this: @code{.sh} cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --static --libs glfw3) @endcode If you are using the shared version of the GLFW library, omit the `--static` flag. @code{.sh} cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3) @endcode You can also use the `glfw3.pc` file without installing it first, by using the `PKG_CONFIG_PATH` environment variable. @code{.sh} env PKG_CONFIG_PATH=path/to/glfw/src cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3) @endcode The dependencies do not include OpenGL, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime. If your application calls OpenGL directly, instead of using a modern [extension loader library](@ref context_glext_auto), you should add the `gl` pkg-config package. @code{.sh} cc $(pkg-config --cflags glfw3 gl) -o myprog myprog.c $(pkg-config --libs glfw3 gl) @endcode @subsection build_link_xcode With Xcode on macOS If you are using the dynamic library version of GLFW, add it to the project dependencies. If you are using the static library version of GLFW, add it and the Cocoa, OpenGL and IOKit frameworks to the project as dependencies. They can all be found in `/System/Library/Frameworks`. @subsection build_link_osx With command-line on macOS It is recommended that you use [pkg-config](@ref build_link_pkgconfig) when building from the command line on macOS. That way you will get any new dependencies added automatically. If you still wish to build manually, you need to add the required frameworks and libraries to your command-line yourself using the `-l` and `-framework` switches. If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do: @code{.sh} cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit @endcode If you are using the static library, named `libglfw3.a`, substitute `-lglfw3` for `-lglfw`. Note that you do not add the `.framework` extension to a framework when linking against it from the command-line. @note Your machine may have `libGL.*.dylib` style OpenGL library, but that is for the X Window System and will not work with the macOS native version of GLFW. */ ================================================ FILE: thirdparty/glfw/docs/compat.dox ================================================ /*! @page compat_guide Standards conformance @tableofcontents This guide describes the various API extensions used by this version of GLFW. It lists what are essentially implementation details, but which are nonetheless vital knowledge for developers intending to deploy their applications on a wide range of machines. The information in this guide is not a part of GLFW API, but merely preconditions for some parts of the library to function on a given machine. Any part of this information may change in future versions of GLFW and that will not be considered a breaking API change. @section compat_x11 X11 extensions, protocols and IPC standards As GLFW uses Xlib directly, without any intervening toolkit library, it has sole responsibility for interacting well with the many and varied window managers in use on Unix-like systems. In order for applications and window managers to work well together, a number of standards and conventions have been developed that regulate behavior outside the scope of the X11 API; most importantly the [Inter-Client Communication Conventions Manual](https://www.tronche.com/gui/x/icccm/) (ICCCM) and [Extended Window Manager Hints](https://standards.freedesktop.org/wm-spec/wm-spec-latest.html) (EWMH) standards. GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows. If the running window manager does not support this property, the `GLFW_DECORATED` hint will have no effect. GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user attempting to close the GLFW window. If the running window manager does not support this protocol, the close callback will never be called. GLFW uses the EWMH `_NET_WM_PING` protocol, allowing the window manager notify the user when the application has stopped responding, i.e. when it has ceased to process events. If the running window manager does not support this protocol, the user will not be notified if the application locks up. GLFW uses the EWMH `_NET_WM_STATE_FULLSCREEN` window state to tell the window manager to make the GLFW window full screen. If the running window manager does not support this state, full screen windows may not work properly. GLFW has a fallback code path in case this state is unavailable, but every window manager behaves slightly differently in this regard. GLFW uses the EWMH `_NET_WM_BYPASS_COMPOSITOR` window property to tell a compositing window manager to un-redirect full screen GLFW windows. If the running window manager uses compositing but does not support this property then additional copying may be performed for each buffer swap of full screen windows. GLFW uses the [clipboard manager protocol](https://www.freedesktop.org/wiki/ClipboardManager/) to push a clipboard string (i.e. selection) owned by a GLFW window about to be destroyed to the clipboard manager. If there is no running clipboard manager, the clipboard string will be unavailable once the window has been destroyed. GLFW uses the [X drag-and-drop protocol](https://www.freedesktop.org/wiki/Specifications/XDND/) to provide file drop events. If the application originating the drag does not support this protocol, drag and drop will not work. GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the running X server does not support this version of this extension, multi-monitor support will not function and only a single, desktop-spanning monitor will be reported. GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp support. If the running X server does not support either or both of these extensions, gamma ramp support will not function. GLFW uses the Xkb extension and detectable auto-repeat to provide keyboard input. If the running X server does not support this extension, a non-Xkb fallback path is used. GLFW uses the XInput2 extension to provide raw, non-accelerated mouse motion when the cursor is disabled. If the running X server does not support this extension, regular accelerated mouse motion will be used. GLFW uses both the XRender extension and the compositing manager to support transparent window framebuffers. If the running X server does not support this extension or there is no running compositing manager, the `GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect. @section compat_wayland Wayland protocols and IPC standards As GLFW uses libwayland directly, without any intervening toolkit library, it has sole responsibility for interacting well with every compositor in use on Unix-like systems. Most of the features are provided by the core protocol, while cursor support is provided by the libwayland-cursor helper library, EGL integration by libwayland-egl, and keyboard handling by [libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some protocols from wayland-protocols to provide additional features if the compositor supports them. GLFW uses xkbcommon 0.5.0 to provide compose key support. When it has been built against an older xkbcommon, the compose key will be disabled even if it has been configured in the compositor. GLFW uses the [xdg-shell protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml) to provide better window management. This protocol is part of wayland-protocols 1.12, and mandatory at build time. If the running compositor does not support this protocol, the older [wl_shell interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972) will be used instead. This will result in a worse integration with the desktop, especially on tiling compositors. GLFW uses the [relative pointer protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml) alongside the [pointer constraints protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml) to implement disabled cursor. These two protocols are part of wayland-protocols 1.1, and mandatory at build time. If the running compositor does not support both of these protocols, disabling the cursor will have no effect. GLFW uses the [idle inhibit protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml) to prohibit the screensaver from starting. This protocol is part of wayland-protocols 1.6, and mandatory at build time. If the running compositor does not support this protocol, the screensaver may start even for full screen windows. GLFW uses the [xdg-decoration protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) to request decorations to be drawn around its windows. This protocol is part of wayland-protocols 1.15, and mandatory at build time. If the running compositor does not support this protocol, a very simple frame will be drawn by GLFW itself, using the [viewporter protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml) alongside [subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598). This protocol is part of wayland-protocols 1.4, and mandatory at build time. If the running compositor does not support this protocol either, no decorations will be drawn around windows. @section compat_glx GLX extensions The GLX API is the default API used to create OpenGL contexts on Unix-like systems using the X Window System. GLFW uses the GLX 1.3 `GLXFBConfig` functions to enumerate and select framebuffer pixel formats. If GLX 1.3 is not supported, @ref glfwInit will fail. GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and `GLX_SGI_swap_control` extensions to provide vertical retrace synchronization (or _vsync_), in that order of preference. Where none of these extension are available, calling @ref glfwSwapInterval will have no effect. GLFW uses the `GLX_ARB_multisample` extension to create contexts with multisampling anti-aliasing. Where this extension is unavailable, the `GLFW_SAMPLES` hint will have no effect. GLFW uses the `GLX_ARB_create_context` extension when available, even when creating OpenGL contexts of version 2.1 and below. Where this extension is unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref glfwCreateWindow to fail. GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for context profiles. Where this extension is unavailable, setting the `GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE`, or setting `GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` or `GLFW_NO_API` will cause @ref glfwCreateWindow to fail. GLFW uses the `GLX_ARB_context_flush_control` extension to provide control over whether a context is flushed when it is released (made non-current). Where this extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no effect and the context will always be flushed when released. GLFW uses the `GLX_ARB_framebuffer_sRGB` and `GLX_EXT_framebuffer_sRGB` extensions to provide support for sRGB framebuffers. Where both of these extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect. @section compat_wgl WGL extensions The WGL API is used to create OpenGL contexts on Microsoft Windows and other implementations of the Win32 API, such as Wine. GLFW uses either the `WGL_EXT_extension_string` or the `WGL_ARB_extension_string` extension to check for the presence of all other WGL extensions listed below. If both are available, the EXT one is preferred. If neither is available, no other extensions are used and many GLFW features related to context creation will have no effect or cause errors when used. GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace synchronization (or _vsync_). Where this extension is unavailable, calling @ref glfwSwapInterval will have no effect. GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to create contexts with multisampling anti-aliasing. Where these extensions are unavailable, the `GLFW_SAMPLES` hint will have no effect. GLFW uses the `WGL_ARB_create_context` extension when available, even when creating OpenGL contexts of version 2.1 and below. Where this extension is unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref glfwCreateWindow to fail. GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for context profiles. Where this extension is unavailable, setting the `GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE` will cause @ref glfwCreateWindow to fail. GLFW uses the `WGL_ARB_context_flush_control` extension to provide control over whether a context is flushed when it is released (made non-current). Where this extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no effect and the context will always be flushed when released. GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB` extensions to provide support for sRGB framebuffers. Where both of these extension are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect. @section compat_osx OpenGL on macOS Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then only forward-compatible, core profile contexts are supported. Support for OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible, core profile contexts. There is also still no mechanism for requesting debug contexts or no-error contexts. Versions of Mac OS X earlier than 10.7 support at most OpenGL version 2.1. Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if given version 3.0 or 3.1. The `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to `GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to `GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts. The `GLFW_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored. Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to a non-default value will cause @ref glfwCreateWindow to fail and the `GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored. @section compat_vulkan Vulkan loader and API By default, GLFW uses the standard system-wide Vulkan loader to access the Vulkan API on all platforms except macOS. This is installed by both graphics drivers and Vulkan SDKs. If either the loader or at least one minimally functional ICD is missing, @ref glfwVulkanSupported will return `GLFW_FALSE` and all other Vulkan-related functions will fail with an @ref GLFW_API_UNAVAILABLE error. @section compat_wsi Vulkan WSI extensions The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on all supported platforms. GLFW uses the `VK_KHR_surface` and `VK_KHR_win32_surface` extensions to create surfaces on Microsoft Windows. If any of these extensions are not available, @ref glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail. GLFW uses the `VK_KHR_surface` and either the `VK_MVK_macos_surface` or `VK_EXT_metal_surface` extensions to create surfaces on macOS. If any of these extensions are not available, @ref glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail. GLFW uses the `VK_KHR_surface` and either the `VK_KHR_xlib_surface` or `VK_KHR_xcb_surface` extensions to create surfaces on X11. If `VK_KHR_surface` or both `VK_KHR_xlib_surface` and `VK_KHR_xcb_surface` are not available, @ref glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail. GLFW uses the `VK_KHR_surface` and `VK_KHR_wayland_surface` extensions to create surfaces on Wayland. If any of these extensions are not available, @ref glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail. */ ================================================ FILE: thirdparty/glfw/docs/compile.dox ================================================ /*! @page compile_guide Compiling GLFW @tableofcontents This is about compiling the GLFW library itself. For information on how to build applications that use GLFW, see @ref build_guide. @section compile_cmake Using CMake GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles for a particular development environment. If you are on a Unix-like system such as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you can install its CMake package. If not, you can download installers for Windows and macOS from the [CMake website](https://cmake.org/). @note CMake only generates project files or makefiles. It does not compile the actual GLFW library. To compile GLFW, first generate these files for your chosen development environment and then use them to compile the actual GLFW library. @subsection compile_deps Dependencies Once you have installed CMake, make sure that all other dependencies are available. On some platforms, GLFW needs a few additional packages to be installed. See the section for your chosen platform and development environment below. @subsubsection compile_deps_msvc Dependencies for Visual C++ on Windows The Windows SDK bundled with Visual C++ already contains all the necessary headers, link libraries and tools except for CMake. Move on to @ref compile_generate. @subsubsection compile_deps_mingw Dependencies for MinGW or MinGW-w64 on Windows Both the MinGW and the MinGW-w64 packages already contain all the necessary headers, link libraries and tools except for CMake. Move on to @ref compile_generate. @subsubsection compile_deps_mingw_cross Dependencies for MinGW or MinGW-w64 cross-compilation Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives like Ubuntu have the `mingw-w64` package for both. GLFW has CMake toolchain files in the `CMake/` directory that set up cross-compilation of Windows binaries. To use these files you add an option when running `cmake` to generate the project files or makefiles: @code{.sh} cmake -DCMAKE_TOOLCHAIN_FILE= . @endcode The exact toolchain file to use depends on the prefix used by the MinGW or MinGW-w64 binaries on your system. You can usually see this in the /usr directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation would be: @code{.sh} cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake . @endcode For more details see the article [CMake Cross Compiling](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling) on the CMake wiki. Once you have this set up, move on to @ref compile_generate. @subsubsection compile_deps_xcode Dependencies for Xcode on macOS Xcode comes with all necessary tools except for CMake. The required headers and libraries are included in the core macOS frameworks. Xcode can be downloaded from the Mac App Store or from the ADC Member Center. Once you have Xcode installed, move on to @ref compile_generate. @subsubsection compile_deps_x11 Dependencies for Linux and X11 To compile GLFW for X11, you need to have the X11 packages installed, as well as the basic development tools like GCC and make. For example, on Ubuntu and other distributions based on Debian GNU/Linux, you need to install the `xorg-dev` package, which pulls in all X.org header packages. Once you have installed the necessary packages, move on to @ref compile_generate. @subsubsection compile_deps_wayland Dependencies for Linux and Wayland To compile GLFW for Wayland, you need to have the Wayland packages installed, as well as the basic development tools like GCC and make. For example, on Ubuntu and other distributions based on Debian GNU/Linux, you need to install the `libwayland-dev` package, which contains all Wayland headers and pulls in wayland-scanner, as well as the `wayland-protocols` and `extra-cmake-modules` packages. Once you have installed the necessary packages, move on to @ref compile_generate. @subsection compile_deps_osmesa Dependencies for Linux and OSMesa To compile GLFW for OSMesa, you need to install the OSMesa library and header packages. For example, on Ubuntu and other distributions based on Debian GNU/Linux, you need to install the `libosmesa6-dev` package. The OSMesa library is required at runtime for context creation and is loaded on demand. Once you have installed the necessary packages, move on to @ref compile_generate. @subsection compile_generate Generating build files with CMake Once you have all necessary dependencies it is time to generate the project files or makefiles for your development environment. CMake needs to know two paths for this: the path to the _root_ directory of the GLFW source tree (i.e. _not_ the `src` subdirectory) and the target path for the generated files and compiled binaries. If these are the same, it is called an in-tree build, otherwise it is called an out-of-tree build. One of several advantages of out-of-tree builds is that you can generate files and compile for different development environments using a single source tree. @note This section is about generating the project files or makefiles necessary to compile the GLFW library, not about compiling the actual library. @subsubsection compile_generate_cli Generating files with the CMake command-line tool To make an in-tree build, enter the _root_ directory of the GLFW source tree (i.e. _not_ the `src` subdirectory) and run CMake. The current directory is used as target path, while the path provided as an argument is used to find the source tree. @code{.sh} cd cmake . @endcode To make an out-of-tree build, make a directory outside of the source tree, enter it and run CMake with the (relative or absolute) path to the root of the source tree as an argument. @code{.sh} mkdir glfw-build cd glfw-build cmake @endcode Once you have generated the project files or makefiles for your chosen development environment, move on to @ref compile_compile. @subsubsection compile_generate_gui Generating files with the CMake GUI If you are using the GUI version, choose the root of the GLFW source tree as source location and the same directory or another, empty directory as the destination for binaries. Choose _Configure_, change any options you wish to, _Configure_ again to let the changes take effect and then _Generate_. Once you have generated the project files or makefiles for your chosen development environment, move on to @ref compile_compile. @subsection compile_compile Compiling the library You should now have all required dependencies and the project files or makefiles necessary to compile GLFW. Go ahead and compile the actual GLFW library with these files, as you would with any other project. Once the GLFW library is compiled, you are ready to build your applications, linking it to the GLFW library. See @ref build_guide for more information. @subsection compile_options CMake options The CMake files for GLFW provide a number of options, although not all are available on all supported platforms. Some of these are de facto standards among projects using CMake and so have no `GLFW_` prefix. If you are using the GUI version of CMake, these are listed and can be changed from there. If you are using the command-line version of CMake you can use the `ccmake` ncurses GUI to set options. Some package systems like Ubuntu and other distributions based on Debian GNU/Linux have this tool in a separate `cmake-curses-gui` package. Finally, if you don't want to use any GUI, you can set options from the `cmake` command-line with the `-D` flag. @code{.sh} cmake -DBUILD_SHARED_LIBS=ON . @endcode @subsubsection compile_options_shared Shared CMake options @anchor BUILD_SHARED_LIBS __BUILD_SHARED_LIBS__ determines whether GLFW is built as a static library or as a DLL / shared library / dynamic library. @anchor GLFW_BUILD_EXAMPLES __GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built along with the library. @anchor GLFW_BUILD_TESTS __GLFW_BUILD_TESTS__ determines whether the GLFW test programs are built along with the library. @anchor GLFW_BUILD_DOCS __GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along with the library. @anchor GLFW_VULKAN_STATIC __GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked directly with the application. @subsubsection compile_options_win32 Windows specific CMake options @anchor USE_MSVC_RUNTIME_LIBRARY_DLL __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the static library version of the Visual C++ runtime library. If set to `ON`, the DLL version of the Visual C++ library is used. @anchor GLFW_USE_HYBRID_HPG __GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and `AmdPowerXpressRequestHighPerformance` symbols, which force the use of the high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols need to be exported by the EXE to be detected by the driver, so the override will not work if GLFW is built as a DLL. @section compile_manual Compiling GLFW manually If you wish to compile GLFW without its CMake build environment then you will have to do at least some of the platform detection yourself. GLFW needs a configuration macro to be defined in order to know what window system it's being compiled for and also has optional, platform-specific ones for various features. When building with CMake, the `glfw_config.h` configuration header is generated based on the current platform and CMake options. The GLFW CMake environment defines @b GLFW_USE_CONFIG_H, which causes this header to be included by `internal.h`. Without this macro, GLFW will expect the necessary configuration macros to be defined on the command-line. The window creation API is used to create windows, handle input, monitors, gamma ramps and clipboard. The options are: - @b _GLFW_COCOA to use the Cocoa frameworks - @b _GLFW_WIN32 to use the Win32 API - @b _GLFW_X11 to use the X Window System - @b _GLFW_WAYLAND to use the Wayland API (experimental and incomplete) - @b _GLFW_OSMESA to use the OSMesa API (headless and non-interactive) If you are building GLFW as a shared library / dynamic library / DLL then you must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it. If you are linking the Vulkan loader directly with your application then you must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the external version. If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1 or GLESv2 library, you can override the default names by defining those you need of @b _GLFW_VULKAN_LIBRARY, @b _GLFW_EGL_LIBRARY, @b _GLFW_GLX_LIBRARY, @b _GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b _GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names. For the EGL context creation API, the following options are available: - @b _GLFW_USE_EGLPLATFORM_H to use an existing `EGL/eglplatform.h` header file for native handle types (fallback) @note None of the @ref build_macros may be defined during the compilation of GLFW. If you define any of these in your build files, make sure they are not applied to the GLFW sources. */ ================================================ FILE: thirdparty/glfw/docs/context.dox ================================================ /*! @page context_guide Context guide @tableofcontents This guide introduces the OpenGL and OpenGL ES context related functions of GLFW. For details on a specific function in this category, see the @ref context. There are also guides for the other areas of the GLFW API. - @ref intro_guide - @ref window_guide - @ref vulkan_guide - @ref monitor_guide - @ref input_guide @section context_object Context objects A window object encapsulates both a top-level window and an OpenGL or OpenGL ES context. It is created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow or @ref glfwTerminate. See @ref window_creation for more information. As the window and context are inseparably linked, the window object also serves as the context handle. To test the creation of various kinds of contexts and see their properties, run the `glfwinfo` test program. @note Vulkan does not have a context and the Vulkan instance is created via the Vulkan API itself. If you will be using Vulkan to render to a window, disable context creation by setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. For more information, see the @ref vulkan_guide. @subsection context_hints Context creation hints There are a number of hints, specified using @ref glfwWindowHint, related to what kind of context is created. See [context related hints](@ref window_hints_ctx) in the window guide. @subsection context_sharing Context object sharing When creating a window and its OpenGL or OpenGL ES context with @ref glfwCreateWindow, you can specify another window whose context the new one should share its objects (textures, vertex and element buffers, etc.) with. @code GLFWwindow* second_window = glfwCreateWindow(640, 480, "Second Window", NULL, first_window); @endcode Object sharing is implemented by the operating system and graphics driver. On platforms where it is possible to choose which types of objects are shared, GLFW requests that all types are shared. See the relevant chapter of the [OpenGL](https://www.opengl.org/registry/) or [OpenGL ES](https://www.khronos.org/opengles/) reference documents for more information. The name and number of this chapter unfortunately varies between versions and APIs, but has at times been named _Shared Objects and Multiple Contexts_. GLFW comes with a barebones object sharing example program called `sharing`. @subsection context_offscreen Offscreen contexts GLFW doesn't support creating contexts without an associated window. However, contexts with hidden windows can be created with the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint. @code glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL); @endcode The window never needs to be shown and its context can be used as a plain offscreen context. Depending on the window manager, the size of a hidden window's framebuffer may not be usable or modifiable, so framebuffer objects are recommended for rendering with such contexts. You should still [process events](@ref events) as long as you have at least one window, even if none of them are visible. @macos The first time a window is created the menu bar is created. This is not desirable for example when writing a command-line only application. Menu bar creation can be disabled with the @ref GLFW_COCOA_MENUBAR init hint. @subsection context_less Windows without contexts You can disable context creation by setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. Windows without contexts must not be passed to @ref glfwMakeContextCurrent or @ref glfwSwapBuffers. @section context_current Current context Before you can make OpenGL or OpenGL ES calls, you need to have a current context of the correct type. A context can only be current for a single thread at a time, and a thread can only have a single context current at a time. When moving a context between threads, you must make it non-current on the old thread before making it current on the new one. The context of a window is made current with @ref glfwMakeContextCurrent. @code glfwMakeContextCurrent(window); @endcode The window of the current context is returned by @ref glfwGetCurrentContext. @code GLFWwindow* window = glfwGetCurrentContext(); @endcode The following GLFW functions require a context to be current. Calling any these functions without a current context will generate a @ref GLFW_NO_CURRENT_CONTEXT error. - @ref glfwSwapInterval - @ref glfwExtensionSupported - @ref glfwGetProcAddress @section context_swap Buffer swapping See @ref buffer_swap in the window guide. @section context_glext OpenGL and OpenGL ES extensions One of the benefits of OpenGL and OpenGL ES is their extensibility. Hardware vendors may include extensions in their implementations that extend the API before that functionality is included in a new version of the OpenGL or OpenGL ES specification, and some extensions are never included and remain as extensions until they become obsolete. An extension is defined by: - An extension name (e.g. `GL_ARB_debug_output`) - New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`) - New OpenGL functions (e.g. `glGetDebugMessageLogARB`) Note the `ARB` affix, which stands for Architecture Review Board and is used for official extensions. The extension above was created by the ARB, but there are many different affixes, like `NV` for Nvidia and `AMD` for, well, AMD. Any group may also use the generic `EXT` affix. Lists of extensions, together with their specifications, can be found at the [OpenGL Registry](https://www.opengl.org/registry/) and [OpenGL ES Registry](https://www.khronos.org/registry/gles/). @subsection context_glext_auto Loading extension with a loader library An extension loader library is the easiest and best way to access both OpenGL and OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs. They will take care of all the details of declaring and loading everything you need. One such library is [glad](https://github.com/Dav1dde/glad) and there are several others. The following example will use glad but all extension loader libraries work similarly. First you need to generate the source files using the glad Python script. This example generates a loader for any version of OpenGL, which is the default for both GLFW and glad, but loaders for OpenGL ES, as well as loaders for specific API versions and extension sets can be generated. The generated files are written to the `output` directory. @code{.sh} python main.py --generator c --no-loader --out-path output @endcode The `--no-loader` option is added because GLFW already provides a function for loading OpenGL and OpenGL ES function pointers, one that automatically uses the selected context creation API, and glad can call this instead of having to implement its own. There are several other command-line options as well. See the glad documentation for details. Add the generated `output/src/glad.c`, `output/include/glad/glad.h` and `output/include/KHR/khrplatform.h` files to your build. Then you need to include the glad header file, which will replace the OpenGL header of your development environment. By including the glad header before the GLFW header, it suppresses the development environment's OpenGL or OpenGL ES header. @code #include #include @endcode Finally you need to initialize glad once you have a suitable current context. @code window = glfwCreateWindow(640, 480, "My Window", NULL, NULL); if (!window) { ... } glfwMakeContextCurrent(window); gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); @endcode Once glad has been loaded, you have access to all OpenGL core and extension functions supported by both the context you created and the glad loader you generated and you are ready to start rendering. You can specify a minimum required OpenGL or OpenGL ES version with [context hints](@ref window_hints_ctx). If your needs are more complex, you can check the actual OpenGL or OpenGL ES version with [context attributes](@ref window_attribs_ctx), or you can check whether a specific version is supported by the current context with the `GLAD_GL_VERSION_x_x` booleans. @code if (GLAD_GL_VERSION_3_2) { // Call OpenGL 3.2+ specific code } @endcode To check whether a specific extension is supported, use the `GLAD_GL_xxx` booleans. @code if (GLAD_GL_ARB_debug_output) { // Use GL_ARB_debug_output } @endcode @subsection context_glext_manual Loading extensions manually __Do not use this technique__ unless it is absolutely necessary. An [extension loader library](@ref context_glext_auto) will save you a ton of tedious, repetitive, error prone work. To use a certain extension, you must first check whether the context supports that extension and then, if it introduces new functions, retrieve the pointers to those functions. GLFW provides @ref glfwExtensionSupported and @ref glfwGetProcAddress for manual loading of extensions and new API functions. This section will demonstrate manual loading of OpenGL extensions. The loading of OpenGL ES extensions is identical except for the name of the extension header. @subsubsection context_glext_header The glext.h header The `glext.h` extension header is a continually updated file that defines the interfaces for all OpenGL extensions. The latest version of this can always be found at the [OpenGL Registry](https://www.opengl.org/registry/). There are also extension headers for the various versions of OpenGL ES at the [OpenGL ES Registry](https://www.khronos.org/registry/gles/). It it strongly recommended that you use your own copy of the extension header, as the one included in your development environment may be several years out of date and may not include the extensions you wish to use. The header defines function pointer types for all functions of all extensions it supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for `glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer to function) and `PROC` (procedure) are added to the ends. To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including the GLFW header. @code #define GLFW_INCLUDE_GLEXT #include @endcode @subsubsection context_glext_string Checking for extensions A given machine may not actually support the extension (it may have older drivers or a graphics card that lacks the necessary hardware features), so it is necessary to check at run-time whether the context supports the extension. This is done with @ref glfwExtensionSupported. @code if (glfwExtensionSupported("GL_ARB_debug_output")) { // The extension is supported by the current context } @endcode The argument is a null terminated ASCII string with the extension name. If the extension is supported, @ref glfwExtensionSupported returns `GLFW_TRUE`, otherwise it returns `GLFW_FALSE`. @subsubsection context_glext_proc Fetching function pointers Many extensions, though not all, require the use of new OpenGL functions. These functions often do not have entry points in the client API libraries of your operating system, making it necessary to fetch them at run time. You can retrieve pointers to these functions with @ref glfwGetProcAddress. @code PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB"); @endcode In general, you should avoid giving the function pointer variables the (exact) same name as the function, as this may confuse your linker. Instead, you can use a different prefix, like above, or some other naming scheme. Now that all the pieces have been introduced, here is what they might look like when used together. @code #define GLFW_INCLUDE_GLEXT #include #define glGetDebugMessageLogARB pfnGetDebugMessageLog PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog; // Flag indicating whether the extension is supported int has_ARB_debug_output = 0; void load_extensions(void) { if (glfwExtensionSupported("GL_ARB_debug_output")) { pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC) glfwGetProcAddress("glGetDebugMessageLogARB"); has_ARB_debug_output = 1; } } void some_function(void) { if (has_ARB_debug_output) { // Now the extension function can be called as usual glGetDebugMessageLogARB(...); } } @endcode */ ================================================ FILE: thirdparty/glfw/docs/extra.css ================================================ .sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:0.5em;font-size:180%}h2{padding-top:0.5em;margin-bottom:0;font-size:140%}h3{padding-top:0.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;height:64px;max-width:920px;min-width:800px;padding:0 32px;margin:0 auto}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;min-width:800px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;min-width:800px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{height:36px;display:block;position:relative}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,table.markdownTable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable,table.markdownTable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe599}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e5c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e599bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce5}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px} ================================================ FILE: thirdparty/glfw/docs/extra.less ================================================ // NOTE: Please use this file to perform modifications on default style sheets. // // You need to install a few Ruby gems to generate extra.css from this file: // gem install less therubyracer // // Run this command to regenerate extra.css after you're finished with changes: // lessc --compress extra.less > extra.css // // Alternatively you can use online services to regenerate extra.css. // Default text color for page contents @default-text-color: hsl(0,0%,30%); // Page header, footer, table rows, inline codes and definition lists @header-footer-background-color: hsl(0,0%,95%); // Page header, footer links and navigation bar background @header-footer-link-color: hsl(0,0%,40%); // Doxygen navigation bar links @navbar-link-color: @header-footer-background-color; // Page content background color @content-background-color: hsl(0,0%,100%); // Bold, italic, h1, h2, ... and table of contents @heading-color: hsl(0,0%,10%); // Function, enum and macro definition separator @def-separator-color: @header-footer-background-color; // Base color hue @base-hue: 24; // Default color used for links @default-link-color: hsl(@base-hue,100%,50%); // Doxygen navigation bar active tab @tab-text-color: hsl(0,0%,100%); @tab-background-color1: @default-link-color; @tab-background-color2: lighten(spin(@tab-background-color1, 10), 10%); // Table borders @default-border-color: @default-link-color; // Table header @table-text-color: @tab-text-color; @table-background-color1: @tab-background-color1; @table-background-color2: @tab-background-color2; // Table of contents, data structure index and prototypes @toc-background-color1: hsl(0,0%,90%); @toc-background-color2: lighten(@toc-background-color1, 5%); // Function prototype parameters color @prototype-param-color: darken(@default-link-color, 25%); // Message box color: note, pre, post and invariant @box-note-color: hsl(103,80%,85%); // Message box color: warning and attention @box-warning-color: hsl(34,80%,85%); // Message box color: deprecated and bug @box-bug-color: hsl(333,80%,85%); // Message box color: todo and test @box-todo-color: hsl(200,80%,85%); // Message box helper function .message-box(@base-color) { background:linear-gradient(to bottom,lighten(@base-color, 5%) 0%,@base-color 100%); box-shadow:inset 0 0 32px darken(@base-color, 5%); color:darken(@base-color, 67%); border:2px solid desaturate(darken(@base-color, 10%), 20%); } .sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover { background:none; text-shadow:none; } .sm-dox a span.sub-arrow { border-color:@navbar-link-color transparent transparent transparent; } .sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow { border-color:@default-link-color transparent transparent transparent; } .sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow { border-color:transparent transparent transparent @default-link-color; } .sm-dox ul a:hover { background:@header-footer-link-color; text-shadow:none; } .sm-dox ul.sm-nowrap a { color:@default-text-color; text-shadow:none; } #main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code { background:none; } #titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator { border:none; } #main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span { text-shadow:none; } .memdoc,dl.reflist dd { box-shadow:none; } div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code { padding:0; } #nav-path,.directory .levels,span.lineno { display:none; } html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven { background:@header-footer-background-color; } body { color:@default-text-color; } h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em { color:@heading-color; border-bottom:none; } h1 { padding-top:0.5em; font-size:180%; } h2 { padding-top:0.5em; margin-bottom:0; font-size:140%; } h3 { padding-top:0.5em; margin-bottom:0; font-size:110%; } .glfwheader { font-size:16px; height:64px; max-width:920px; min-width:800px; padding:0 32px; margin:0 auto; } #glfwhome { line-height:64px; padding-right:48px; color:@header-footer-link-color; font-size:2.5em; background:url("https://www.glfw.org/css/arrow.png") no-repeat right; } .glfwnavbar { list-style-type:none; margin:0 auto; float:right; } #glfwhome,.glfwnavbar li { float:left; } .glfwnavbar a,.glfwnavbar a:visited { line-height:64px; margin-left:2em; display:block; color:@header-footer-link-color; } #glfwhome,.glfwnavbar a,.glfwnavbar a:visited { transition:.35s ease; } #titlearea,.footer { color:@header-footer-link-color; } address.footer { text-align:center; padding:2em; margin-top:3em; } #top { background:@header-footer-link-color; } #main-nav { max-width:960px; min-width:800px; margin:0 auto; font-size:13px; } #main-menu { max-width:920px; min-width:800px; margin:0 auto; font-size:13px; } .memtitle { display:none; } .memproto,.memname { font-weight:bold; text-shadow:none; } #main-menu { height:36px; display:block; position:relative; } #main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li { color:@navbar-link-color; } #main-menu li ul.sm-nowrap li a { color:@default-text-color; } #main-menu li ul.sm-nowrap li a:hover { color:@default-link-color; } .contents { min-height:590px; } div.contents,div.header { max-width:920px; margin:0 auto; padding:0 32px; background:@content-background-color none; } table.doxtable th,table.markdownTable th,dl.reflist dt { background:linear-gradient(to bottom,@table-background-color2 0%,@table-background-color1 100%); box-shadow:inset 0 0 32px @table-background-color1; text-shadow:0 -1px 1px darken(@table-background-color1, 15%); text-align:left; color:@table-text-color; } dl.reflist dt a.el { color:@default-link-color; padding:.2em; border-radius:4px; background-color:lighten(@default-link-color, 40%); } div.toc { float:none; width:auto; } div.toc h3 { font-size:1.17em; } div.toc ul { padding-left:1.5em; } div.toc li { font-size:1em; padding-left:0; list-style-type:disc; } div.toc,.memproto,div.qindex,div.ah { background:linear-gradient(to bottom,@toc-background-color2 0%,@toc-background-color1 100%); box-shadow:inset 0 0 32px @toc-background-color1; text-shadow:0 1px 1px lighten(@toc-background-color2, 10%); color:@heading-color; border:2px solid @toc-background-color1; border-radius:4px; } .paramname { color:@prototype-param-color; } dl.reflist dt { border:2px solid @default-border-color; border-top-left-radius:4px; border-top-right-radius:4px; border-bottom:none; } dl.reflist dd { border:2px solid @default-border-color; border-bottom-right-radius:4px; border-bottom-left-radius:4px; border-top:none; } table.doxtable,table.markdownTable { border-collapse:inherit; border-spacing:0; border:2px solid @default-border-color; border-radius:4px; } a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover { color:@default-link-color; text-decoration:none; } div.directory { border-collapse:inherit; border-spacing:0; border:2px solid @default-border-color; border-radius:4px; } hr,.memSeparator { height:2px; background:linear-gradient(to right,@def-separator-color 0%,darken(@def-separator-color, 10%) 50%,@def-separator-color 100%); } dl.note,dl.pre,dl.post,dl.invariant { .message-box(@box-note-color); } dl.warning,dl.attention { .message-box(@box-warning-color); } dl.deprecated,dl.bug { .message-box(@box-bug-color); } dl.todo,dl.test { .message-box(@box-todo-color); } dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test { border-radius:4px; padding:1em; text-shadow:0 1px 1px hsl(0,0%,100%); margin:1em 0; } .note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited { color:inherit; } div.line { line-height:inherit; } div.fragment,pre.fragment { background:hsl(0,0%,95%); border-radius:4px; border:none; padding:1em; overflow:auto; border-left:4px solid hsl(0,0%,80%); margin:1em 0; } .lineno a,.lineno a:visited,.line,pre.fragment { color:@default-text-color; } span.preprocessor,span.comment { color:hsl(193,100%,30%); } a.code,a.code:visited { color:hsl(18,100%,45%); } span.keyword,span.keywordtype,span.keywordflow { color:darken(@default-text-color, 5%); font-weight:bold; } span.stringliteral { color:hsl(261,100%,30%); } code { padding:.1em; border-radius:4px; } ================================================ FILE: thirdparty/glfw/docs/footer.html ================================================ ================================================ FILE: thirdparty/glfw/docs/header.html ================================================ $projectname: $title $title $treeview $search $mathjax $extrastylesheet
================================================ FILE: thirdparty/glfw/docs/html/bug.html ================================================ GLFW: Bug List
Bug List
Page Window guide
On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
================================================ FILE: thirdparty/glfw/docs/html/build_8dox.html ================================================ GLFW: build.dox File Reference
build.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/build_guide.html ================================================ GLFW: Building applications
Building applications

This is about compiling and linking applications that use GLFW. For information on how to write such applications, start with the introductory tutorial. For information on how to compile the GLFW library itself, see Compiling GLFW.

This is not a tutorial on compilation or linking. It assumes basic understanding of how to compile and link a C program as well as how to use the specific compiler of your chosen development environment. The compilation and linking process should be explained in your C programming material and in the documentation for your development environment.

Including the GLFW header file

You should include the GLFW header in the source files where you use OpenGL or GLFW.

#include <GLFW/glfw3.h>

This header declares the GLFW API and by default also includes the OpenGL header from your development environment. See below for how to control this.

The GLFW header also defines any platform-specific macros needed by your OpenGL header, so it can be included without needing any window system headers.

For example, under Windows you are normally required to include windows.h before the OpenGL header, which would bring in the whole Win32 API. The GLFW header duplicates the small number of macros needed.

It does this only when needed, so if windows.h is included, the GLFW header does not try to redefine those symbols. The reverse is not true, i.e. windows.h cannot cope if any of its symbols have already been defined.

In other words:

  • Do not include the OpenGL headers yourself, as GLFW does this for you
  • Do not include windows.h or other platform-specific headers unless you plan on using those APIs directly
  • If you do need to include such headers, do it before including the GLFW header and it will handle this

If you are using an OpenGL extension loading library such as glad, the extension loader header should be included before the GLFW one.

#include <glad/gl.h>
#include <GLFW/glfw3.h>

Alternatively the GLFW_INCLUDE_NONE macro (described below) can be used to prevent the GLFW header from including the OpenGL header.

#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <glad/gl.h>

GLFW header option macros

These macros may be defined before the inclusion of the GLFW header and affect its behavior.

GLFW_DLL is required on Windows when using the GLFW DLL, to tell the compiler that the GLFW functions are defined in a DLL.

The following macros control which OpenGL or OpenGL ES API header is included. Only one of these may be defined at a time.

Note
GLFW does not provide any of the API headers mentioned below. They are provided by your development environment or your OpenGL, OpenGL ES or Vulkan SDK, and most of them can be downloaded from the Khronos Registry.

GLFW_INCLUDE_GLCOREARB makes the GLFW header include the modern GL/glcorearb.h header (OpenGL/gl3.h on macOS) instead of the regular OpenGL header.

GLFW_INCLUDE_ES1 makes the GLFW header include the OpenGL ES 1.x GLES/gl.h header instead of the regular OpenGL header.

GLFW_INCLUDE_ES2 makes the GLFW header include the OpenGL ES 2.0 GLES2/gl2.h header instead of the regular OpenGL header.

GLFW_INCLUDE_ES3 makes the GLFW header include the OpenGL ES 3.0 GLES3/gl3.h header instead of the regular OpenGL header.

GLFW_INCLUDE_ES31 makes the GLFW header include the OpenGL ES 3.1 GLES3/gl31.h header instead of the regular OpenGL header.

GLFW_INCLUDE_ES31 makes the GLFW header include the OpenGL ES 3.2 GLES3/gl32.h header instead of the regular OpenGL header.

GLFW_INCLUDE_NONE makes the GLFW header not include any OpenGL or OpenGL ES API header. This is useful in combination with an extension loading library.

If none of the above inclusion macros are defined, the standard OpenGL GL/gl.h header (OpenGL/gl.h on macOS) is included.

The following macros control the inclusion of additional API headers. Any number of these may be defined simultaneously, and/or together with one of the above macros.

GLFW_INCLUDE_VULKAN makes the GLFW header include the Vulkan vulkan/vulkan.h header in addition to any selected OpenGL or OpenGL ES header.

GLFW_INCLUDE_GLEXT makes the GLFW header include the appropriate extension header for the OpenGL or OpenGL ES header selected above after and in addition to that header.

GLFW_INCLUDE_GLU makes the header include the GLU header in addition to the header selected above. This should only be used with the standard OpenGL header and only for compatibility with legacy code. GLU has been deprecated and should not be used in new code.

Note
None of these macros may be defined during the compilation of GLFW itself. If your build includes GLFW and you define any these in your build files, make sure they are not applied to the GLFW sources.

Link with the right libraries

GLFW is essentially a wrapper of various platform-specific APIs and therefore needs to link against many different system libraries. If you are using GLFW as a shared library / dynamic library / DLL then it takes care of these links. However, if you are using GLFW as a static library then your executable will need to link against these libraries.

On Windows and macOS, the list of system libraries is static and can be hard-coded into your build environment. See the section for your development environment below. On Linux and other Unix-like operating systems, the list varies but can be retrieved in various ways as described below.

A good general introduction to linking is Beginner's Guide to Linkers by David Drysdale.

With MinGW or Visual C++ on Windows

The static version of the GLFW library is named glfw3. When using this version, it is also necessary to link with some libraries that GLFW uses.

When using MinGW to link an application with the static version of GLFW, you must also explicitly link with gdi32. Other toolchains including MinGW-w64 include it in the set of default libraries along with other dependencies like user32 and kernel32.

The link library for the GLFW DLL is named glfw3dll. When compiling an application that uses the DLL version of GLFW, you need to define the GLFW_DLL macro before any inclusion of the GLFW header. This can be done either with a compiler switch or by defining it in your source code.

With CMake and GLFW source

This section is about using CMake to compile and link GLFW along with your application. If you want to use an installed binary instead, see With CMake and installed GLFW binaries.

With a few changes to your CMakeLists.txt you can have the GLFW source tree built along with your application.

When including GLFW as part of your build, you probably don't want to build the GLFW tests, examples and documentation. To disable these, set the corresponding cache variables before adding the GLFW source tree.

set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

Add the root directory of the GLFW source tree to your project. This will add the glfw target to your project.

add_subdirectory(path/to/glfw)

Once GLFW has been added, link your application against the glfw target. This adds the GLFW library and its link-time dependencies as it is currently configured, the include directory for the GLFW header and, when applicable, the GLFW_DLL macro.

target_link_libraries(myapp glfw)

Note that the glfw target does not depend on OpenGL, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime. If your application calls OpenGL directly, instead of using a modern extension loader library, use the OpenGL CMake package.

find_package(OpenGL REQUIRED)

If OpenGL is found, the OpenGL::GL target is added to your project, containing library and include directory paths. Link against this like above.

target_link_libraries(myapp OpenGL::GL)

With CMake and installed GLFW binaries

This section is about using CMake to link GLFW after it has been built and installed. If you want to build it along with your application instead, see With CMake and GLFW source.

With a few changes to your CMakeLists.txt you can locate the package and target files generated when GLFW is installed.

find_package(glfw3 3.3 REQUIRED)

Once GLFW has been added to the project, link against it with the glfw target. This adds the GLFW library and its link-time dependencies, the include directory for the GLFW header and, when applicable, the GLFW_DLL macro.

target_link_libraries(myapp glfw)

Note that the glfw target does not depend on OpenGL, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime. If your application calls OpenGL directly, instead of using a modern extension loader library, use the OpenGL CMake package.

find_package(OpenGL REQUIRED)

If OpenGL is found, the OpenGL::GL target is added to your project, containing library and include directory paths. Link against this like above.

target_link_libraries(myapp OpenGL::GL)

With makefiles and pkg-config on Unix

GLFW supports pkg-config, and the glfw3.pc pkg-config file is generated when the GLFW library is built and is installed along with it. A pkg-config file describes all necessary compile-time and link-time flags and dependencies needed to use a library. When they are updated or if they differ between systems, you will get the correct ones automatically.

A typical compile and link command-line when using the static version of the GLFW library may look like this:

cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --static --libs glfw3)

If you are using the shared version of the GLFW library, omit the --static flag.

cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3)

You can also use the glfw3.pc file without installing it first, by using the PKG_CONFIG_PATH environment variable.

env PKG_CONFIG_PATH=path/to/glfw/src cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3)

The dependencies do not include OpenGL, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime. If your application calls OpenGL directly, instead of using a modern extension loader library, you should add the gl pkg-config package.

cc $(pkg-config --cflags glfw3 gl) -o myprog myprog.c $(pkg-config --libs glfw3 gl)

With Xcode on macOS

If you are using the dynamic library version of GLFW, add it to the project dependencies.

If you are using the static library version of GLFW, add it and the Cocoa, OpenGL and IOKit frameworks to the project as dependencies. They can all be found in /System/Library/Frameworks.

With command-line on macOS

It is recommended that you use pkg-config when building from the command line on macOS. That way you will get any new dependencies added automatically. If you still wish to build manually, you need to add the required frameworks and libraries to your command-line yourself using the -l and -framework switches.

If you are using the dynamic GLFW library, which is named libglfw.3.dylib, do:

cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit

If you are using the static library, named libglfw3.a, substitute -lglfw3 for -lglfw.

Note that you do not add the .framework extension to a framework when linking against it from the command-line.

Note
Your machine may have libGL.*.dylib style OpenGL library, but that is for the X Window System and will not work with the macOS native version of GLFW.
The header of the GLFW 3 API.
================================================ FILE: thirdparty/glfw/docs/html/compat_8dox.html ================================================ GLFW: compat.dox File Reference
compat.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/compat_guide.html ================================================ GLFW: Standards conformance
Standards conformance

This guide describes the various API extensions used by this version of GLFW. It lists what are essentially implementation details, but which are nonetheless vital knowledge for developers intending to deploy their applications on a wide range of machines.

The information in this guide is not a part of GLFW API, but merely preconditions for some parts of the library to function on a given machine. Any part of this information may change in future versions of GLFW and that will not be considered a breaking API change.

X11 extensions, protocols and IPC standards

As GLFW uses Xlib directly, without any intervening toolkit library, it has sole responsibility for interacting well with the many and varied window managers in use on Unix-like systems. In order for applications and window managers to work well together, a number of standards and conventions have been developed that regulate behavior outside the scope of the X11 API; most importantly the Inter-Client Communication Conventions Manual (ICCCM) and Extended Window Manager Hints (EWMH) standards.

GLFW uses the _MOTIF_WM_HINTS window property to support borderless windows. If the running window manager does not support this property, the GLFW_DECORATED hint will have no effect.

GLFW uses the ICCCM WM_DELETE_WINDOW protocol to intercept the user attempting to close the GLFW window. If the running window manager does not support this protocol, the close callback will never be called.

GLFW uses the EWMH _NET_WM_PING protocol, allowing the window manager notify the user when the application has stopped responding, i.e. when it has ceased to process events. If the running window manager does not support this protocol, the user will not be notified if the application locks up.

GLFW uses the EWMH _NET_WM_STATE_FULLSCREEN window state to tell the window manager to make the GLFW window full screen. If the running window manager does not support this state, full screen windows may not work properly. GLFW has a fallback code path in case this state is unavailable, but every window manager behaves slightly differently in this regard.

GLFW uses the EWMH _NET_WM_BYPASS_COMPOSITOR window property to tell a compositing window manager to un-redirect full screen GLFW windows. If the running window manager uses compositing but does not support this property then additional copying may be performed for each buffer swap of full screen windows.

GLFW uses the clipboard manager protocol to push a clipboard string (i.e. selection) owned by a GLFW window about to be destroyed to the clipboard manager. If there is no running clipboard manager, the clipboard string will be unavailable once the window has been destroyed.

GLFW uses the X drag-and-drop protocol to provide file drop events. If the application originating the drag does not support this protocol, drag and drop will not work.

GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the running X server does not support this version of this extension, multi-monitor support will not function and only a single, desktop-spanning monitor will be reported.

GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp support. If the running X server does not support either or both of these extensions, gamma ramp support will not function.

GLFW uses the Xkb extension and detectable auto-repeat to provide keyboard input. If the running X server does not support this extension, a non-Xkb fallback path is used.

GLFW uses the XInput2 extension to provide raw, non-accelerated mouse motion when the cursor is disabled. If the running X server does not support this extension, regular accelerated mouse motion will be used.

GLFW uses both the XRender extension and the compositing manager to support transparent window framebuffers. If the running X server does not support this extension or there is no running compositing manager, the GLFW_TRANSPARENT_FRAMEBUFFER framebuffer hint will have no effect.

Wayland protocols and IPC standards

As GLFW uses libwayland directly, without any intervening toolkit library, it has sole responsibility for interacting well with every compositor in use on Unix-like systems. Most of the features are provided by the core protocol, while cursor support is provided by the libwayland-cursor helper library, EGL integration by libwayland-egl, and keyboard handling by libxkbcommon. In addition, GLFW uses some protocols from wayland-protocols to provide additional features if the compositor supports them.

GLFW uses xkbcommon 0.5.0 to provide compose key support. When it has been built against an older xkbcommon, the compose key will be disabled even if it has been configured in the compositor.

GLFW uses the xdg-shell protocol to provide better window management. This protocol is part of wayland-protocols 1.12, and mandatory at build time. If the running compositor does not support this protocol, the older wl_shell interface will be used instead. This will result in a worse integration with the desktop, especially on tiling compositors.

GLFW uses the relative pointer protocol alongside the pointer constraints protocol to implement disabled cursor. These two protocols are part of wayland-protocols 1.1, and mandatory at build time. If the running compositor does not support both of these protocols, disabling the cursor will have no effect.

GLFW uses the idle inhibit protocol to prohibit the screensaver from starting. This protocol is part of wayland-protocols 1.6, and mandatory at build time. If the running compositor does not support this protocol, the screensaver may start even for full screen windows.

GLFW uses the xdg-decoration protocol to request decorations to be drawn around its windows. This protocol is part of wayland-protocols 1.15, and mandatory at build time. If the running compositor does not support this protocol, a very simple frame will be drawn by GLFW itself, using the viewporter protocol alongside subsurfaces. This protocol is part of wayland-protocols 1.4, and mandatory at build time. If the running compositor does not support this protocol either, no decorations will be drawn around windows.

GLX extensions

The GLX API is the default API used to create OpenGL contexts on Unix-like systems using the X Window System.

GLFW uses the GLX 1.3 GLXFBConfig functions to enumerate and select framebuffer pixel formats. If GLX 1.3 is not supported, glfwInit will fail.

GLFW uses the GLX_MESA_swap_control, GLX_EXT_swap_control and GLX_SGI_swap_control extensions to provide vertical retrace synchronization (or vsync), in that order of preference. Where none of these extension are available, calling glfwSwapInterval will have no effect.

GLFW uses the GLX_ARB_multisample extension to create contexts with multisampling anti-aliasing. Where this extension is unavailable, the GLFW_SAMPLES hint will have no effect.

GLFW uses the GLX_ARB_create_context extension when available, even when creating OpenGL contexts of version 2.1 and below. Where this extension is unavailable, the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints will only be partially supported, the GLFW_OPENGL_DEBUG_CONTEXT hint will have no effect, and setting the GLFW_OPENGL_PROFILE or GLFW_OPENGL_FORWARD_COMPAT hints to GLFW_TRUE will cause glfwCreateWindow to fail.

GLFW uses the GLX_ARB_create_context_profile extension to provide support for context profiles. Where this extension is unavailable, setting the GLFW_OPENGL_PROFILE hint to anything but GLFW_OPENGL_ANY_PROFILE, or setting GLFW_CLIENT_API to anything but GLFW_OPENGL_API or GLFW_NO_API will cause glfwCreateWindow to fail.

GLFW uses the GLX_ARB_context_flush_control extension to provide control over whether a context is flushed when it is released (made non-current). Where this extension is unavailable, the GLFW_CONTEXT_RELEASE_BEHAVIOR hint will have no effect and the context will always be flushed when released.

GLFW uses the GLX_ARB_framebuffer_sRGB and GLX_EXT_framebuffer_sRGB extensions to provide support for sRGB framebuffers. Where both of these extensions are unavailable, the GLFW_SRGB_CAPABLE hint will have no effect.

WGL extensions

The WGL API is used to create OpenGL contexts on Microsoft Windows and other implementations of the Win32 API, such as Wine.

GLFW uses either the WGL_EXT_extension_string or the WGL_ARB_extension_string extension to check for the presence of all other WGL extensions listed below. If both are available, the EXT one is preferred. If neither is available, no other extensions are used and many GLFW features related to context creation will have no effect or cause errors when used.

GLFW uses the WGL_EXT_swap_control extension to provide vertical retrace synchronization (or vsync). Where this extension is unavailable, calling glfwSwapInterval will have no effect.

GLFW uses the WGL_ARB_pixel_format and WGL_ARB_multisample extensions to create contexts with multisampling anti-aliasing. Where these extensions are unavailable, the GLFW_SAMPLES hint will have no effect.

GLFW uses the WGL_ARB_create_context extension when available, even when creating OpenGL contexts of version 2.1 and below. Where this extension is unavailable, the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints will only be partially supported, the GLFW_OPENGL_DEBUG_CONTEXT hint will have no effect, and setting the GLFW_OPENGL_PROFILE or GLFW_OPENGL_FORWARD_COMPAT hints to GLFW_TRUE will cause glfwCreateWindow to fail.

GLFW uses the WGL_ARB_create_context_profile extension to provide support for context profiles. Where this extension is unavailable, setting the GLFW_OPENGL_PROFILE hint to anything but GLFW_OPENGL_ANY_PROFILE will cause glfwCreateWindow to fail.

GLFW uses the WGL_ARB_context_flush_control extension to provide control over whether a context is flushed when it is released (made non-current). Where this extension is unavailable, the GLFW_CONTEXT_RELEASE_BEHAVIOR hint will have no effect and the context will always be flushed when released.

GLFW uses the WGL_ARB_framebuffer_sRGB and WGL_EXT_framebuffer_sRGB extensions to provide support for sRGB framebuffers. Where both of these extension are unavailable, the GLFW_SRGB_CAPABLE hint will have no effect.

OpenGL on macOS

Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then only forward-compatible, core profile contexts are supported. Support for OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible, core profile contexts. There is also still no mechanism for requesting debug contexts or no-error contexts. Versions of Mac OS X earlier than 10.7 support at most OpenGL version 2.1.

Because of this, on OS X 10.7 and later, the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints will cause glfwCreateWindow to fail if given version 3.0 or 3.1. The GLFW_OPENGL_FORWARD_COMPAT hint must be set to GLFW_TRUE and the GLFW_OPENGL_PROFILE hint must be set to GLFW_OPENGL_CORE_PROFILE when creating OpenGL 3.2 and later contexts. The GLFW_OPENGL_DEBUG_CONTEXT and GLFW_CONTEXT_NO_ERROR hints are ignored.

Also, on Mac OS X 10.6 and below, the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints will fail if given a version above 2.1, setting the GLFW_OPENGL_PROFILE or GLFW_OPENGL_FORWARD_COMPAT hints to a non-default value will cause glfwCreateWindow to fail and the GLFW_OPENGL_DEBUG_CONTEXT hint is ignored.

Vulkan loader and API

By default, GLFW uses the standard system-wide Vulkan loader to access the Vulkan API on all platforms except macOS. This is installed by both graphics drivers and Vulkan SDKs. If either the loader or at least one minimally functional ICD is missing, glfwVulkanSupported will return GLFW_FALSE and all other Vulkan-related functions will fail with an GLFW_API_UNAVAILABLE error.

Vulkan WSI extensions

The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on all supported platforms.

GLFW uses the VK_KHR_surface and VK_KHR_win32_surface extensions to create surfaces on Microsoft Windows. If any of these extensions are not available, glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail.

GLFW uses the VK_KHR_surface and either the VK_MVK_macos_surface or VK_EXT_metal_surface extensions to create surfaces on macOS. If any of these extensions are not available, glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail.

GLFW uses the VK_KHR_surface and either the VK_KHR_xlib_surface or VK_KHR_xcb_surface extensions to create surfaces on X11. If VK_KHR_surface or both VK_KHR_xlib_surface and VK_KHR_xcb_surface are not available, glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail.

GLFW uses the VK_KHR_surface and VK_KHR_wayland_surface extensions to create surfaces on Wayland. If any of these extensions are not available, glfwGetRequiredInstanceExtensions will return an empty list and window surface creation will fail.

================================================ FILE: thirdparty/glfw/docs/html/compile_8dox.html ================================================ GLFW: compile.dox File Reference
compile.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/compile_guide.html ================================================ GLFW: Compiling GLFW
Compiling GLFW

This is about compiling the GLFW library itself. For information on how to build applications that use GLFW, see Building applications.

Using CMake

GLFW uses CMake to generate project files or makefiles for a particular development environment. If you are on a Unix-like system such as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you can install its CMake package. If not, you can download installers for Windows and macOS from the CMake website.

Note
CMake only generates project files or makefiles. It does not compile the actual GLFW library. To compile GLFW, first generate these files for your chosen development environment and then use them to compile the actual GLFW library.

Dependencies

Once you have installed CMake, make sure that all other dependencies are available. On some platforms, GLFW needs a few additional packages to be installed. See the section for your chosen platform and development environment below.

Dependencies for Visual C++ on Windows

The Windows SDK bundled with Visual C++ already contains all the necessary headers, link libraries and tools except for CMake. Move on to Generating build files with CMake.

Dependencies for MinGW or MinGW-w64 on Windows

Both the MinGW and the MinGW-w64 packages already contain all the necessary headers, link libraries and tools except for CMake. Move on to Generating build files with CMake.

Dependencies for MinGW or MinGW-w64 cross-compilation

Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For example, Cygwin has the mingw64-i686-gcc and mingw64-x86_64-gcc packages for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives like Ubuntu have the mingw-w64 package for both.

GLFW has CMake toolchain files in the CMake/ directory that set up cross-compilation of Windows binaries. To use these files you add an option when running cmake to generate the project files or makefiles:

cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .

The exact toolchain file to use depends on the prefix used by the MinGW or MinGW-w64 binaries on your system. You can usually see this in the /usr directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages have /usr/x86_64-w64-mingw32 for the 64-bit compilers, so the correct invocation would be:

cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .

For more details see the article CMake Cross Compiling on the CMake wiki.

Once you have this set up, move on to Generating build files with CMake.

Dependencies for Xcode on macOS

Xcode comes with all necessary tools except for CMake. The required headers and libraries are included in the core macOS frameworks. Xcode can be downloaded from the Mac App Store or from the ADC Member Center.

Once you have Xcode installed, move on to Generating build files with CMake.

Dependencies for Linux and X11

To compile GLFW for X11, you need to have the X11 packages installed, as well as the basic development tools like GCC and make. For example, on Ubuntu and other distributions based on Debian GNU/Linux, you need to install the xorg-dev package, which pulls in all X.org header packages.

Once you have installed the necessary packages, move on to Generating build files with CMake.

Dependencies for Linux and Wayland

To compile GLFW for Wayland, you need to have the Wayland packages installed, as well as the basic development tools like GCC and make. For example, on Ubuntu and other distributions based on Debian GNU/Linux, you need to install the libwayland-dev package, which contains all Wayland headers and pulls in wayland-scanner, as well as the wayland-protocols and extra-cmake-modules packages.

Once you have installed the necessary packages, move on to Generating build files with CMake.

Dependencies for Linux and OSMesa

To compile GLFW for OSMesa, you need to install the OSMesa library and header packages. For example, on Ubuntu and other distributions based on Debian GNU/Linux, you need to install the libosmesa6-dev package. The OSMesa library is required at runtime for context creation and is loaded on demand.

Once you have installed the necessary packages, move on to Generating build files with CMake.

Generating build files with CMake

Once you have all necessary dependencies it is time to generate the project files or makefiles for your development environment. CMake needs to know two paths for this: the path to the root directory of the GLFW source tree (i.e. not the src subdirectory) and the target path for the generated files and compiled binaries. If these are the same, it is called an in-tree build, otherwise it is called an out-of-tree build.

One of several advantages of out-of-tree builds is that you can generate files and compile for different development environments using a single source tree.

Note
This section is about generating the project files or makefiles necessary to compile the GLFW library, not about compiling the actual library.

Generating files with the CMake command-line tool

To make an in-tree build, enter the root directory of the GLFW source tree (i.e. not the src subdirectory) and run CMake. The current directory is used as target path, while the path provided as an argument is used to find the source tree.

cd <glfw-root-dir>
cmake .

To make an out-of-tree build, make a directory outside of the source tree, enter it and run CMake with the (relative or absolute) path to the root of the source tree as an argument.

mkdir glfw-build
cd glfw-build
cmake <glfw-root-dir>

Once you have generated the project files or makefiles for your chosen development environment, move on to Compiling the library.

Generating files with the CMake GUI

If you are using the GUI version, choose the root of the GLFW source tree as source location and the same directory or another, empty directory as the destination for binaries. Choose Configure, change any options you wish to, Configure again to let the changes take effect and then Generate.

Once you have generated the project files or makefiles for your chosen development environment, move on to Compiling the library.

Compiling the library

You should now have all required dependencies and the project files or makefiles necessary to compile GLFW. Go ahead and compile the actual GLFW library with these files, as you would with any other project.

Once the GLFW library is compiled, you are ready to build your applications, linking it to the GLFW library. See Building applications for more information.

CMake options

The CMake files for GLFW provide a number of options, although not all are available on all supported platforms. Some of these are de facto standards among projects using CMake and so have no GLFW_ prefix.

If you are using the GUI version of CMake, these are listed and can be changed from there. If you are using the command-line version of CMake you can use the ccmake ncurses GUI to set options. Some package systems like Ubuntu and other distributions based on Debian GNU/Linux have this tool in a separate cmake-curses-gui package.

Finally, if you don't want to use any GUI, you can set options from the cmake command-line with the -D flag.

cmake -DBUILD_SHARED_LIBS=ON .

Shared CMake options

BUILD_SHARED_LIBS determines whether GLFW is built as a static library or as a DLL / shared library / dynamic library.

GLFW_BUILD_EXAMPLES determines whether the GLFW examples are built along with the library.

GLFW_BUILD_TESTS determines whether the GLFW test programs are built along with the library.

GLFW_BUILD_DOCS determines whether the GLFW documentation is built along with the library.

GLFW_VULKAN_STATIC determines whether to use the Vulkan loader linked directly with the application.

Windows specific CMake options

USE_MSVC_RUNTIME_LIBRARY_DLL determines whether to use the DLL version or the static library version of the Visual C++ runtime library. If set to ON, the DLL version of the Visual C++ library is used.

GLFW_USE_HYBRID_HPG determines whether to export the NvOptimusEnablement and AmdPowerXpressRequestHighPerformance symbols, which force the use of the high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols need to be exported by the EXE to be detected by the driver, so the override will not work if GLFW is built as a DLL.

Compiling GLFW manually

If you wish to compile GLFW without its CMake build environment then you will have to do at least some of the platform detection yourself. GLFW needs a configuration macro to be defined in order to know what window system it's being compiled for and also has optional, platform-specific ones for various features.

When building with CMake, the glfw_config.h configuration header is generated based on the current platform and CMake options. The GLFW CMake environment defines GLFW_USE_CONFIG_H, which causes this header to be included by internal.h. Without this macro, GLFW will expect the necessary configuration macros to be defined on the command-line.

The window creation API is used to create windows, handle input, monitors, gamma ramps and clipboard. The options are:

  • _GLFW_COCOA to use the Cocoa frameworks
  • _GLFW_WIN32 to use the Win32 API
  • _GLFW_X11 to use the X Window System
  • _GLFW_WAYLAND to use the Wayland API (experimental and incomplete)
  • _GLFW_OSMESA to use the OSMesa API (headless and non-interactive)

If you are building GLFW as a shared library / dynamic library / DLL then you must also define _GLFW_BUILD_DLL. Otherwise, you must not define it.

If you are linking the Vulkan loader directly with your application then you must also define _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the external version.

If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1 or GLESv2 library, you can override the default names by defining those you need of _GLFW_VULKAN_LIBRARY, _GLFW_EGL_LIBRARY, _GLFW_GLX_LIBRARY, _GLFW_OSMESA_LIBRARY, _GLFW_OPENGL_LIBRARY, _GLFW_GLESV1_LIBRARY and _GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names.

For the EGL context creation API, the following options are available:

  • _GLFW_USE_EGLPLATFORM_H to use an existing EGL/eglplatform.h header file for native handle types (fallback)
Note
None of the GLFW header option macros may be defined during the compilation of GLFW. If you define any of these in your build files, make sure they are not applied to the GLFW sources.
================================================ FILE: thirdparty/glfw/docs/html/context_8dox.html ================================================ GLFW: context.dox File Reference
context.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/context_guide.html ================================================ GLFW: Context guide
Context guide

This guide introduces the OpenGL and OpenGL ES context related functions of GLFW. For details on a specific function in this category, see the Context reference. There are also guides for the other areas of the GLFW API.

Context objects

A window object encapsulates both a top-level window and an OpenGL or OpenGL ES context. It is created with glfwCreateWindow and destroyed with glfwDestroyWindow or glfwTerminate. See Window creation for more information.

As the window and context are inseparably linked, the window object also serves as the context handle.

To test the creation of various kinds of contexts and see their properties, run the glfwinfo test program.

Note
Vulkan does not have a context and the Vulkan instance is created via the Vulkan API itself. If you will be using Vulkan to render to a window, disable context creation by setting the GLFW_CLIENT_API hint to GLFW_NO_API. For more information, see the Vulkan guide.

Context creation hints

There are a number of hints, specified using glfwWindowHint, related to what kind of context is created. See context related hints in the window guide.

Context object sharing

When creating a window and its OpenGL or OpenGL ES context with glfwCreateWindow, you can specify another window whose context the new one should share its objects (textures, vertex and element buffers, etc.) with.

GLFWwindow* second_window = glfwCreateWindow(640, 480, "Second Window", NULL, first_window);

Object sharing is implemented by the operating system and graphics driver. On platforms where it is possible to choose which types of objects are shared, GLFW requests that all types are shared.

See the relevant chapter of the OpenGL or OpenGL ES reference documents for more information. The name and number of this chapter unfortunately varies between versions and APIs, but has at times been named Shared Objects and Multiple Contexts.

GLFW comes with a barebones object sharing example program called sharing.

Offscreen contexts

GLFW doesn't support creating contexts without an associated window. However, contexts with hidden windows can be created with the GLFW_VISIBLE window hint.

GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL);

The window never needs to be shown and its context can be used as a plain offscreen context. Depending on the window manager, the size of a hidden window's framebuffer may not be usable or modifiable, so framebuffer objects are recommended for rendering with such contexts.

You should still process events as long as you have at least one window, even if none of them are visible.

macOS: The first time a window is created the menu bar is created. This is not desirable for example when writing a command-line only application. Menu bar creation can be disabled with the GLFW_COCOA_MENUBAR init hint.

Windows without contexts

You can disable context creation by setting the GLFW_CLIENT_API hint to GLFW_NO_API. Windows without contexts must not be passed to glfwMakeContextCurrent or glfwSwapBuffers.

Current context

Before you can make OpenGL or OpenGL ES calls, you need to have a current context of the correct type. A context can only be current for a single thread at a time, and a thread can only have a single context current at a time.

When moving a context between threads, you must make it non-current on the old thread before making it current on the new one.

The context of a window is made current with glfwMakeContextCurrent.

The window of the current context is returned by glfwGetCurrentContext.

The following GLFW functions require a context to be current. Calling any these functions without a current context will generate a GLFW_NO_CURRENT_CONTEXT error.

Buffer swapping

See Buffer swapping in the window guide.

OpenGL and OpenGL ES extensions

One of the benefits of OpenGL and OpenGL ES is their extensibility. Hardware vendors may include extensions in their implementations that extend the API before that functionality is included in a new version of the OpenGL or OpenGL ES specification, and some extensions are never included and remain as extensions until they become obsolete.

An extension is defined by:

  • An extension name (e.g. GL_ARB_debug_output)
  • New OpenGL tokens (e.g. GL_DEBUG_SEVERITY_HIGH_ARB)
  • New OpenGL functions (e.g. glGetDebugMessageLogARB)

Note the ARB affix, which stands for Architecture Review Board and is used for official extensions. The extension above was created by the ARB, but there are many different affixes, like NV for Nvidia and AMD for, well, AMD. Any group may also use the generic EXT affix. Lists of extensions, together with their specifications, can be found at the OpenGL Registry and OpenGL ES Registry.

Loading extension with a loader library

An extension loader library is the easiest and best way to access both OpenGL and OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs. They will take care of all the details of declaring and loading everything you need. One such library is glad and there are several others.

The following example will use glad but all extension loader libraries work similarly.

First you need to generate the source files using the glad Python script. This example generates a loader for any version of OpenGL, which is the default for both GLFW and glad, but loaders for OpenGL ES, as well as loaders for specific API versions and extension sets can be generated. The generated files are written to the output directory.

python main.py --generator c --no-loader --out-path output

The --no-loader option is added because GLFW already provides a function for loading OpenGL and OpenGL ES function pointers, one that automatically uses the selected context creation API, and glad can call this instead of having to implement its own. There are several other command-line options as well. See the glad documentation for details.

Add the generated output/src/glad.c, output/include/glad/glad.h and output/include/KHR/khrplatform.h files to your build. Then you need to include the glad header file, which will replace the OpenGL header of your development environment. By including the glad header before the GLFW header, it suppresses the development environment's OpenGL or OpenGL ES header.

#include <glad/glad.h>
#include <GLFW/glfw3.h>

Finally you need to initialize glad once you have a suitable current context.

window = glfwCreateWindow(640, 480, "My Window", NULL, NULL);
if (!window)
{
...
}
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);

Once glad has been loaded, you have access to all OpenGL core and extension functions supported by both the context you created and the glad loader you generated and you are ready to start rendering.

You can specify a minimum required OpenGL or OpenGL ES version with context hints. If your needs are more complex, you can check the actual OpenGL or OpenGL ES version with context attributes, or you can check whether a specific version is supported by the current context with the GLAD_GL_VERSION_x_x booleans.

if (GLAD_GL_VERSION_3_2)
{
// Call OpenGL 3.2+ specific code
}

To check whether a specific extension is supported, use the GLAD_GL_xxx booleans.

if (GLAD_GL_ARB_debug_output)
{
// Use GL_ARB_debug_output
}

Loading extensions manually

Do not use this technique unless it is absolutely necessary. An extension loader library will save you a ton of tedious, repetitive, error prone work.

To use a certain extension, you must first check whether the context supports that extension and then, if it introduces new functions, retrieve the pointers to those functions. GLFW provides glfwExtensionSupported and glfwGetProcAddress for manual loading of extensions and new API functions.

This section will demonstrate manual loading of OpenGL extensions. The loading of OpenGL ES extensions is identical except for the name of the extension header.

The glext.h header

The glext.h extension header is a continually updated file that defines the interfaces for all OpenGL extensions. The latest version of this can always be found at the OpenGL Registry. There are also extension headers for the various versions of OpenGL ES at the OpenGL ES Registry. It it strongly recommended that you use your own copy of the extension header, as the one included in your development environment may be several years out of date and may not include the extensions you wish to use.

The header defines function pointer types for all functions of all extensions it supports. These have names like PFNGLGETDEBUGMESSAGELOGARBPROC (for glGetDebugMessageLogARB), i.e. the name is made uppercase and PFN (pointer to function) and PROC (procedure) are added to the ends.

To include the extension header, define GLFW_INCLUDE_GLEXT before including the GLFW header.

#define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h>

Checking for extensions

A given machine may not actually support the extension (it may have older drivers or a graphics card that lacks the necessary hardware features), so it is necessary to check at run-time whether the context supports the extension. This is done with glfwExtensionSupported.

if (glfwExtensionSupported("GL_ARB_debug_output"))
{
// The extension is supported by the current context
}

The argument is a null terminated ASCII string with the extension name. If the extension is supported, glfwExtensionSupported returns GLFW_TRUE, otherwise it returns GLFW_FALSE.

Fetching function pointers

Many extensions, though not all, require the use of new OpenGL functions. These functions often do not have entry points in the client API libraries of your operating system, making it necessary to fetch them at run time. You can retrieve pointers to these functions with glfwGetProcAddress.

PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB");

In general, you should avoid giving the function pointer variables the (exact) same name as the function, as this may confuse your linker. Instead, you can use a different prefix, like above, or some other naming scheme.

Now that all the pieces have been introduced, here is what they might look like when used together.

#define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h>
#define glGetDebugMessageLogARB pfnGetDebugMessageLog
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;
// Flag indicating whether the extension is supported
int has_ARB_debug_output = 0;
void load_extensions(void)
{
if (glfwExtensionSupported("GL_ARB_debug_output"))
{
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC)
glfwGetProcAddress("glGetDebugMessageLogARB");
has_ARB_debug_output = 1;
}
}
void some_function(void)
{
if (has_ARB_debug_output)
{
// Now the extension function can be called as usual
glGetDebugMessageLogARB(...);
}
}
The header of the GLFW 3 API.
GLFWwindow * glfwGetCurrentContext(void)
Returns the window whose context is current on the calling thread.
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1152
int glfwExtensionSupported(const char *extension)
Returns whether the specified extension is available.
void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
#define GLFW_FALSE
Zero.
Definition: glfw3.h:289
GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
#define GLFW_VISIBLE
Window visibility window hint and attribute.
Definition: glfw3.h:782
================================================ FILE: thirdparty/glfw/docs/html/deprecated.html ================================================ GLFW: Deprecated List
Deprecated List
Global GLFWcharmodsfun )(GLFWwindow *, unsigned int, int)
Scheduled for removal in version 4.0.
Global glfwSetCharModsCallback (GLFWwindow *window, GLFWcharmodsfun callback)
Scheduled for removal in version 4.0.
================================================ FILE: thirdparty/glfw/docs/html/dir_15a5176d7c9cc5c407ed4f611edf0684.html ================================================ GLFW: GLFW Directory Reference
GLFW Directory Reference

Files

file  glfw3.h [code]
 The header of the GLFW 3 API.
 
file  glfw3native.h [code]
 The header of the native access functions.
 
================================================ FILE: thirdparty/glfw/docs/html/dir_a58ef735c5cc5a9a31d321e1abe7c42e.html ================================================ GLFW: include Directory Reference
include Directory Reference

Directories

directory  GLFW
 
================================================ FILE: thirdparty/glfw/docs/html/dir_abae1f34c5d965773b98e3c915cdaeb5.html ================================================ GLFW: docs Directory Reference
docs Directory Reference
================================================ FILE: thirdparty/glfw/docs/html/dir_bc6505cac00d7a6291dbfd9af70666b7.html ================================================ GLFW: glfw-3.3.2 Directory Reference
glfw-3.3.2 Directory Reference

Directories

directory  docs
 
directory  include
 
================================================ FILE: thirdparty/glfw/docs/html/doxygen.css ================================================ /* The standard CSS for doxygen 1.8.16 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; } p.reference, p.definition { font: 400 14px/22px Roboto,sans-serif; } /* @group Heading Levels */ h1.groupheader { font-size: 150%; } .title { font: 400 14px/28px Roboto,sans-serif; font-size: 150%; font-weight: bold; margin: 10px 2px; } h2.groupheader { border-bottom: 1px solid #879ECB; color: #354C7B; font-size: 150%; font-weight: normal; margin-top: 1.75em; padding-top: 8px; padding-bottom: 4px; width: 100%; } h3.groupheader { font-size: 100%; } h1, h2, h3, h4, h5, h6 { -webkit-transition: text-shadow 0.5s linear; -moz-transition: text-shadow 0.5s linear; -ms-transition: text-shadow 0.5s linear; -o-transition: text-shadow 0.5s linear; transition: text-shadow 0.5s linear; margin-right: 15px; } h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { text-shadow: 0 0 15px cyan; } dt { font-weight: bold; } ul.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; column-count: 3; } p.startli, p.startdd { margin-top: 2px; } p.starttd { margin-top: 0px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } p.interli { } p.interdd { } p.intertd { } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #FFFFFF; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #FFFFFF; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited, a.line, a.line:visited { color: #4665A2; } a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } ul { overflow: hidden; /*Fixed: list item bullets overlap floating elements*/ } #side-nav ul { overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ } #main-nav ul { overflow: visible; /* reset ul rule for the navigation bar drop down lists */ } .fragment { text-align: left; direction: ltr; overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ overflow-y: hidden; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; font-family: monospace, fixed; font-size: 105%; } div.fragment { padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ margin: 4px 8px 4px 2px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } div.line { font-family: monospace, fixed; font-size: 13px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } div.line:after { content:"\000A"; white-space: pre; } div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; } span.lineno { padding-right: 4px; text-align: right; border-right: 2px solid #0F0; background-color: #E8E8E8; white-space: pre; } span.lineno a { background-color: #D8D8D8; } span.lineno a:hover { background-color: #C8C8C8; } .lineno { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } div.ah, span.ah { background-color: black; font-weight: bold; color: #FFFFFF; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); } div.classindex ul { list-style: none; padding-left: 0; } div.classindex span.ai { display: inline-block; } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 12px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl, img.inline { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } blockquote.DocNodeRTL { border-left: 0; border-right: 2px solid #9CAFD4; margin: 0 4px 0 24px; padding: 0 16px 0 12px; } /* @end */ /* .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%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td, .fieldtable tr { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow, .fieldtable tr.glow { background-color: cyan; box-shadow: 0 0 15px cyan; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memSeparator { border-bottom: 1px solid #DEE4F0; line-height: 1px; margin: 0px; padding: 0px; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; font-size: 80%; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtitle { padding: 8px; border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; border-top-right-radius: 4px; border-top-left-radius: 4px; margin-bottom: -1px; background-image: url('nav_f.png'); background-repeat: repeat-x; background-color: #E2E8F2; line-height: 1.25; font-weight: 300; float:left; } .permalink { font-size: 65%; display: inline-block; vertical-align: middle; } .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; -webkit-transition: box-shadow 0.5s linear; -moz-transition: box-shadow 0.5s linear; -ms-transition: box-shadow 0.5s linear; -o-transition: box-shadow 0.5s linear; transition: box-shadow 0.5s linear; display: table !important; width: 100%; } .memitem.glow { box-shadow: 0 0 15px cyan; } .memname { font-weight: 400; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); background-color: #DFE5F1; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; } .overload { font-family: "courier new",courier,monospace; font-size: 65%; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 10px 2px 10px; background-color: #FBFCFD; border-top-width: 0; background-image:url('nav_g.png'); background-repeat:repeat-x; background-color: #FFFFFF; /* opera specific markup */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; /* webkit specific markup */ -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .paramname code { line-height: 14px; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; } .params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { font-weight: bold; vertical-align: top; } .params .paramtype, .tparams .paramtype { font-style: italic; vertical-align: top; } .params .paramdir, .tparams .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #5373B4; border-left:1px solid #5373B4; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; vertical-align: middle; } /* @end */ /* these are for tree view inside a (index) page */ div.directory { margin: 10px 0px; border-top: 1px solid #9CAFD4; border-bottom: 1px solid #9CAFD4; width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: top; } .directory td.entry { white-space: nowrap; padding-right: 6px; padding-top: 3px; } .directory td.entry a { outline:none; } .directory td.entry a img { border: none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; padding-top: 3px; border-left: 1px solid rgba(0,0,0,0.05); } .directory tr.even { padding-left: 6px; background-color: #F7F8FB; } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } .arrow { color: #9CAFD4; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: pointer; font-size: 80%; display: inline-block; width: 16px; height: 22px; } .icon { font-family: Arial, Helvetica; font-weight: bold; font-size: 12px; height: 14px; width: 16px; display: inline-block; background-color: #728DC1; color: white; text-align: center; border-radius: 4px; margin-left: 2px; margin-right: 2px; } .icona { width: 24px; height: 22px; display: inline-block; } .iconfopen { width: 24px; height: 18px; margin-bottom: 4px; background-image:url('folderopen.png'); background-position: 0px -4px; background-repeat: repeat-y; vertical-align:top; display: inline-block; } .iconfclosed { width: 24px; height: 18px; margin-bottom: 4px; background-image:url('folderclosed.png'); background-position: 0px -4px; background-repeat: repeat-y; vertical-align:top; display: inline-block; } .icondoc { width: 24px; height: 18px; margin-bottom: 4px; background-image:url('doc.png'); background-position: 0px -4px; background-repeat: repeat-y; vertical-align:top; display: inline-block; } table.directory { font: 400 14px Roboto,sans-serif; } /* @end */ div.dynheader { margin-top: 8px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } address { font-style: normal; color: #2A3D61; } table.doxtable caption { caption-side: top; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { /*width: 100%;*/ margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fieldname { padding-top: 3px; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; /*width: 100%;*/ } .fieldtable td.fielddoc p:first-child { margin-top: 0px; } .fieldtable td.fielddoc p:last-child { margin-bottom: 2px; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; font-weight: 400; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; background-position: 0 -5px; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; color: #283A5D; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } table.classindex { margin: 10px; white-space: nowrap; margin-left: 3%; margin-right: 3%; width: 94%; border: 0; border-spacing: 0; padding: 0; } div.ingroups { font-size: 8pt; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } .PageDocRTL-title div.headertitle { text-align: right; direction: rtl; } dl { padding: 0 0 0 0; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ dl.section { margin-left: 0px; padding-left: 0px; } dl.section.DocNodeRTL { margin-right: 0px; padding-right: 0px; } dl.note { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #D0C000; } dl.note.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #D0C000; } dl.warning, dl.attention { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #FF0000; } dl.warning.DocNodeRTL, dl.attention.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #00D000; } dl.pre.DocNodeRTL, dl.post.DocNodeRTL, dl.invariant.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #00D000; } dl.deprecated { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #505050; } dl.deprecated.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #505050; } dl.todo { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #00C0E0; } dl.todo.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #00C0E0; } dl.test { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #3030E0; } dl.test.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #3030E0; } dl.bug { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #C08050; } dl.bug.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectalign { vertical-align: middle; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .plantumlgraph { text-align: center; } .diagraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 8px 10px 10px; width: 200px; } .PageDocRTL-title div.toc { float: left !important; text-align: right; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } .PageDocRTL-title div.toc li { background-position-x: right !important; padding-left: 0 !important; padding-right: 10px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .PageDocRTL-title div.toc li.level1 { margin-left: 0 !important; margin-right: 0; } .PageDocRTL-title div.toc li.level2 { margin-left: 0 !important; margin-right: 15px; } .PageDocRTL-title div.toc li.level3 { margin-left: 0 !important; margin-right: 30px; } .PageDocRTL-title div.toc li.level4 { margin-left: 0 !important; margin-right: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } /* tooltip related style info */ .ttc { position: absolute; display: none; } #powerTip { cursor: default; white-space: nowrap; background-color: white; border: 1px solid gray; border-radius: 4px 4px 4px 4px; box-shadow: 1px 1px 7px gray; display: none; font-size: smaller; max-width: 80%; opacity: 0.9; padding: 1ex 1em 1em; position: absolute; z-index: 2147483647; } #powerTip div.ttdoc { color: grey; font-style: italic; } #powerTip div.ttname a { font-weight: bold; } #powerTip div.ttname { font-weight: bold; } #powerTip div.ttdeci { color: #006318; } #powerTip div { margin: 0px; padding: 0px; font: 12px/16px Roboto,sans-serif; } #powerTip:before, #powerTip:after { content: ""; position: absolute; margin: 0px; } #powerTip.n:after, #powerTip.n:before, #powerTip.s:after, #powerTip.s:before, #powerTip.w:after, #powerTip.w:before, #powerTip.e:after, #powerTip.e:before, #powerTip.ne:after, #powerTip.ne:before, #powerTip.se:after, #powerTip.se:before, #powerTip.nw:after, #powerTip.nw:before, #powerTip.sw:after, #powerTip.sw:before { border: solid transparent; content: " "; height: 0; width: 0; position: absolute; } #powerTip.n:after, #powerTip.s:after, #powerTip.w:after, #powerTip.e:after, #powerTip.nw:after, #powerTip.ne:after, #powerTip.sw:after, #powerTip.se:after { border-color: rgba(255, 255, 255, 0); } #powerTip.n:before, #powerTip.s:before, #powerTip.w:before, #powerTip.e:before, #powerTip.nw:before, #powerTip.ne:before, #powerTip.sw:before, #powerTip.se:before { border-color: rgba(128, 128, 128, 0); } #powerTip.n:after, #powerTip.n:before, #powerTip.ne:after, #powerTip.ne:before, #powerTip.nw:after, #powerTip.nw:before { top: 100%; } #powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { border-top-color: #FFFFFF; border-width: 10px; margin: 0px -10px; } #powerTip.n:before { border-top-color: #808080; border-width: 11px; margin: 0px -11px; } #powerTip.n:after, #powerTip.n:before { left: 50%; } #powerTip.nw:after, #powerTip.nw:before { right: 14px; } #powerTip.ne:after, #powerTip.ne:before { left: 14px; } #powerTip.s:after, #powerTip.s:before, #powerTip.se:after, #powerTip.se:before, #powerTip.sw:after, #powerTip.sw:before { bottom: 100%; } #powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { border-bottom-color: #FFFFFF; border-width: 10px; margin: 0px -10px; } #powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { border-bottom-color: #808080; border-width: 11px; margin: 0px -11px; } #powerTip.s:after, #powerTip.s:before { left: 50%; } #powerTip.sw:after, #powerTip.sw:before { right: 14px; } #powerTip.se:after, #powerTip.se:before { left: 14px; } #powerTip.e:after, #powerTip.e:before { left: 100%; } #powerTip.e:after { border-left-color: #FFFFFF; border-width: 10px; top: 50%; margin-top: -10px; } #powerTip.e:before { border-left-color: #808080; border-width: 11px; top: 50%; margin-top: -11px; } #powerTip.w:after, #powerTip.w:before { right: 100%; } #powerTip.w:after { border-right-color: #FFFFFF; border-width: 10px; top: 50%; margin-top: -10px; } #powerTip.w:before { border-right-color: #808080; border-width: 11px; top: 50%; margin-top: -11px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } /* @group Markdown */ /* table.markdownTable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.markdownTable td, table.markdownTable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.markdownTableHead tr { } table.markdownTableBodyLeft td, table.markdownTable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } th.markdownTableHeadLeft { text-align: left } th.markdownTableHeadRight { text-align: right } th.markdownTableHeadCenter { text-align: center } */ table.markdownTable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.markdownTable td, table.markdownTable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.markdownTable tr { } th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } th.markdownTableHeadLeft, td.markdownTableBodyLeft { text-align: left } th.markdownTableHeadRight, td.markdownTableBodyRight { text-align: right } th.markdownTableHeadCenter, td.markdownTableBodyCenter { text-align: center } .DocNodeRTL { text-align: right; direction: rtl; } .DocNodeLTR { text-align: left; direction: ltr; } table.DocNodeRTL { width: auto; margin-right: 0; margin-left: auto; } table.DocNodeLTR { width: auto; margin-right: auto; margin-left: 0; } tt, code, kbd, samp { display: inline-block; direction:ltr; } /* @end */ u { text-decoration: underline; } ================================================ FILE: thirdparty/glfw/docs/html/dynsections.js ================================================ /* @licstart The following is the entire license notice for the JavaScript code in this file. Copyright (C) 1997-2017 by Dimitri van Heesch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @licend The above is the entire license notice for the JavaScript code in this file */ function toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); var summary = $('#'+base+'-summary'); var content = $('#'+base+'-content'); var trigger = $('#'+base+'-trigger'); var src=$(trigger).attr('src'); if (content.is(':visible')===true) { content.hide(); summary.show(); $(linkObj).addClass('closed').removeClass('opened'); $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { content.show(); summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); } return false; } function updateStripes() { $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } function toggleLevel(level) { $('table.directory tr').each(function() { var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l GLFW: Files
Files
Here is a list of all files with brief descriptions:
 glfw3.hThe header of the GLFW 3 API
 glfw3native.hThe header of the native access functions
================================================ FILE: thirdparty/glfw/docs/html/glfw3_8h.html ================================================ GLFW: glfw3.h File Reference
glfw3.h File Reference

Description

This is the header file of the GLFW 3 API. It defines all its types and declares all its functions.

For more information about how to use this file, see Including the GLFW header file.

Go to the source code of this file.

Macros

#define GLFW_APIENTRY_DEFINED
 
#define GLFW_TRUE   1
 One. More...
 
#define GLFW_FALSE   0
 Zero. More...
 
#define GLFW_HAT_CENTERED   0
 
#define GLFW_HAT_UP   1
 
#define GLFW_HAT_RIGHT   2
 
#define GLFW_HAT_DOWN   4
 
#define GLFW_HAT_LEFT   8
 
#define GLFW_HAT_RIGHT_UP   (GLFW_HAT_RIGHT | GLFW_HAT_UP)
 
#define GLFW_HAT_RIGHT_DOWN   (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
 
#define GLFW_HAT_LEFT_UP   (GLFW_HAT_LEFT | GLFW_HAT_UP)
 
#define GLFW_HAT_LEFT_DOWN   (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
 
#define GLFW_KEY_UNKNOWN   -1
 
#define GLFW_KEY_SPACE   32
 
#define GLFW_KEY_APOSTROPHE   39 /* ' */
 
#define GLFW_KEY_COMMA   44 /* , */
 
#define GLFW_KEY_MINUS   45 /* - */
 
#define GLFW_KEY_PERIOD   46 /* . */
 
#define GLFW_KEY_SLASH   47 /* / */
 
#define GLFW_KEY_0   48
 
#define GLFW_KEY_1   49
 
#define GLFW_KEY_2   50
 
#define GLFW_KEY_3   51
 
#define GLFW_KEY_4   52
 
#define GLFW_KEY_5   53
 
#define GLFW_KEY_6   54
 
#define GLFW_KEY_7   55
 
#define GLFW_KEY_8   56
 
#define GLFW_KEY_9   57
 
#define GLFW_KEY_SEMICOLON   59 /* ; */
 
#define GLFW_KEY_EQUAL   61 /* = */
 
#define GLFW_KEY_A   65
 
#define GLFW_KEY_B   66
 
#define GLFW_KEY_C   67
 
#define GLFW_KEY_D   68
 
#define GLFW_KEY_E   69
 
#define GLFW_KEY_F   70
 
#define GLFW_KEY_G   71
 
#define GLFW_KEY_H   72
 
#define GLFW_KEY_I   73
 
#define GLFW_KEY_J   74
 
#define GLFW_KEY_K   75
 
#define GLFW_KEY_L   76
 
#define GLFW_KEY_M   77
 
#define GLFW_KEY_N   78
 
#define GLFW_KEY_O   79
 
#define GLFW_KEY_P   80
 
#define GLFW_KEY_Q   81
 
#define GLFW_KEY_R   82
 
#define GLFW_KEY_S   83
 
#define GLFW_KEY_T   84
 
#define GLFW_KEY_U   85
 
#define GLFW_KEY_V   86
 
#define GLFW_KEY_W   87
 
#define GLFW_KEY_X   88
 
#define GLFW_KEY_Y   89
 
#define GLFW_KEY_Z   90
 
#define GLFW_KEY_LEFT_BRACKET   91 /* [ */
 
#define GLFW_KEY_BACKSLASH   92 /* \ */
 
#define GLFW_KEY_RIGHT_BRACKET   93 /* ] */
 
#define GLFW_KEY_GRAVE_ACCENT   96 /* ` */
 
#define GLFW_KEY_WORLD_1   161 /* non-US #1 */
 
#define GLFW_KEY_WORLD_2   162 /* non-US #2 */
 
#define GLFW_KEY_ESCAPE   256
 
#define GLFW_KEY_ENTER   257
 
#define GLFW_KEY_TAB   258
 
#define GLFW_KEY_BACKSPACE   259
 
#define GLFW_KEY_INSERT   260
 
#define GLFW_KEY_DELETE   261
 
#define GLFW_KEY_RIGHT   262
 
#define GLFW_KEY_LEFT   263
 
#define GLFW_KEY_DOWN   264
 
#define GLFW_KEY_UP   265
 
#define GLFW_KEY_PAGE_UP   266
 
#define GLFW_KEY_PAGE_DOWN   267
 
#define GLFW_KEY_HOME   268
 
#define GLFW_KEY_END   269
 
#define GLFW_KEY_CAPS_LOCK   280
 
#define GLFW_KEY_SCROLL_LOCK   281
 
#define GLFW_KEY_NUM_LOCK   282
 
#define GLFW_KEY_PRINT_SCREEN   283
 
#define GLFW_KEY_PAUSE   284
 
#define GLFW_KEY_F1   290
 
#define GLFW_KEY_F2   291
 
#define GLFW_KEY_F3   292
 
#define GLFW_KEY_F4   293
 
#define GLFW_KEY_F5   294
 
#define GLFW_KEY_F6   295
 
#define GLFW_KEY_F7   296
 
#define GLFW_KEY_F8   297
 
#define GLFW_KEY_F9   298
 
#define GLFW_KEY_F10   299
 
#define GLFW_KEY_F11   300
 
#define GLFW_KEY_F12   301
 
#define GLFW_KEY_F13   302
 
#define GLFW_KEY_F14   303
 
#define GLFW_KEY_F15   304
 
#define GLFW_KEY_F16   305
 
#define GLFW_KEY_F17   306
 
#define GLFW_KEY_F18   307
 
#define GLFW_KEY_F19   308
 
#define GLFW_KEY_F20   309
 
#define GLFW_KEY_F21   310
 
#define GLFW_KEY_F22   311
 
#define GLFW_KEY_F23   312
 
#define GLFW_KEY_F24   313
 
#define GLFW_KEY_F25   314
 
#define GLFW_KEY_KP_0   320
 
#define GLFW_KEY_KP_1   321
 
#define GLFW_KEY_KP_2   322
 
#define GLFW_KEY_KP_3   323
 
#define GLFW_KEY_KP_4   324
 
#define GLFW_KEY_KP_5   325
 
#define GLFW_KEY_KP_6   326
 
#define GLFW_KEY_KP_7   327
 
#define GLFW_KEY_KP_8   328
 
#define GLFW_KEY_KP_9   329
 
#define GLFW_KEY_KP_DECIMAL   330
 
#define GLFW_KEY_KP_DIVIDE   331
 
#define GLFW_KEY_KP_MULTIPLY   332
 
#define GLFW_KEY_KP_SUBTRACT   333
 
#define GLFW_KEY_KP_ADD   334
 
#define GLFW_KEY_KP_ENTER   335
 
#define GLFW_KEY_KP_EQUAL   336
 
#define GLFW_KEY_LEFT_SHIFT   340
 
#define GLFW_KEY_LEFT_CONTROL   341
 
#define GLFW_KEY_LEFT_ALT   342
 
#define GLFW_KEY_LEFT_SUPER   343
 
#define GLFW_KEY_RIGHT_SHIFT   344
 
#define GLFW_KEY_RIGHT_CONTROL   345
 
#define GLFW_KEY_RIGHT_ALT   346
 
#define GLFW_KEY_RIGHT_SUPER   347
 
#define GLFW_KEY_MENU   348
 
#define GLFW_KEY_LAST   GLFW_KEY_MENU
 
#define GLFW_MOD_SHIFT   0x0001
 If this bit is set one or more Shift keys were held down. More...
 
#define GLFW_MOD_CONTROL   0x0002
 If this bit is set one or more Control keys were held down. More...
 
#define GLFW_MOD_ALT   0x0004
 If this bit is set one or more Alt keys were held down. More...
 
#define GLFW_MOD_SUPER   0x0008
 If this bit is set one or more Super keys were held down. More...
 
#define GLFW_MOD_CAPS_LOCK   0x0010
 If this bit is set the Caps Lock key is enabled. More...
 
#define GLFW_MOD_NUM_LOCK   0x0020
 If this bit is set the Num Lock key is enabled. More...
 
#define GLFW_MOUSE_BUTTON_1   0
 
#define GLFW_MOUSE_BUTTON_2   1
 
#define GLFW_MOUSE_BUTTON_3   2
 
#define GLFW_MOUSE_BUTTON_4   3
 
#define GLFW_MOUSE_BUTTON_5   4
 
#define GLFW_MOUSE_BUTTON_6   5
 
#define GLFW_MOUSE_BUTTON_7   6
 
#define GLFW_MOUSE_BUTTON_8   7
 
#define GLFW_MOUSE_BUTTON_LAST   GLFW_MOUSE_BUTTON_8
 
#define GLFW_MOUSE_BUTTON_LEFT   GLFW_MOUSE_BUTTON_1
 
#define GLFW_MOUSE_BUTTON_RIGHT   GLFW_MOUSE_BUTTON_2
 
#define GLFW_MOUSE_BUTTON_MIDDLE   GLFW_MOUSE_BUTTON_3
 
#define GLFW_JOYSTICK_1   0
 
#define GLFW_JOYSTICK_2   1
 
#define GLFW_JOYSTICK_3   2
 
#define GLFW_JOYSTICK_4   3
 
#define GLFW_JOYSTICK_5   4
 
#define GLFW_JOYSTICK_6   5
 
#define GLFW_JOYSTICK_7   6
 
#define GLFW_JOYSTICK_8   7
 
#define GLFW_JOYSTICK_9   8
 
#define GLFW_JOYSTICK_10   9
 
#define GLFW_JOYSTICK_11   10
 
#define GLFW_JOYSTICK_12   11
 
#define GLFW_JOYSTICK_13   12
 
#define GLFW_JOYSTICK_14   13
 
#define GLFW_JOYSTICK_15   14
 
#define GLFW_JOYSTICK_16   15
 
#define GLFW_JOYSTICK_LAST   GLFW_JOYSTICK_16
 
#define GLFW_GAMEPAD_BUTTON_A   0
 
#define GLFW_GAMEPAD_BUTTON_B   1
 
#define GLFW_GAMEPAD_BUTTON_X   2
 
#define GLFW_GAMEPAD_BUTTON_Y   3
 
#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER   4
 
#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER   5
 
#define GLFW_GAMEPAD_BUTTON_BACK   6
 
#define GLFW_GAMEPAD_BUTTON_START   7
 
#define GLFW_GAMEPAD_BUTTON_GUIDE   8
 
#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB   9
 
#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB   10
 
#define GLFW_GAMEPAD_BUTTON_DPAD_UP   11
 
#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT   12
 
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN   13
 
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT   14
 
#define GLFW_GAMEPAD_BUTTON_LAST   GLFW_GAMEPAD_BUTTON_DPAD_LEFT
 
#define GLFW_GAMEPAD_BUTTON_CROSS   GLFW_GAMEPAD_BUTTON_A
 
#define GLFW_GAMEPAD_BUTTON_CIRCLE   GLFW_GAMEPAD_BUTTON_B
 
#define GLFW_GAMEPAD_BUTTON_SQUARE   GLFW_GAMEPAD_BUTTON_X
 
#define GLFW_GAMEPAD_BUTTON_TRIANGLE   GLFW_GAMEPAD_BUTTON_Y
 
#define GLFW_GAMEPAD_AXIS_LEFT_X   0
 
#define GLFW_GAMEPAD_AXIS_LEFT_Y   1
 
#define GLFW_GAMEPAD_AXIS_RIGHT_X   2
 
#define GLFW_GAMEPAD_AXIS_RIGHT_Y   3
 
#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER   4
 
#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER   5
 
#define GLFW_GAMEPAD_AXIS_LAST   GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
 
#define GLFW_NO_ERROR   0
 No error has occurred. More...
 
#define GLFW_NOT_INITIALIZED   0x00010001
 GLFW has not been initialized. More...
 
#define GLFW_NO_CURRENT_CONTEXT   0x00010002
 No context is current for this thread. More...
 
#define GLFW_INVALID_ENUM   0x00010003
 One of the arguments to the function was an invalid enum value. More...
 
#define GLFW_INVALID_VALUE   0x00010004
 One of the arguments to the function was an invalid value. More...
 
#define GLFW_OUT_OF_MEMORY   0x00010005
 A memory allocation failed. More...
 
#define GLFW_API_UNAVAILABLE   0x00010006
 GLFW could not find support for the requested API on the system. More...
 
#define GLFW_VERSION_UNAVAILABLE   0x00010007
 The requested OpenGL or OpenGL ES version is not available. More...
 
#define GLFW_PLATFORM_ERROR   0x00010008
 A platform-specific error occurred that does not match any of the more specific categories. More...
 
#define GLFW_FORMAT_UNAVAILABLE   0x00010009
 The requested format is not supported or available. More...
 
#define GLFW_NO_WINDOW_CONTEXT   0x0001000A
 The specified window does not have an OpenGL or OpenGL ES context. More...
 
#define GLFW_FOCUSED   0x00020001
 Input focus window hint and attribute. More...
 
#define GLFW_ICONIFIED   0x00020002
 Window iconification window attribute. More...
 
#define GLFW_RESIZABLE   0x00020003
 Window resize-ability window hint and attribute. More...
 
#define GLFW_VISIBLE   0x00020004
 Window visibility window hint and attribute. More...
 
#define GLFW_DECORATED   0x00020005
 Window decoration window hint and attribute. More...
 
#define GLFW_AUTO_ICONIFY   0x00020006
 Window auto-iconification window hint and attribute. More...
 
#define GLFW_FLOATING   0x00020007
 Window decoration window hint and attribute. More...
 
#define GLFW_MAXIMIZED   0x00020008
 Window maximization window hint and attribute. More...
 
#define GLFW_CENTER_CURSOR   0x00020009
 Cursor centering window hint. More...
 
#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A
 Window framebuffer transparency hint and attribute. More...
 
#define GLFW_HOVERED   0x0002000B
 Mouse cursor hover window attribute. More...
 
#define GLFW_FOCUS_ON_SHOW   0x0002000C
 Input focus on calling show window hint and attribute. More...
 
#define GLFW_RED_BITS   0x00021001
 Framebuffer bit depth hint. More...
 
#define GLFW_GREEN_BITS   0x00021002
 Framebuffer bit depth hint. More...
 
#define GLFW_BLUE_BITS   0x00021003
 Framebuffer bit depth hint. More...
 
#define GLFW_ALPHA_BITS   0x00021004
 Framebuffer bit depth hint. More...
 
#define GLFW_DEPTH_BITS   0x00021005
 Framebuffer bit depth hint. More...
 
#define GLFW_STENCIL_BITS   0x00021006
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_RED_BITS   0x00021007
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_GREEN_BITS   0x00021008
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_BLUE_BITS   0x00021009
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_ALPHA_BITS   0x0002100A
 Framebuffer bit depth hint. More...
 
#define GLFW_AUX_BUFFERS   0x0002100B
 Framebuffer auxiliary buffer hint. More...
 
#define GLFW_STEREO   0x0002100C
 OpenGL stereoscopic rendering hint. More...
 
#define GLFW_SAMPLES   0x0002100D
 Framebuffer MSAA samples hint. More...
 
#define GLFW_SRGB_CAPABLE   0x0002100E
 Framebuffer sRGB hint. More...
 
#define GLFW_REFRESH_RATE   0x0002100F
 Monitor refresh rate hint. More...
 
#define GLFW_DOUBLEBUFFER   0x00021010
 Framebuffer double buffering hint. More...
 
#define GLFW_CLIENT_API   0x00022001
 Context client API hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002
 Context client API major version hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MINOR   0x00022003
 Context client API minor version hint and attribute. More...
 
#define GLFW_CONTEXT_REVISION   0x00022004
 Context client API revision number hint and attribute. More...
 
#define GLFW_CONTEXT_ROBUSTNESS   0x00022005
 Context robustness hint and attribute. More...
 
#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006
 OpenGL forward-compatibility hint and attribute. More...
 
#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
 OpenGL debug context hint and attribute. More...
 
#define GLFW_OPENGL_PROFILE   0x00022008
 OpenGL profile hint and attribute. More...
 
#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009
 Context flush-on-release hint and attribute. More...
 
#define GLFW_CONTEXT_NO_ERROR   0x0002200A
 Context error suppression hint and attribute. More...
 
#define GLFW_CONTEXT_CREATION_API   0x0002200B
 Context creation API hint and attribute. More...
 
#define GLFW_SCALE_TO_MONITOR   0x0002200C
 Window content area scaling window window hint. More...
 
#define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001
 macOS specific window hint. More...
 
#define GLFW_COCOA_FRAME_NAME   0x00023002
 macOS specific window hint. More...
 
#define GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003
 macOS specific window hint. More...
 
#define GLFW_X11_CLASS_NAME   0x00024001
 X11 specific window hint. More...
 
#define GLFW_X11_INSTANCE_NAME   0x00024002
 X11 specific window hint. More...
 
#define GLFW_NO_API   0
 
#define GLFW_OPENGL_API   0x00030001
 
#define GLFW_OPENGL_ES_API   0x00030002
 
#define GLFW_NO_ROBUSTNESS   0
 
#define GLFW_NO_RESET_NOTIFICATION   0x00031001
 
#define GLFW_LOSE_CONTEXT_ON_RESET   0x00031002
 
#define GLFW_OPENGL_ANY_PROFILE   0
 
#define GLFW_OPENGL_CORE_PROFILE   0x00032001
 
#define GLFW_OPENGL_COMPAT_PROFILE   0x00032002
 
#define GLFW_CURSOR   0x00033001
 
#define GLFW_STICKY_KEYS   0x00033002
 
#define GLFW_STICKY_MOUSE_BUTTONS   0x00033003
 
#define GLFW_LOCK_KEY_MODS   0x00033004
 
#define GLFW_RAW_MOUSE_MOTION   0x00033005
 
#define GLFW_CURSOR_NORMAL   0x00034001
 
#define GLFW_CURSOR_HIDDEN   0x00034002
 
#define GLFW_CURSOR_DISABLED   0x00034003
 
#define GLFW_ANY_RELEASE_BEHAVIOR   0
 
#define GLFW_RELEASE_BEHAVIOR_FLUSH   0x00035001
 
#define GLFW_RELEASE_BEHAVIOR_NONE   0x00035002
 
#define GLFW_NATIVE_CONTEXT_API   0x00036001
 
#define GLFW_EGL_CONTEXT_API   0x00036002
 
#define GLFW_OSMESA_CONTEXT_API   0x00036003
 
#define GLFW_ARROW_CURSOR   0x00036001
 The regular arrow cursor shape. More...
 
#define GLFW_IBEAM_CURSOR   0x00036002
 The text input I-beam cursor shape. More...
 
#define GLFW_CROSSHAIR_CURSOR   0x00036003
 The crosshair shape. More...
 
#define GLFW_HAND_CURSOR   0x00036004
 The hand shape. More...
 
#define GLFW_HRESIZE_CURSOR   0x00036005
 The horizontal resize arrow shape. More...
 
#define GLFW_VRESIZE_CURSOR   0x00036006
 The vertical resize arrow shape. More...
 
#define GLFW_CONNECTED   0x00040001
 
#define GLFW_DISCONNECTED   0x00040002
 
#define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001
 Joystick hat buttons init hint. More...
 
#define GLFW_COCOA_CHDIR_RESOURCES   0x00051001
 macOS specific init hint. More...
 
#define GLFW_COCOA_MENUBAR   0x00051002
 macOS specific init hint. More...
 
#define GLFW_DONT_CARE   -1
 
#define GLAPIENTRY   APIENTRY
 
GLFW version macros
#define GLFW_VERSION_MAJOR   3
 The major version number of the GLFW library. More...
 
#define GLFW_VERSION_MINOR   3
 The minor version number of the GLFW library. More...
 
#define GLFW_VERSION_REVISION   2
 The revision number of the GLFW library. More...
 
Key and button actions
#define GLFW_RELEASE   0
 The key or mouse button was released. More...
 
#define GLFW_PRESS   1
 The key or mouse button was pressed. More...
 
#define GLFW_REPEAT   2
 The key was held down until it repeated. More...
 

Typedefs

typedef void(* GLFWglproc) (void)
 Client API function pointer type. More...
 
typedef void(* GLFWvkproc) (void)
 Vulkan API function pointer type. More...
 
typedef struct GLFWmonitor GLFWmonitor
 Opaque monitor object. More...
 
typedef struct GLFWwindow GLFWwindow
 Opaque window object. More...
 
typedef struct GLFWcursor GLFWcursor
 Opaque cursor object. More...
 
typedef void(* GLFWerrorfun) (int, const char *)
 The function pointer type for error callbacks. More...
 
typedef void(* GLFWwindowposfun) (GLFWwindow *, int, int)
 The function pointer type for window position callbacks. More...
 
typedef void(* GLFWwindowsizefun) (GLFWwindow *, int, int)
 The function pointer type for window size callbacks. More...
 
typedef void(* GLFWwindowclosefun) (GLFWwindow *)
 The function pointer type for window close callbacks. More...
 
typedef void(* GLFWwindowrefreshfun) (GLFWwindow *)
 The function pointer type for window content refresh callbacks. More...
 
typedef void(* GLFWwindowfocusfun) (GLFWwindow *, int)
 The function pointer type for window focus callbacks. More...
 
typedef void(* GLFWwindowiconifyfun) (GLFWwindow *, int)
 The function pointer type for window iconify callbacks. More...
 
typedef void(* GLFWwindowmaximizefun) (GLFWwindow *, int)
 The function pointer type for window maximize callbacks. More...
 
typedef void(* GLFWframebuffersizefun) (GLFWwindow *, int, int)
 The function pointer type for framebuffer size callbacks. More...
 
typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *, float, float)
 The function pointer type for window content scale callbacks. More...
 
typedef void(* GLFWmousebuttonfun) (GLFWwindow *, int, int, int)
 The function pointer type for mouse button callbacks. More...
 
typedef void(* GLFWcursorposfun) (GLFWwindow *, double, double)
 The function pointer type for cursor position callbacks. More...
 
typedef void(* GLFWcursorenterfun) (GLFWwindow *, int)
 The function pointer type for cursor enter/leave callbacks. More...
 
typedef void(* GLFWscrollfun) (GLFWwindow *, double, double)
 The function pointer type for scroll callbacks. More...
 
typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)
 The function pointer type for keyboard key callbacks. More...
 
typedef void(* GLFWcharfun) (GLFWwindow *, unsigned int)
 The function pointer type for Unicode character callbacks. More...
 
typedef void(* GLFWcharmodsfun) (GLFWwindow *, unsigned int, int)
 The function pointer type for Unicode character with modifiers callbacks. More...
 
typedef void(* GLFWdropfun) (GLFWwindow *, int, const char *[])
 The function pointer type for path drop callbacks. More...
 
typedef void(* GLFWmonitorfun) (GLFWmonitor *, int)
 The function pointer type for monitor configuration callbacks. More...
 
typedef void(* GLFWjoystickfun) (int, int)
 The function pointer type for joystick configuration callbacks. More...
 
typedef struct GLFWvidmode GLFWvidmode
 Video mode type. More...
 
typedef struct GLFWgammaramp GLFWgammaramp
 Gamma ramp. More...
 
typedef struct GLFWimage GLFWimage
 Image data. More...
 
typedef struct GLFWgamepadstate GLFWgamepadstate
 Gamepad input state. More...
 

Functions

int glfwInit (void)
 Initializes the GLFW library. More...
 
void glfwTerminate (void)
 Terminates the GLFW library. More...
 
void glfwInitHint (int hint, int value)
 Sets the specified init hint to the desired value. More...
 
void glfwGetVersion (int *major, int *minor, int *rev)
 Retrieves the version of the GLFW library. More...
 
const char * glfwGetVersionString (void)
 Returns a string describing the compile-time configuration. More...
 
int glfwGetError (const char **description)
 Returns and clears the last error for the calling thread. More...
 
GLFWerrorfun glfwSetErrorCallback (GLFWerrorfun callback)
 Sets the error callback. More...
 
GLFWmonitor ** glfwGetMonitors (int *count)
 Returns the currently connected monitors. More...
 
GLFWmonitorglfwGetPrimaryMonitor (void)
 Returns the primary monitor. More...
 
void glfwGetMonitorPos (GLFWmonitor *monitor, int *xpos, int *ypos)
 Returns the position of the monitor's viewport on the virtual screen. More...
 
void glfwGetMonitorWorkarea (GLFWmonitor *monitor, int *xpos, int *ypos, int *width, int *height)
 Retrieves the work area of the monitor. More...
 
void glfwGetMonitorPhysicalSize (GLFWmonitor *monitor, int *widthMM, int *heightMM)
 Returns the physical size of the monitor. More...
 
void glfwGetMonitorContentScale (GLFWmonitor *monitor, float *xscale, float *yscale)
 Retrieves the content scale for the specified monitor. More...
 
const char * glfwGetMonitorName (GLFWmonitor *monitor)
 Returns the name of the specified monitor. More...
 
void glfwSetMonitorUserPointer (GLFWmonitor *monitor, void *pointer)
 Sets the user pointer of the specified monitor. More...
 
void * glfwGetMonitorUserPointer (GLFWmonitor *monitor)
 Returns the user pointer of the specified monitor. More...
 
GLFWmonitorfun glfwSetMonitorCallback (GLFWmonitorfun callback)
 Sets the monitor configuration callback. More...
 
const GLFWvidmodeglfwGetVideoModes (GLFWmonitor *monitor, int *count)
 Returns the available video modes for the specified monitor. More...
 
const GLFWvidmodeglfwGetVideoMode (GLFWmonitor *monitor)
 Returns the current mode of the specified monitor. More...
 
void glfwSetGamma (GLFWmonitor *monitor, float gamma)
 Generates a gamma ramp and sets it for the specified monitor. More...
 
const GLFWgammarampglfwGetGammaRamp (GLFWmonitor *monitor)
 Returns the current gamma ramp for the specified monitor. More...
 
void glfwSetGammaRamp (GLFWmonitor *monitor, const GLFWgammaramp *ramp)
 Sets the current gamma ramp for the specified monitor. More...
 
void glfwDefaultWindowHints (void)
 Resets all window hints to their default values. More...
 
void glfwWindowHint (int hint, int value)
 Sets the specified window hint to the desired value. More...
 
void glfwWindowHintString (int hint, const char *value)
 Sets the specified window hint to the desired value. More...
 
GLFWwindowglfwCreateWindow (int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
 Creates a window and its associated context. More...
 
void glfwDestroyWindow (GLFWwindow *window)
 Destroys the specified window and its context. More...
 
int glfwWindowShouldClose (GLFWwindow *window)
 Checks the close flag of the specified window. More...
 
void glfwSetWindowShouldClose (GLFWwindow *window, int value)
 Sets the close flag of the specified window. More...
 
void glfwSetWindowTitle (GLFWwindow *window, const char *title)
 Sets the title of the specified window. More...
 
void glfwSetWindowIcon (GLFWwindow *window, int count, const GLFWimage *images)
 Sets the icon for the specified window. More...
 
void glfwGetWindowPos (GLFWwindow *window, int *xpos, int *ypos)
 Retrieves the position of the content area of the specified window. More...
 
void glfwSetWindowPos (GLFWwindow *window, int xpos, int ypos)
 Sets the position of the content area of the specified window. More...
 
void glfwGetWindowSize (GLFWwindow *window, int *width, int *height)
 Retrieves the size of the content area of the specified window. More...
 
void glfwSetWindowSizeLimits (GLFWwindow *window, int minwidth, int minheight, int maxwidth, int maxheight)
 Sets the size limits of the specified window. More...
 
void glfwSetWindowAspectRatio (GLFWwindow *window, int numer, int denom)
 Sets the aspect ratio of the specified window. More...
 
void glfwSetWindowSize (GLFWwindow *window, int width, int height)
 Sets the size of the content area of the specified window. More...
 
void glfwGetFramebufferSize (GLFWwindow *window, int *width, int *height)
 Retrieves the size of the framebuffer of the specified window. More...
 
void glfwGetWindowFrameSize (GLFWwindow *window, int *left, int *top, int *right, int *bottom)
 Retrieves the size of the frame of the window. More...
 
void glfwGetWindowContentScale (GLFWwindow *window, float *xscale, float *yscale)
 Retrieves the content scale for the specified window. More...
 
float glfwGetWindowOpacity (GLFWwindow *window)
 Returns the opacity of the whole window. More...
 
void glfwSetWindowOpacity (GLFWwindow *window, float opacity)
 Sets the opacity of the whole window. More...
 
void glfwIconifyWindow (GLFWwindow *window)
 Iconifies the specified window. More...
 
void glfwRestoreWindow (GLFWwindow *window)
 Restores the specified window. More...
 
void glfwMaximizeWindow (GLFWwindow *window)
 Maximizes the specified window. More...
 
void glfwShowWindow (GLFWwindow *window)
 Makes the specified window visible. More...
 
void glfwHideWindow (GLFWwindow *window)
 Hides the specified window. More...
 
void glfwFocusWindow (GLFWwindow *window)
 Brings the specified window to front and sets input focus. More...
 
void glfwRequestWindowAttention (GLFWwindow *window)
 Requests user attention to the specified window. More...
 
GLFWmonitorglfwGetWindowMonitor (GLFWwindow *window)
 Returns the monitor that the window uses for full screen mode. More...
 
void glfwSetWindowMonitor (GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)
 Sets the mode, monitor, video mode and placement of a window. More...
 
int glfwGetWindowAttrib (GLFWwindow *window, int attrib)
 Returns an attribute of the specified window. More...
 
void glfwSetWindowAttrib (GLFWwindow *window, int attrib, int value)
 Sets an attribute of the specified window. More...
 
void glfwSetWindowUserPointer (GLFWwindow *window, void *pointer)
 Sets the user pointer of the specified window. More...
 
void * glfwGetWindowUserPointer (GLFWwindow *window)
 Returns the user pointer of the specified window. More...
 
GLFWwindowposfun glfwSetWindowPosCallback (GLFWwindow *window, GLFWwindowposfun callback)
 Sets the position callback for the specified window. More...
 
GLFWwindowsizefun glfwSetWindowSizeCallback (GLFWwindow *window, GLFWwindowsizefun callback)
 Sets the size callback for the specified window. More...
 
GLFWwindowclosefun glfwSetWindowCloseCallback (GLFWwindow *window, GLFWwindowclosefun callback)
 Sets the close callback for the specified window. More...
 
GLFWwindowrefreshfun glfwSetWindowRefreshCallback (GLFWwindow *window, GLFWwindowrefreshfun callback)
 Sets the refresh callback for the specified window. More...
 
GLFWwindowfocusfun glfwSetWindowFocusCallback (GLFWwindow *window, GLFWwindowfocusfun callback)
 Sets the focus callback for the specified window. More...
 
GLFWwindowiconifyfun glfwSetWindowIconifyCallback (GLFWwindow *window, GLFWwindowiconifyfun callback)
 Sets the iconify callback for the specified window. More...
 
GLFWwindowmaximizefun glfwSetWindowMaximizeCallback (GLFWwindow *window, GLFWwindowmaximizefun callback)
 Sets the maximize callback for the specified window. More...
 
GLFWframebuffersizefun glfwSetFramebufferSizeCallback (GLFWwindow *window, GLFWframebuffersizefun callback)
 Sets the framebuffer resize callback for the specified window. More...
 
GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback (GLFWwindow *window, GLFWwindowcontentscalefun callback)
 Sets the window content scale callback for the specified window. More...
 
void glfwPollEvents (void)
 Processes all pending events. More...
 
void glfwWaitEvents (void)
 Waits until events are queued and processes them. More...
 
void glfwWaitEventsTimeout (double timeout)
 Waits with timeout until events are queued and processes them. More...
 
void glfwPostEmptyEvent (void)
 Posts an empty event to the event queue. More...
 
int glfwGetInputMode (GLFWwindow *window, int mode)
 Returns the value of an input option for the specified window. More...
 
void glfwSetInputMode (GLFWwindow *window, int mode, int value)
 Sets an input option for the specified window. More...
 
int glfwRawMouseMotionSupported (void)
 Returns whether raw mouse motion is supported. More...
 
const char * glfwGetKeyName (int key, int scancode)
 Returns the layout-specific name of the specified printable key. More...
 
int glfwGetKeyScancode (int key)
 Returns the platform-specific scancode of the specified key. More...
 
int glfwGetKey (GLFWwindow *window, int key)
 Returns the last reported state of a keyboard key for the specified window. More...
 
int glfwGetMouseButton (GLFWwindow *window, int button)
 Returns the last reported state of a mouse button for the specified window. More...
 
void glfwGetCursorPos (GLFWwindow *window, double *xpos, double *ypos)
 Retrieves the position of the cursor relative to the content area of the window. More...
 
void glfwSetCursorPos (GLFWwindow *window, double xpos, double ypos)
 Sets the position of the cursor, relative to the content area of the window. More...
 
GLFWcursorglfwCreateCursor (const GLFWimage *image, int xhot, int yhot)
 Creates a custom cursor. More...
 
GLFWcursorglfwCreateStandardCursor (int shape)
 Creates a cursor with a standard shape. More...
 
void glfwDestroyCursor (GLFWcursor *cursor)
 Destroys a cursor. More...
 
void glfwSetCursor (GLFWwindow *window, GLFWcursor *cursor)
 Sets the cursor for the window. More...
 
GLFWkeyfun glfwSetKeyCallback (GLFWwindow *window, GLFWkeyfun callback)
 Sets the key callback. More...
 
GLFWcharfun glfwSetCharCallback (GLFWwindow *window, GLFWcharfun callback)
 Sets the Unicode character callback. More...
 
GLFWcharmodsfun glfwSetCharModsCallback (GLFWwindow *window, GLFWcharmodsfun callback)
 Sets the Unicode character with modifiers callback. More...
 
GLFWmousebuttonfun glfwSetMouseButtonCallback (GLFWwindow *window, GLFWmousebuttonfun callback)
 Sets the mouse button callback. More...
 
GLFWcursorposfun glfwSetCursorPosCallback (GLFWwindow *window, GLFWcursorposfun callback)
 Sets the cursor position callback. More...
 
GLFWcursorenterfun glfwSetCursorEnterCallback (GLFWwindow *window, GLFWcursorenterfun callback)
 Sets the cursor enter/leave callback. More...
 
GLFWscrollfun glfwSetScrollCallback (GLFWwindow *window, GLFWscrollfun callback)
 Sets the scroll callback. More...
 
GLFWdropfun glfwSetDropCallback (GLFWwindow *window, GLFWdropfun callback)
 Sets the path drop callback. More...
 
int glfwJoystickPresent (int jid)
 Returns whether the specified joystick is present. More...
 
const float * glfwGetJoystickAxes (int jid, int *count)
 Returns the values of all axes of the specified joystick. More...
 
const unsigned char * glfwGetJoystickButtons (int jid, int *count)
 Returns the state of all buttons of the specified joystick. More...
 
const unsigned char * glfwGetJoystickHats (int jid, int *count)
 Returns the state of all hats of the specified joystick. More...
 
const char * glfwGetJoystickName (int jid)
 Returns the name of the specified joystick. More...
 
const char * glfwGetJoystickGUID (int jid)
 Returns the SDL compatible GUID of the specified joystick. More...
 
void glfwSetJoystickUserPointer (int jid, void *pointer)
 Sets the user pointer of the specified joystick. More...
 
void * glfwGetJoystickUserPointer (int jid)
 Returns the user pointer of the specified joystick. More...
 
int glfwJoystickIsGamepad (int jid)
 Returns whether the specified joystick has a gamepad mapping. More...
 
GLFWjoystickfun glfwSetJoystickCallback (GLFWjoystickfun callback)
 Sets the joystick configuration callback. More...
 
int glfwUpdateGamepadMappings (const char *string)
 Adds the specified SDL_GameControllerDB gamepad mappings. More...
 
const char * glfwGetGamepadName (int jid)
 Returns the human-readable gamepad name for the specified joystick. More...
 
int glfwGetGamepadState (int jid, GLFWgamepadstate *state)
 Retrieves the state of the specified joystick remapped as a gamepad. More...
 
void glfwSetClipboardString (GLFWwindow *window, const char *string)
 Sets the clipboard to the specified string. More...
 
const char * glfwGetClipboardString (GLFWwindow *window)
 Returns the contents of the clipboard as a string. More...
 
double glfwGetTime (void)
 Returns the GLFW time. More...
 
void glfwSetTime (double time)
 Sets the GLFW time. More...
 
uint64_t glfwGetTimerValue (void)
 Returns the current value of the raw timer. More...
 
uint64_t glfwGetTimerFrequency (void)
 Returns the frequency, in Hz, of the raw timer. More...
 
void glfwMakeContextCurrent (GLFWwindow *window)
 Makes the context of the specified window current for the calling thread. More...
 
GLFWwindowglfwGetCurrentContext (void)
 Returns the window whose context is current on the calling thread. More...
 
void glfwSwapBuffers (GLFWwindow *window)
 Swaps the front and back buffers of the specified window. More...
 
void glfwSwapInterval (int interval)
 Sets the swap interval for the current context. More...
 
int glfwExtensionSupported (const char *extension)
 Returns whether the specified extension is available. More...
 
GLFWglproc glfwGetProcAddress (const char *procname)
 Returns the address of the specified function for the current context. More...
 
int glfwVulkanSupported (void)
 Returns whether the Vulkan loader and an ICD have been found. More...
 
const char ** glfwGetRequiredInstanceExtensions (uint32_t *count)
 Returns the Vulkan instance extensions required by GLFW. More...
 
GLFWvkproc glfwGetInstanceProcAddress (VkInstance instance, const char *procname)
 Returns the address of the specified Vulkan instance function. More...
 
int glfwGetPhysicalDevicePresentationSupport (VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily)
 Returns whether the specified queue family can present images. More...
 
VkResult glfwCreateWindowSurface (VkInstance instance, GLFWwindow *window, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
 Creates a Vulkan surface for the specified window. More...
 

Macro Definition Documentation

◆ GLFW_APIENTRY_DEFINED

#define GLFW_APIENTRY_DEFINED

◆ GLFW_NO_API

#define GLFW_NO_API   0

◆ GLFW_OPENGL_API

#define GLFW_OPENGL_API   0x00030001

◆ GLFW_OPENGL_ES_API

#define GLFW_OPENGL_ES_API   0x00030002

◆ GLFW_NO_ROBUSTNESS

#define GLFW_NO_ROBUSTNESS   0

◆ GLFW_NO_RESET_NOTIFICATION

#define GLFW_NO_RESET_NOTIFICATION   0x00031001

◆ GLFW_LOSE_CONTEXT_ON_RESET

#define GLFW_LOSE_CONTEXT_ON_RESET   0x00031002

◆ GLFW_OPENGL_ANY_PROFILE

#define GLFW_OPENGL_ANY_PROFILE   0

◆ GLFW_OPENGL_CORE_PROFILE

#define GLFW_OPENGL_CORE_PROFILE   0x00032001

◆ GLFW_OPENGL_COMPAT_PROFILE

#define GLFW_OPENGL_COMPAT_PROFILE   0x00032002

◆ GLFW_CURSOR

#define GLFW_CURSOR   0x00033001

◆ GLFW_STICKY_KEYS

#define GLFW_STICKY_KEYS   0x00033002

◆ GLFW_STICKY_MOUSE_BUTTONS

#define GLFW_STICKY_MOUSE_BUTTONS   0x00033003

◆ GLFW_LOCK_KEY_MODS

#define GLFW_LOCK_KEY_MODS   0x00033004

◆ GLFW_RAW_MOUSE_MOTION

#define GLFW_RAW_MOUSE_MOTION   0x00033005

◆ GLFW_CURSOR_NORMAL

#define GLFW_CURSOR_NORMAL   0x00034001

◆ GLFW_CURSOR_HIDDEN

#define GLFW_CURSOR_HIDDEN   0x00034002

◆ GLFW_CURSOR_DISABLED

#define GLFW_CURSOR_DISABLED   0x00034003

◆ GLFW_ANY_RELEASE_BEHAVIOR

#define GLFW_ANY_RELEASE_BEHAVIOR   0

◆ GLFW_RELEASE_BEHAVIOR_FLUSH

#define GLFW_RELEASE_BEHAVIOR_FLUSH   0x00035001

◆ GLFW_RELEASE_BEHAVIOR_NONE

#define GLFW_RELEASE_BEHAVIOR_NONE   0x00035002

◆ GLFW_NATIVE_CONTEXT_API

#define GLFW_NATIVE_CONTEXT_API   0x00036001

◆ GLFW_EGL_CONTEXT_API

#define GLFW_EGL_CONTEXT_API   0x00036002

◆ GLFW_OSMESA_CONTEXT_API

#define GLFW_OSMESA_CONTEXT_API   0x00036003

◆ GLFW_CONNECTED

#define GLFW_CONNECTED   0x00040001

◆ GLFW_DISCONNECTED

#define GLFW_DISCONNECTED   0x00040002

◆ GLFW_DONT_CARE

#define GLFW_DONT_CARE   -1

◆ GLAPIENTRY

#define GLAPIENTRY   APIENTRY
================================================ FILE: thirdparty/glfw/docs/html/glfw3_8h_source.html ================================================ GLFW: glfw3.h Source File
glfw3.h
Go to the documentation of this file.
1 /*************************************************************************
2  * GLFW 3.3 - www.glfw.org
3  * A library for OpenGL, window and input
4  *------------------------------------------------------------------------
5  * Copyright (c) 2002-2006 Marcus Geelnard
6  * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
7  *
8  * This software is provided 'as-is', without any express or implied
9  * warranty. In no event will the authors be held liable for any damages
10  * arising from the use of this software.
11  *
12  * Permission is granted to anyone to use this software for any purpose,
13  * including commercial applications, and to alter it and redistribute it
14  * freely, subject to the following restrictions:
15  *
16  * 1. The origin of this software must not be misrepresented; you must not
17  * claim that you wrote the original software. If you use this software
18  * in a product, an acknowledgment in the product documentation would
19  * be appreciated but is not required.
20  *
21  * 2. Altered source versions must be plainly marked as such, and must not
22  * be misrepresented as being the original software.
23  *
24  * 3. This notice may not be removed or altered from any source
25  * distribution.
26  *
27  *************************************************************************/
28 
29 #ifndef _glfw3_h_
30 #define _glfw3_h_
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*************************************************************************
38  * Doxygen documentation
39  *************************************************************************/
40 
89 /*************************************************************************
90  * Compiler- and platform-specific preprocessor work
91  *************************************************************************/
92 
93 /* If we are we on Windows, we want a single define for it.
94  */
95 #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
96  #define _WIN32
97 #endif /* _WIN32 */
98 
99 /* Include because most Windows GLU headers need wchar_t and
100  * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
101  * Include it unconditionally to avoid surprising side-effects.
102  */
103 #include <stddef.h>
104 
105 /* Include because it is needed by Vulkan and related functions.
106  * Include it unconditionally to avoid surprising side-effects.
107  */
108 #include <stdint.h>
109 
110 #if defined(GLFW_INCLUDE_VULKAN)
111  #include <vulkan/vulkan.h>
112 #endif /* Vulkan header */
113 
114 /* The Vulkan header may have indirectly included windows.h (because of
115  * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.
116  */
117 
118 /* It is customary to use APIENTRY for OpenGL function pointer declarations on
119  * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
120  */
121 #if !defined(APIENTRY)
122  #if defined(_WIN32)
123  #define APIENTRY __stdcall
124  #else
125  #define APIENTRY
126  #endif
127  #define GLFW_APIENTRY_DEFINED
128 #endif /* APIENTRY */
129 
130 /* Some Windows OpenGL headers need this.
131  */
132 #if !defined(WINGDIAPI) && defined(_WIN32)
133  #define WINGDIAPI __declspec(dllimport)
134  #define GLFW_WINGDIAPI_DEFINED
135 #endif /* WINGDIAPI */
136 
137 /* Some Windows GLU headers need this.
138  */
139 #if !defined(CALLBACK) && defined(_WIN32)
140  #define CALLBACK __stdcall
141  #define GLFW_CALLBACK_DEFINED
142 #endif /* CALLBACK */
143 
144 /* Include the chosen OpenGL or OpenGL ES headers.
145  */
146 #if defined(GLFW_INCLUDE_ES1)
147 
148  #include <GLES/gl.h>
149  #if defined(GLFW_INCLUDE_GLEXT)
150  #include <GLES/glext.h>
151  #endif
152 
153 #elif defined(GLFW_INCLUDE_ES2)
154 
155  #include <GLES2/gl2.h>
156  #if defined(GLFW_INCLUDE_GLEXT)
157  #include <GLES2/gl2ext.h>
158  #endif
159 
160 #elif defined(GLFW_INCLUDE_ES3)
161 
162  #include <GLES3/gl3.h>
163  #if defined(GLFW_INCLUDE_GLEXT)
164  #include <GLES2/gl2ext.h>
165  #endif
166 
167 #elif defined(GLFW_INCLUDE_ES31)
168 
169  #include <GLES3/gl31.h>
170  #if defined(GLFW_INCLUDE_GLEXT)
171  #include <GLES2/gl2ext.h>
172  #endif
173 
174 #elif defined(GLFW_INCLUDE_ES32)
175 
176  #include <GLES3/gl32.h>
177  #if defined(GLFW_INCLUDE_GLEXT)
178  #include <GLES2/gl2ext.h>
179  #endif
180 
181 #elif defined(GLFW_INCLUDE_GLCOREARB)
182 
183  #if defined(__APPLE__)
184 
185  #include <OpenGL/gl3.h>
186  #if defined(GLFW_INCLUDE_GLEXT)
187  #include <OpenGL/gl3ext.h>
188  #endif /*GLFW_INCLUDE_GLEXT*/
189 
190  #else /*__APPLE__*/
191 
192  #include <GL/glcorearb.h>
193 
194  #endif /*__APPLE__*/
195 
196 #elif !defined(GLFW_INCLUDE_NONE)
197 
198  #if defined(__APPLE__)
199 
200  #if !defined(GLFW_INCLUDE_GLEXT)
201  #define GL_GLEXT_LEGACY
202  #endif
203  #include <OpenGL/gl.h>
204  #if defined(GLFW_INCLUDE_GLU)
205  #include <OpenGL/glu.h>
206  #endif
207 
208  #else /*__APPLE__*/
209 
210  #include <GL/gl.h>
211  #if defined(GLFW_INCLUDE_GLEXT)
212  #include <GL/glext.h>
213  #endif
214  #if defined(GLFW_INCLUDE_GLU)
215  #include <GL/glu.h>
216  #endif
217 
218  #endif /*__APPLE__*/
219 
220 #endif /* OpenGL and OpenGL ES headers */
221 
222 #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
223  /* GLFW_DLL must be defined by applications that are linking against the DLL
224  * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
225  * configuration header when compiling the DLL version of the library.
226  */
227  #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
228 #endif
229 
230 /* GLFWAPI is used to declare public API functions for export
231  * from the DLL / shared library / dynamic library.
232  */
233 #if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
234  /* We are building GLFW as a Win32 DLL */
235  #define GLFWAPI __declspec(dllexport)
236 #elif defined(_WIN32) && defined(GLFW_DLL)
237  /* We are calling GLFW as a Win32 DLL */
238  #define GLFWAPI __declspec(dllimport)
239 #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
240  /* We are building GLFW as a shared / dynamic library */
241  #define GLFWAPI __attribute__((visibility("default")))
242 #else
243  /* We are building or calling GLFW as a static library */
244  #define GLFWAPI
245 #endif
246 
247 
248 /*************************************************************************
249  * GLFW API tokens
250  *************************************************************************/
251 
259 #define GLFW_VERSION_MAJOR 3
260 
266 #define GLFW_VERSION_MINOR 3
267 
273 #define GLFW_VERSION_REVISION 2
274 
284 #define GLFW_TRUE 1
285 
293 #define GLFW_FALSE 0
294 
303 #define GLFW_RELEASE 0
304 
310 #define GLFW_PRESS 1
311 
317 #define GLFW_REPEAT 2
318 
327 #define GLFW_HAT_CENTERED 0
328 #define GLFW_HAT_UP 1
329 #define GLFW_HAT_RIGHT 2
330 #define GLFW_HAT_DOWN 4
331 #define GLFW_HAT_LEFT 8
332 #define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)
333 #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
334 #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
335 #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
336 
362 /* The unknown key */
363 #define GLFW_KEY_UNKNOWN -1
364 
365 /* Printable keys */
366 #define GLFW_KEY_SPACE 32
367 #define GLFW_KEY_APOSTROPHE 39 /* ' */
368 #define GLFW_KEY_COMMA 44 /* , */
369 #define GLFW_KEY_MINUS 45 /* - */
370 #define GLFW_KEY_PERIOD 46 /* . */
371 #define GLFW_KEY_SLASH 47 /* / */
372 #define GLFW_KEY_0 48
373 #define GLFW_KEY_1 49
374 #define GLFW_KEY_2 50
375 #define GLFW_KEY_3 51
376 #define GLFW_KEY_4 52
377 #define GLFW_KEY_5 53
378 #define GLFW_KEY_6 54
379 #define GLFW_KEY_7 55
380 #define GLFW_KEY_8 56
381 #define GLFW_KEY_9 57
382 #define GLFW_KEY_SEMICOLON 59 /* ; */
383 #define GLFW_KEY_EQUAL 61 /* = */
384 #define GLFW_KEY_A 65
385 #define GLFW_KEY_B 66
386 #define GLFW_KEY_C 67
387 #define GLFW_KEY_D 68
388 #define GLFW_KEY_E 69
389 #define GLFW_KEY_F 70
390 #define GLFW_KEY_G 71
391 #define GLFW_KEY_H 72
392 #define GLFW_KEY_I 73
393 #define GLFW_KEY_J 74
394 #define GLFW_KEY_K 75
395 #define GLFW_KEY_L 76
396 #define GLFW_KEY_M 77
397 #define GLFW_KEY_N 78
398 #define GLFW_KEY_O 79
399 #define GLFW_KEY_P 80
400 #define GLFW_KEY_Q 81
401 #define GLFW_KEY_R 82
402 #define GLFW_KEY_S 83
403 #define GLFW_KEY_T 84
404 #define GLFW_KEY_U 85
405 #define GLFW_KEY_V 86
406 #define GLFW_KEY_W 87
407 #define GLFW_KEY_X 88
408 #define GLFW_KEY_Y 89
409 #define GLFW_KEY_Z 90
410 #define GLFW_KEY_LEFT_BRACKET 91 /* [ */
411 #define GLFW_KEY_BACKSLASH 92 /* \ */
412 #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
413 #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
414 #define GLFW_KEY_WORLD_1 161 /* non-US #1 */
415 #define GLFW_KEY_WORLD_2 162 /* non-US #2 */
416 
417 /* Function keys */
418 #define GLFW_KEY_ESCAPE 256
419 #define GLFW_KEY_ENTER 257
420 #define GLFW_KEY_TAB 258
421 #define GLFW_KEY_BACKSPACE 259
422 #define GLFW_KEY_INSERT 260
423 #define GLFW_KEY_DELETE 261
424 #define GLFW_KEY_RIGHT 262
425 #define GLFW_KEY_LEFT 263
426 #define GLFW_KEY_DOWN 264
427 #define GLFW_KEY_UP 265
428 #define GLFW_KEY_PAGE_UP 266
429 #define GLFW_KEY_PAGE_DOWN 267
430 #define GLFW_KEY_HOME 268
431 #define GLFW_KEY_END 269
432 #define GLFW_KEY_CAPS_LOCK 280
433 #define GLFW_KEY_SCROLL_LOCK 281
434 #define GLFW_KEY_NUM_LOCK 282
435 #define GLFW_KEY_PRINT_SCREEN 283
436 #define GLFW_KEY_PAUSE 284
437 #define GLFW_KEY_F1 290
438 #define GLFW_KEY_F2 291
439 #define GLFW_KEY_F3 292
440 #define GLFW_KEY_F4 293
441 #define GLFW_KEY_F5 294
442 #define GLFW_KEY_F6 295
443 #define GLFW_KEY_F7 296
444 #define GLFW_KEY_F8 297
445 #define GLFW_KEY_F9 298
446 #define GLFW_KEY_F10 299
447 #define GLFW_KEY_F11 300
448 #define GLFW_KEY_F12 301
449 #define GLFW_KEY_F13 302
450 #define GLFW_KEY_F14 303
451 #define GLFW_KEY_F15 304
452 #define GLFW_KEY_F16 305
453 #define GLFW_KEY_F17 306
454 #define GLFW_KEY_F18 307
455 #define GLFW_KEY_F19 308
456 #define GLFW_KEY_F20 309
457 #define GLFW_KEY_F21 310
458 #define GLFW_KEY_F22 311
459 #define GLFW_KEY_F23 312
460 #define GLFW_KEY_F24 313
461 #define GLFW_KEY_F25 314
462 #define GLFW_KEY_KP_0 320
463 #define GLFW_KEY_KP_1 321
464 #define GLFW_KEY_KP_2 322
465 #define GLFW_KEY_KP_3 323
466 #define GLFW_KEY_KP_4 324
467 #define GLFW_KEY_KP_5 325
468 #define GLFW_KEY_KP_6 326
469 #define GLFW_KEY_KP_7 327
470 #define GLFW_KEY_KP_8 328
471 #define GLFW_KEY_KP_9 329
472 #define GLFW_KEY_KP_DECIMAL 330
473 #define GLFW_KEY_KP_DIVIDE 331
474 #define GLFW_KEY_KP_MULTIPLY 332
475 #define GLFW_KEY_KP_SUBTRACT 333
476 #define GLFW_KEY_KP_ADD 334
477 #define GLFW_KEY_KP_ENTER 335
478 #define GLFW_KEY_KP_EQUAL 336
479 #define GLFW_KEY_LEFT_SHIFT 340
480 #define GLFW_KEY_LEFT_CONTROL 341
481 #define GLFW_KEY_LEFT_ALT 342
482 #define GLFW_KEY_LEFT_SUPER 343
483 #define GLFW_KEY_RIGHT_SHIFT 344
484 #define GLFW_KEY_RIGHT_CONTROL 345
485 #define GLFW_KEY_RIGHT_ALT 346
486 #define GLFW_KEY_RIGHT_SUPER 347
487 #define GLFW_KEY_MENU 348
488 
489 #define GLFW_KEY_LAST GLFW_KEY_MENU
490 
505 #define GLFW_MOD_SHIFT 0x0001
506 
510 #define GLFW_MOD_CONTROL 0x0002
511 
515 #define GLFW_MOD_ALT 0x0004
516 
520 #define GLFW_MOD_SUPER 0x0008
521 
526 #define GLFW_MOD_CAPS_LOCK 0x0010
527 
532 #define GLFW_MOD_NUM_LOCK 0x0020
533 
543 #define GLFW_MOUSE_BUTTON_1 0
544 #define GLFW_MOUSE_BUTTON_2 1
545 #define GLFW_MOUSE_BUTTON_3 2
546 #define GLFW_MOUSE_BUTTON_4 3
547 #define GLFW_MOUSE_BUTTON_5 4
548 #define GLFW_MOUSE_BUTTON_6 5
549 #define GLFW_MOUSE_BUTTON_7 6
550 #define GLFW_MOUSE_BUTTON_8 7
551 #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
552 #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
553 #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
554 #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
555 
564 #define GLFW_JOYSTICK_1 0
565 #define GLFW_JOYSTICK_2 1
566 #define GLFW_JOYSTICK_3 2
567 #define GLFW_JOYSTICK_4 3
568 #define GLFW_JOYSTICK_5 4
569 #define GLFW_JOYSTICK_6 5
570 #define GLFW_JOYSTICK_7 6
571 #define GLFW_JOYSTICK_8 7
572 #define GLFW_JOYSTICK_9 8
573 #define GLFW_JOYSTICK_10 9
574 #define GLFW_JOYSTICK_11 10
575 #define GLFW_JOYSTICK_12 11
576 #define GLFW_JOYSTICK_13 12
577 #define GLFW_JOYSTICK_14 13
578 #define GLFW_JOYSTICK_15 14
579 #define GLFW_JOYSTICK_16 15
580 #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
581 
590 #define GLFW_GAMEPAD_BUTTON_A 0
591 #define GLFW_GAMEPAD_BUTTON_B 1
592 #define GLFW_GAMEPAD_BUTTON_X 2
593 #define GLFW_GAMEPAD_BUTTON_Y 3
594 #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4
595 #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5
596 #define GLFW_GAMEPAD_BUTTON_BACK 6
597 #define GLFW_GAMEPAD_BUTTON_START 7
598 #define GLFW_GAMEPAD_BUTTON_GUIDE 8
599 #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9
600 #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10
601 #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11
602 #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12
603 #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13
604 #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14
605 #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT
606 
607 #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A
608 #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B
609 #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X
610 #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y
611 
620 #define GLFW_GAMEPAD_AXIS_LEFT_X 0
621 #define GLFW_GAMEPAD_AXIS_LEFT_Y 1
622 #define GLFW_GAMEPAD_AXIS_RIGHT_X 2
623 #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3
624 #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4
625 #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
626 #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
627 
642 #define GLFW_NO_ERROR 0
643 
651 #define GLFW_NOT_INITIALIZED 0x00010001
652 
661 #define GLFW_NO_CURRENT_CONTEXT 0x00010002
662 
669 #define GLFW_INVALID_ENUM 0x00010003
670 
680 #define GLFW_INVALID_VALUE 0x00010004
681 
688 #define GLFW_OUT_OF_MEMORY 0x00010005
689 
704 #define GLFW_API_UNAVAILABLE 0x00010006
705 
721 #define GLFW_VERSION_UNAVAILABLE 0x00010007
722 
732 #define GLFW_PLATFORM_ERROR 0x00010008
733 
751 #define GLFW_FORMAT_UNAVAILABLE 0x00010009
752 
759 #define GLFW_NO_WINDOW_CONTEXT 0x0001000A
760 
769 #define GLFW_FOCUSED 0x00020001
770 
774 #define GLFW_ICONIFIED 0x00020002
775 
780 #define GLFW_RESIZABLE 0x00020003
781 
786 #define GLFW_VISIBLE 0x00020004
787 
792 #define GLFW_DECORATED 0x00020005
793 
798 #define GLFW_AUTO_ICONIFY 0x00020006
799 
804 #define GLFW_FLOATING 0x00020007
805 
810 #define GLFW_MAXIMIZED 0x00020008
811 
815 #define GLFW_CENTER_CURSOR 0x00020009
816 
822 #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
823 
827 #define GLFW_HOVERED 0x0002000B
828 
833 #define GLFW_FOCUS_ON_SHOW 0x0002000C
834 
839 #define GLFW_RED_BITS 0x00021001
840 
844 #define GLFW_GREEN_BITS 0x00021002
845 
849 #define GLFW_BLUE_BITS 0x00021003
850 
854 #define GLFW_ALPHA_BITS 0x00021004
855 
859 #define GLFW_DEPTH_BITS 0x00021005
860 
864 #define GLFW_STENCIL_BITS 0x00021006
865 
869 #define GLFW_ACCUM_RED_BITS 0x00021007
870 
874 #define GLFW_ACCUM_GREEN_BITS 0x00021008
875 
879 #define GLFW_ACCUM_BLUE_BITS 0x00021009
880 
884 #define GLFW_ACCUM_ALPHA_BITS 0x0002100A
885 
889 #define GLFW_AUX_BUFFERS 0x0002100B
890 
894 #define GLFW_STEREO 0x0002100C
895 
899 #define GLFW_SAMPLES 0x0002100D
900 
904 #define GLFW_SRGB_CAPABLE 0x0002100E
905 
909 #define GLFW_REFRESH_RATE 0x0002100F
910 
914 #define GLFW_DOUBLEBUFFER 0x00021010
915 
921 #define GLFW_CLIENT_API 0x00022001
922 
927 #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
928 
933 #define GLFW_CONTEXT_VERSION_MINOR 0x00022003
934 
939 #define GLFW_CONTEXT_REVISION 0x00022004
940 
945 #define GLFW_CONTEXT_ROBUSTNESS 0x00022005
946 
951 #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
952 
957 #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
958 
963 #define GLFW_OPENGL_PROFILE 0x00022008
964 
969 #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
970 
975 #define GLFW_CONTEXT_NO_ERROR 0x0002200A
976 
981 #define GLFW_CONTEXT_CREATION_API 0x0002200B
982 
985 #define GLFW_SCALE_TO_MONITOR 0x0002200C
986 
989 #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
990 
993 #define GLFW_COCOA_FRAME_NAME 0x00023002
994 
997 #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
998 
1001 #define GLFW_X11_CLASS_NAME 0x00024001
1002 
1005 #define GLFW_X11_INSTANCE_NAME 0x00024002
1008 #define GLFW_NO_API 0
1009 #define GLFW_OPENGL_API 0x00030001
1010 #define GLFW_OPENGL_ES_API 0x00030002
1011 
1012 #define GLFW_NO_ROBUSTNESS 0
1013 #define GLFW_NO_RESET_NOTIFICATION 0x00031001
1014 #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
1015 
1016 #define GLFW_OPENGL_ANY_PROFILE 0
1017 #define GLFW_OPENGL_CORE_PROFILE 0x00032001
1018 #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
1020 #define GLFW_CURSOR 0x00033001
1021 #define GLFW_STICKY_KEYS 0x00033002
1022 #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
1023 #define GLFW_LOCK_KEY_MODS 0x00033004
1024 #define GLFW_RAW_MOUSE_MOTION 0x00033005
1025 
1026 #define GLFW_CURSOR_NORMAL 0x00034001
1027 #define GLFW_CURSOR_HIDDEN 0x00034002
1028 #define GLFW_CURSOR_DISABLED 0x00034003
1029 
1030 #define GLFW_ANY_RELEASE_BEHAVIOR 0
1031 #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
1032 #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
1033 
1034 #define GLFW_NATIVE_CONTEXT_API 0x00036001
1035 #define GLFW_EGL_CONTEXT_API 0x00036002
1036 #define GLFW_OSMESA_CONTEXT_API 0x00036003
1037 
1050 #define GLFW_ARROW_CURSOR 0x00036001
1055 #define GLFW_IBEAM_CURSOR 0x00036002
1060 #define GLFW_CROSSHAIR_CURSOR 0x00036003
1065 #define GLFW_HAND_CURSOR 0x00036004
1070 #define GLFW_HRESIZE_CURSOR 0x00036005
1075 #define GLFW_VRESIZE_CURSOR 0x00036006
1076 
1078 #define GLFW_CONNECTED 0x00040001
1079 #define GLFW_DISCONNECTED 0x00040002
1080 
1087 #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001
1092 #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001
1097 #define GLFW_COCOA_MENUBAR 0x00051002
1098 
1100 #define GLFW_DONT_CARE -1
1101 
1102 
1103 /*************************************************************************
1104  * GLFW API types
1105  *************************************************************************/
1106 
1119 typedef void (*GLFWglproc)(void);
1120 
1133 typedef void (*GLFWvkproc)(void);
1134 
1145 typedef struct GLFWmonitor GLFWmonitor;
1146 
1157 typedef struct GLFWwindow GLFWwindow;
1158 
1169 typedef struct GLFWcursor GLFWcursor;
1170 
1193 typedef void (* GLFWerrorfun)(int,const char*);
1194 
1216 typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
1217 
1238 typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
1239 
1258 typedef void (* GLFWwindowclosefun)(GLFWwindow*);
1259 
1278 typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
1279 
1299 typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
1300 
1320 typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
1321 
1341 typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
1342 
1362 typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
1363 
1383 typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
1384 
1409 typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
1410 
1432 typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
1433 
1453 typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
1454 
1474 typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
1475 
1500 typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
1501 
1521 typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
1522 
1548 typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1549 
1572 typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
1573 
1593 typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
1594 
1614 typedef void (* GLFWjoystickfun)(int,int);
1615 
1629 typedef struct GLFWvidmode
1630 {
1633  int width;
1636  int height;
1639  int redBits;
1642  int greenBits;
1645  int blueBits;
1648  int refreshRate;
1649 } GLFWvidmode;
1650 
1663 typedef struct GLFWgammaramp
1664 {
1667  unsigned short* red;
1670  unsigned short* green;
1673  unsigned short* blue;
1676  unsigned int size;
1677 } GLFWgammaramp;
1678 
1692 typedef struct GLFWimage
1693 {
1696  int width;
1699  int height;
1702  unsigned char* pixels;
1703 } GLFWimage;
1704 
1716 typedef struct GLFWgamepadstate
1717 {
1721  unsigned char buttons[15];
1725  float axes[6];
1727 
1728 
1729 /*************************************************************************
1730  * GLFW API functions
1731  *************************************************************************/
1732 
1765 GLFWAPI int glfwInit(void);
1766 
1797 GLFWAPI void glfwTerminate(void);
1798 
1829 GLFWAPI void glfwInitHint(int hint, int value);
1830 
1856 GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
1857 
1887 GLFWAPI const char* glfwGetVersionString(void);
1888 
1918 GLFWAPI int glfwGetError(const char** description);
1919 
1965 
1993 GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
1994 
2017 GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
2018 
2042 GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
2043 
2073 GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
2074 
2107 GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
2108 
2139 GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);
2140 
2165 GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
2166 
2191 GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
2192 
2215 GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
2216 
2246 
2278 GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
2279 
2306 GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
2307 
2339 GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
2340 
2369 GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
2370 
2410 GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
2411 
2429 GLFWAPI void glfwDefaultWindowHints(void);
2430 
2464 GLFWAPI void glfwWindowHint(int hint, int value);
2465 
2502 GLFWAPI void glfwWindowHintString(int hint, const char* value);
2503 
2656 GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
2657 
2685 GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
2686 
2705 GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
2706 
2727 GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
2728 
2752 GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
2753 
2799 GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2800 
2831 GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2832 
2866 GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
2867 
2896 GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
2897 
2939 GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2940 
2982 GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2983 
3023 GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
3024 
3052 GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
3053 
3089 GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
3090 
3122 GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
3123 
3149 GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
3150 
3178 GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
3179 
3209 GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
3210 
3236 GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
3237 
3261 GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
3262 
3288 GLFWAPI void glfwShowWindow(GLFWwindow* window);
3289 
3310 GLFWAPI void glfwHideWindow(GLFWwindow* window);
3311 
3349 GLFWAPI void glfwFocusWindow(GLFWwindow* window);
3350 
3376 GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);
3377 
3398 GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
3399 
3457 GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
3458 
3491 GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
3492 
3528 GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
3529 
3551 GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
3552 
3572 GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
3573 
3608 
3640 
3680 
3716 
3751 
3784 
3814 
3844 
3875 
3912 GLFWAPI void glfwPollEvents(void);
3913 
3957 GLFWAPI void glfwWaitEvents(void);
3958 
4006 GLFWAPI void glfwWaitEventsTimeout(double timeout);
4007 
4026 GLFWAPI void glfwPostEmptyEvent(void);
4027 
4051 GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
4052 
4113 GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
4114 
4142 GLFWAPI int glfwRawMouseMotionSupported(void);
4143 
4210 GLFWAPI const char* glfwGetKeyName(int key, int scancode);
4211 
4234 GLFWAPI int glfwGetKeyScancode(int key);
4235 
4274 GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
4275 
4303 GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
4304 
4341 GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
4342 
4381 GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
4382 
4419 GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
4420 
4442 GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
4443 
4469 GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
4470 
4496 GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
4497 
4546 GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
4547 
4589 GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);
4590 
4632 
4669 
4701 
4732 
4765 GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
4766 
4802 GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);
4803 
4826 GLFWAPI int glfwJoystickPresent(int jid);
4827 
4859 GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
4860 
4900 GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
4901 
4957 GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
4958 
4988 GLFWAPI const char* glfwGetJoystickName(int jid);
4989 
5029 GLFWAPI const char* glfwGetJoystickGUID(int jid);
5030 
5055 GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer);
5056 
5079 GLFWAPI void* glfwGetJoystickUserPointer(int jid);
5080 
5107 GLFWAPI int glfwJoystickIsGamepad(int jid);
5108 
5144 
5177 GLFWAPI int glfwUpdateGamepadMappings(const char* string);
5178 
5207 GLFWAPI const char* glfwGetGamepadName(int jid);
5208 
5245 GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
5246 
5270 GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
5271 
5300 GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
5301 
5330 GLFWAPI double glfwGetTime(void);
5331 
5360 GLFWAPI void glfwSetTime(double time);
5361 
5382 GLFWAPI uint64_t glfwGetTimerValue(void);
5383 
5402 GLFWAPI uint64_t glfwGetTimerFrequency(void);
5403 
5440 GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
5441 
5461 GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
5462 
5495 GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
5496 
5541 GLFWAPI void glfwSwapInterval(int interval);
5542 
5579 GLFWAPI int glfwExtensionSupported(const char* extension);
5580 
5621 GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
5622 
5649 GLFWAPI int glfwVulkanSupported(void);
5650 
5697 GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
5698 
5699 #if defined(VK_VERSION_1_0)
5700 
5740 GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
5741 
5777 GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
5778 
5838 GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
5839 
5840 #endif /*VK_VERSION_1_0*/
5841 
5842 
5843 /*************************************************************************
5844  * Global definition cleanup
5845  *************************************************************************/
5846 
5847 /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
5848 
5849 #ifdef GLFW_WINGDIAPI_DEFINED
5850  #undef WINGDIAPI
5851  #undef GLFW_WINGDIAPI_DEFINED
5852 #endif
5853 
5854 #ifdef GLFW_CALLBACK_DEFINED
5855  #undef CALLBACK
5856  #undef GLFW_CALLBACK_DEFINED
5857 #endif
5858 
5859 /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally
5860  * defined by some gl.h variants (OpenBSD) so define it after if needed.
5861  */
5862 #ifndef GLAPIENTRY
5863  #define GLAPIENTRY APIENTRY
5864 #endif
5865 
5866 /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
5867 
5868 
5869 #ifdef __cplusplus
5870 }
5871 #endif
5872 
5873 #endif /* _glfw3_h_ */
5874 
void * glfwGetJoystickUserPointer(int jid)
Returns the user pointer of the specified joystick.
int glfwGetGamepadState(int jid, GLFWgamepadstate *state)
Retrieves the state of the specified joystick remapped as a gamepad.
int glfwGetError(const char **description)
Returns and clears the last error for the calling thread.
GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow *window, GLFWframebuffersizefun callback)
Sets the framebuffer resize callback for the specified window.
void glfwSetWindowSize(GLFWwindow *window, int width, int height)
Sets the size of the content area of the specified window.
void(* GLFWwindowrefreshfun)(GLFWwindow *)
The function pointer type for window content refresh callbacks.
Definition: glfw3.h:1273
void(* GLFWmousebuttonfun)(GLFWwindow *, int, int, int)
The function pointer type for mouse button callbacks.
Definition: glfw3.h:1404
struct GLFWgammaramp GLFWgammaramp
Gamma ramp.
struct GLFWimage GLFWimage
Image data.
double glfwGetTime(void)
Returns the GLFW time.
void glfwSetWindowPos(GLFWwindow *window, int xpos, int ypos)
Sets the position of the content area of the specified window.
void glfwSetCursorPos(GLFWwindow *window, double xpos, double ypos)
Sets the position of the cursor, relative to the content area of the window.
int glfwUpdateGamepadMappings(const char *string)
Adds the specified SDL_GameControllerDB gamepad mappings.
const char * glfwGetJoystickName(int jid)
Returns the name of the specified joystick.
void(* GLFWcursorposfun)(GLFWwindow *, double, double)
The function pointer type for cursor position callbacks.
Definition: glfw3.h:1427
void glfwSetWindowAttrib(GLFWwindow *window, int attrib, int value)
Sets an attribute of the specified window.
void glfwRestoreWindow(GLFWwindow *window)
Restores the specified window.
int glfwGetMouseButton(GLFWwindow *window, int button)
Returns the last reported state of a mouse button for the specified window.
int glfwGetKeyScancode(int key)
Returns the platform-specific scancode of the specified key.
void glfwGetMonitorContentScale(GLFWmonitor *monitor, float *xscale, float *yscale)
Retrieves the content scale for the specified monitor.
void(* GLFWcharmodsfun)(GLFWwindow *, unsigned int, int)
The function pointer type for Unicode character with modifiers callbacks.
Definition: glfw3.h:1543
GLFWcursor * glfwCreateCursor(const GLFWimage *image, int xhot, int yhot)
Creates a custom cursor.
void glfwGetWindowContentScale(GLFWwindow *window, float *xscale, float *yscale)
Retrieves the content scale for the specified window.
const char * glfwGetKeyName(int key, int scancode)
Returns the layout-specific name of the specified printable key.
GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow *window, GLFWwindowrefreshfun callback)
Sets the refresh callback for the specified window.
GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback)
Sets the monitor configuration callback.
int height
Definition: glfw3.h:1694
Gamma ramp.
Definition: glfw3.h:1658
void glfwSetInputMode(GLFWwindow *window, int mode, int value)
Sets an input option for the specified window.
void(* GLFWerrorfun)(int, const char *)
The function pointer type for error callbacks.
Definition: glfw3.h:1188
void(* GLFWkeyfun)(GLFWwindow *, int, int, int, int)
The function pointer type for keyboard key callbacks.
Definition: glfw3.h:1495
GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow *window, GLFWwindowsizefun callback)
Sets the size callback for the specified window.
void(* GLFWwindowmaximizefun)(GLFWwindow *, int)
The function pointer type for window maximize callbacks.
Definition: glfw3.h:1336
GLFWwindow * glfwGetCurrentContext(void)
Returns the window whose context is current on the calling thread.
void glfwSetWindowMonitor(GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)
Sets the mode, monitor, video mode and placement of a window.
void glfwGetWindowPos(GLFWwindow *window, int *xpos, int *ypos)
Retrieves the position of the content area of the specified window.
GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow *window, GLFWwindowmaximizefun callback)
Sets the maximize callback for the specified window.
void(* GLFWcursorenterfun)(GLFWwindow *, int)
The function pointer type for cursor enter/leave callbacks.
Definition: glfw3.h:1448
void(* GLFWvkproc)(void)
Vulkan API function pointer type.
Definition: glfw3.h:1128
int glfwGetInputMode(GLFWwindow *window, int mode)
Returns the value of an input option for the specified window.
void glfwSetWindowTitle(GLFWwindow *window, const char *title)
Sets the title of the specified window.
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1152
void glfwGetMonitorWorkarea(GLFWmonitor *monitor, int *xpos, int *ypos, int *width, int *height)
Retrieves the work area of the monitor.
void glfwSetJoystickUserPointer(int jid, void *pointer)
Sets the user pointer of the specified joystick.
void glfwTerminate(void)
Terminates the GLFW library.
int glfwExtensionSupported(const char *extension)
Returns whether the specified extension is available.
GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow *window, GLFWmousebuttonfun callback)
Sets the mouse button callback.
void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
const unsigned char * glfwGetJoystickHats(int jid, int *count)
Returns the state of all hats of the specified joystick.
int blueBits
Definition: glfw3.h:1640
void glfwGetWindowFrameSize(GLFWwindow *window, int *left, int *top, int *right, int *bottom)
Retrieves the size of the frame of the window.
const char * glfwGetGamepadName(int jid)
Returns the human-readable gamepad name for the specified joystick.
int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.
void glfwSetTime(double time)
Sets the GLFW time.
void glfwSetGammaRamp(GLFWmonitor *monitor, const GLFWgammaramp *ramp)
Sets the current gamma ramp for the specified monitor.
void glfwGetCursorPos(GLFWwindow *window, double *xpos, double *ypos)
Retrieves the position of the cursor relative to the content area of the window.
void glfwInitHint(int hint, int value)
Sets the specified init hint to the desired value.
int glfwJoystickIsGamepad(int jid)
Returns whether the specified joystick has a gamepad mapping.
void glfwPollEvents(void)
Processes all pending events.
void glfwWaitEvents(void)
Waits until events are queued and processes them.
void glfwDestroyCursor(GLFWcursor *cursor)
Destroys a cursor.
const unsigned char * glfwGetJoystickButtons(int jid, int *count)
Returns the state of all buttons of the specified joystick.
void(* GLFWscrollfun)(GLFWwindow *, double, double)
The function pointer type for scroll callbacks.
Definition: glfw3.h:1469
const char * glfwGetMonitorName(GLFWmonitor *monitor)
Returns the name of the specified monitor.
GLFWcharfun glfwSetCharCallback(GLFWwindow *window, GLFWcharfun callback)
Sets the Unicode character callback.
void glfwSetWindowSizeLimits(GLFWwindow *window, int minwidth, int minheight, int maxwidth, int maxheight)
Sets the size limits of the specified window.
GLFWmonitor * glfwGetPrimaryMonitor(void)
Returns the primary monitor.
void(* GLFWmonitorfun)(GLFWmonitor *, int)
The function pointer type for monitor configuration callbacks.
Definition: glfw3.h:1588
void(* GLFWjoystickfun)(int, int)
The function pointer type for joystick configuration callbacks.
Definition: glfw3.h:1609
const char * glfwGetJoystickGUID(int jid)
Returns the SDL compatible GUID of the specified joystick.
GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow *window, GLFWwindowfocusfun callback)
Sets the focus callback for the specified window.
const char ** glfwGetRequiredInstanceExtensions(uint32_t *count)
Returns the Vulkan instance extensions required by GLFW.
GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow *window, GLFWwindowclosefun callback)
Sets the close callback for the specified window.
void glfwFocusWindow(GLFWwindow *window)
Brings the specified window to front and sets input focus.
void(* GLFWglproc)(void)
Client API function pointer type.
Definition: glfw3.h:1114
const char * glfwGetClipboardString(GLFWwindow *window)
Returns the contents of the clipboard as a string.
int height
Definition: glfw3.h:1631
GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow *window, GLFWwindowcontentscalefun callback)
Sets the window content scale callback for the specified window.
GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow *window, GLFWwindowposfun callback)
Sets the position callback for the specified window.
GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow *window, GLFWcursorenterfun callback)
Sets the cursor enter/leave callback.
void glfwSetCursor(GLFWwindow *window, GLFWcursor *cursor)
Sets the cursor for the window.
void(* GLFWframebuffersizefun)(GLFWwindow *, int, int)
The function pointer type for framebuffer size callbacks.
Definition: glfw3.h:1357
GLFWmonitor ** glfwGetMonitors(int *count)
Returns the currently connected monitors.
int glfwRawMouseMotionSupported(void)
Returns whether raw mouse motion is supported.
void glfwSetMonitorUserPointer(GLFWmonitor *monitor, void *pointer)
Sets the user pointer of the specified monitor.
unsigned char * pixels
Definition: glfw3.h:1697
const GLFWvidmode * glfwGetVideoModes(GLFWmonitor *monitor, int *count)
Returns the available video modes for the specified monitor.
void glfwShowWindow(GLFWwindow *window)
Makes the specified window visible.
unsigned short * green
Definition: glfw3.h:1665
struct GLFWgamepadstate GLFWgamepadstate
Gamepad input state.
void glfwRequestWindowAttention(GLFWwindow *window)
Requests user attention to the specified window.
int glfwJoystickPresent(int jid)
Returns whether the specified joystick is present.
unsigned char buttons[15]
Definition: glfw3.h:1716
int glfwVulkanSupported(void)
Returns whether the Vulkan loader and an ICD have been found.
void glfwGetMonitorPos(GLFWmonitor *monitor, int *xpos, int *ypos)
Returns the position of the monitor's viewport on the virtual screen.
void glfwHideWindow(GLFWwindow *window)
Hides the specified window.
int width
Definition: glfw3.h:1628
void glfwMaximizeWindow(GLFWwindow *window)
Maximizes the specified window.
unsigned int size
Definition: glfw3.h:1671
VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow *window, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
Creates a Vulkan surface for the specified window.
void(* GLFWcharfun)(GLFWwindow *, unsigned int)
The function pointer type for Unicode character callbacks.
Definition: glfw3.h:1516
void(* GLFWwindowcontentscalefun)(GLFWwindow *, float, float)
The function pointer type for window content scale callbacks.
Definition: glfw3.h:1378
uint64_t glfwGetTimerValue(void)
Returns the current value of the raw timer.
unsigned short * red
Definition: glfw3.h:1662
void glfwDefaultWindowHints(void)
Resets all window hints to their default values.
GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow *window, GLFWcursorposfun callback)
Sets the cursor position callback.
uint64_t glfwGetTimerFrequency(void)
Returns the frequency, in Hz, of the raw timer.
void glfwSetWindowIcon(GLFWwindow *window, int count, const GLFWimage *images)
Sets the icon for the specified window.
int width
Definition: glfw3.h:1691
GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow *window, GLFWcharmodsfun callback)
Sets the Unicode character with modifiers callback.
void glfwSetWindowShouldClose(GLFWwindow *window, int value)
Sets the close flag of the specified window.
void glfwSetWindowAspectRatio(GLFWwindow *window, int numer, int denom)
Sets the aspect ratio of the specified window.
void * glfwGetMonitorUserPointer(GLFWmonitor *monitor)
Returns the user pointer of the specified monitor.
void glfwWaitEventsTimeout(double timeout)
Waits with timeout until events are queued and processes them.
int greenBits
Definition: glfw3.h:1637
void glfwGetMonitorPhysicalSize(GLFWmonitor *monitor, int *widthMM, int *heightMM)
Returns the physical size of the monitor.
GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback)
Sets the joystick configuration callback.
void(* GLFWwindowiconifyfun)(GLFWwindow *, int)
The function pointer type for window iconify callbacks.
Definition: glfw3.h:1315
Gamepad input state.
Definition: glfw3.h:1711
struct GLFWvidmode GLFWvidmode
Video mode type.
void(* GLFWdropfun)(GLFWwindow *, int, const char *[])
The function pointer type for path drop callbacks.
Definition: glfw3.h:1567
struct GLFWcursor GLFWcursor
Opaque cursor object.
Definition: glfw3.h:1164
GLFWcursor * glfwCreateStandardCursor(int shape)
Creates a cursor with a standard shape.
int glfwInit(void)
Initializes the GLFW library.
float axes[6]
Definition: glfw3.h:1720
void glfwWindowHintString(int hint, const char *value)
Sets the specified window hint to the desired value.
float glfwGetWindowOpacity(GLFWwindow *window)
Returns the opacity of the whole window.
Image data.
Definition: glfw3.h:1687
void glfwSetWindowOpacity(GLFWwindow *window, float opacity)
Sets the opacity of the whole window.
GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
const GLFWgammaramp * glfwGetGammaRamp(GLFWmonitor *monitor)
Returns the current gamma ramp for the specified monitor.
GLFWdropfun glfwSetDropCallback(GLFWwindow *window, GLFWdropfun callback)
Sets the path drop callback.
void(* GLFWwindowsizefun)(GLFWwindow *, int, int)
The function pointer type for window size callbacks.
Definition: glfw3.h:1233
unsigned short * blue
Definition: glfw3.h:1668
GLFWmonitor * glfwGetWindowMonitor(GLFWwindow *window)
Returns the monitor that the window uses for full screen mode.
GLFWkeyfun glfwSetKeyCallback(GLFWwindow *window, GLFWkeyfun callback)
Sets the key callback.
void glfwIconifyWindow(GLFWwindow *window)
Iconifies the specified window.
const char * glfwGetVersionString(void)
Returns a string describing the compile-time configuration.
void glfwSetWindowUserPointer(GLFWwindow *window, void *pointer)
Sets the user pointer of the specified window.
void glfwPostEmptyEvent(void)
Posts an empty event to the event queue.
int glfwGetWindowAttrib(GLFWwindow *window, int attrib)
Returns an attribute of the specified window.
void(* GLFWwindowfocusfun)(GLFWwindow *, int)
The function pointer type for window focus callbacks.
Definition: glfw3.h:1294
GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow *window, GLFWwindowiconifyfun callback)
Sets the iconify callback for the specified window.
GLFWscrollfun glfwSetScrollCallback(GLFWwindow *window, GLFWscrollfun callback)
Sets the scroll callback.
int glfwGetKey(GLFWwindow *window, int key)
Returns the last reported state of a keyboard key for the specified window.
void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the content area of the specified window.
const float * glfwGetJoystickAxes(int jid, int *count)
Returns the values of all axes of the specified joystick.
Video mode type.
Definition: glfw3.h:1624
GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback)
Sets the error callback.
void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the framebuffer of the specified window.
void(* GLFWwindowclosefun)(GLFWwindow *)
The function pointer type for window close callbacks.
Definition: glfw3.h:1253
int redBits
Definition: glfw3.h:1634
void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
void glfwGetVersion(int *major, int *minor, int *rev)
Retrieves the version of the GLFW library.
int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily)
Returns whether the specified queue family can present images.
void glfwSetGamma(GLFWmonitor *monitor, float gamma)
Generates a gamma ramp and sets it for the specified monitor.
void(* GLFWwindowposfun)(GLFWwindow *, int, int)
The function pointer type for window position callbacks.
Definition: glfw3.h:1211
const GLFWvidmode * glfwGetVideoMode(GLFWmonitor *monitor)
Returns the current mode of the specified monitor.
void glfwSetClipboardString(GLFWwindow *window, const char *string)
Sets the clipboard to the specified string.
void glfwDestroyWindow(GLFWwindow *window)
Destroys the specified window and its context.
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
Definition: glfw3.h:1140
int refreshRate
Definition: glfw3.h:1643
void * glfwGetWindowUserPointer(GLFWwindow *window)
Returns the user pointer of the specified window.
GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char *procname)
Returns the address of the specified Vulkan instance function.
================================================ FILE: thirdparty/glfw/docs/html/glfw3native_8h.html ================================================ GLFW: glfw3native.h File Reference
glfw3native.h File Reference

Description

This is the header file of the native access functions. See Native access for more information.

Go to the source code of this file.

Functions

const char * glfwGetWin32Adapter (GLFWmonitor *monitor)
 Returns the adapter device name of the specified monitor. More...
 
const char * glfwGetWin32Monitor (GLFWmonitor *monitor)
 Returns the display device name of the specified monitor. More...
 
HWND glfwGetWin32Window (GLFWwindow *window)
 Returns the HWND of the specified window. More...
 
HGLRC glfwGetWGLContext (GLFWwindow *window)
 Returns the HGLRC of the specified window. More...
 
CGDirectDisplayID glfwGetCocoaMonitor (GLFWmonitor *monitor)
 Returns the CGDirectDisplayID of the specified monitor. More...
 
id glfwGetCocoaWindow (GLFWwindow *window)
 Returns the NSWindow of the specified window. More...
 
id glfwGetNSGLContext (GLFWwindow *window)
 Returns the NSOpenGLContext of the specified window. More...
 
Display * glfwGetX11Display (void)
 Returns the Display used by GLFW. More...
 
RRCrtc glfwGetX11Adapter (GLFWmonitor *monitor)
 Returns the RRCrtc of the specified monitor. More...
 
RROutput glfwGetX11Monitor (GLFWmonitor *monitor)
 Returns the RROutput of the specified monitor. More...
 
Window glfwGetX11Window (GLFWwindow *window)
 Returns the Window of the specified window. More...
 
void glfwSetX11SelectionString (const char *string)
 Sets the current primary selection to the specified string. More...
 
const char * glfwGetX11SelectionString (void)
 Returns the contents of the current primary selection as a string. More...
 
GLXContext glfwGetGLXContext (GLFWwindow *window)
 Returns the GLXContext of the specified window. More...
 
GLXWindow glfwGetGLXWindow (GLFWwindow *window)
 Returns the GLXWindow of the specified window. More...
 
struct wl_display * glfwGetWaylandDisplay (void)
 Returns the struct wl_display* used by GLFW. More...
 
struct wl_output * glfwGetWaylandMonitor (GLFWmonitor *monitor)
 Returns the struct wl_output* of the specified monitor. More...
 
struct wl_surface * glfwGetWaylandWindow (GLFWwindow *window)
 Returns the main struct wl_surface* of the specified window. More...
 
EGLDisplay glfwGetEGLDisplay (void)
 Returns the EGLDisplay used by GLFW. More...
 
EGLContext glfwGetEGLContext (GLFWwindow *window)
 Returns the EGLContext of the specified window. More...
 
EGLSurface glfwGetEGLSurface (GLFWwindow *window)
 Returns the EGLSurface of the specified window. More...
 
int glfwGetOSMesaColorBuffer (GLFWwindow *window, int *width, int *height, int *format, void **buffer)
 Retrieves the color buffer associated with the specified window. More...
 
int glfwGetOSMesaDepthBuffer (GLFWwindow *window, int *width, int *height, int *bytesPerValue, void **buffer)
 Retrieves the depth buffer associated with the specified window. More...
 
OSMesaContext glfwGetOSMesaContext (GLFWwindow *window)
 Returns the OSMesaContext of the specified window. More...
 
================================================ FILE: thirdparty/glfw/docs/html/glfw3native_8h_source.html ================================================ GLFW: glfw3native.h Source File
glfw3native.h
Go to the documentation of this file.
1 /*************************************************************************
2  * GLFW 3.3 - www.glfw.org
3  * A library for OpenGL, window and input
4  *------------------------------------------------------------------------
5  * Copyright (c) 2002-2006 Marcus Geelnard
6  * Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
7  *
8  * This software is provided 'as-is', without any express or implied
9  * warranty. In no event will the authors be held liable for any damages
10  * arising from the use of this software.
11  *
12  * Permission is granted to anyone to use this software for any purpose,
13  * including commercial applications, and to alter it and redistribute it
14  * freely, subject to the following restrictions:
15  *
16  * 1. The origin of this software must not be misrepresented; you must not
17  * claim that you wrote the original software. If you use this software
18  * in a product, an acknowledgment in the product documentation would
19  * be appreciated but is not required.
20  *
21  * 2. Altered source versions must be plainly marked as such, and must not
22  * be misrepresented as being the original software.
23  *
24  * 3. This notice may not be removed or altered from any source
25  * distribution.
26  *
27  *************************************************************************/
28 
29 #ifndef _glfw3_native_h_
30 #define _glfw3_native_h_
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*************************************************************************
38  * Doxygen documentation
39  *************************************************************************/
40 
80 /*************************************************************************
81  * System headers and types
82  *************************************************************************/
83 
84 #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
85  // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
86  // example to allow applications to correctly declare a GL_ARB_debug_output
87  // callback) but windows.h assumes no one will define APIENTRY before it does
88  #if defined(GLFW_APIENTRY_DEFINED)
89  #undef APIENTRY
90  #undef GLFW_APIENTRY_DEFINED
91  #endif
92  #include <windows.h>
93 #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
94  #if defined(__OBJC__)
95  #import <Cocoa/Cocoa.h>
96  #else
97  #include <ApplicationServices/ApplicationServices.h>
98  typedef void* id;
99  #endif
100 #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
101  #include <X11/Xlib.h>
102  #include <X11/extensions/Xrandr.h>
103 #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
104  #include <wayland-client.h>
105 #endif
106 
107 #if defined(GLFW_EXPOSE_NATIVE_WGL)
108  /* WGL is declared by windows.h */
109 #endif
110 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
111  /* NSGL is declared by Cocoa.h */
112 #endif
113 #if defined(GLFW_EXPOSE_NATIVE_GLX)
114  #include <GL/glx.h>
115 #endif
116 #if defined(GLFW_EXPOSE_NATIVE_EGL)
117  #include <EGL/egl.h>
118 #endif
119 #if defined(GLFW_EXPOSE_NATIVE_OSMESA)
120  #include <GL/osmesa.h>
121 #endif
122 
123 
124 /*************************************************************************
125  * Functions
126  *************************************************************************/
127 
128 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
129 
142 GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
143 
157 GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
158 
171 GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
172 #endif
173 
174 #if defined(GLFW_EXPOSE_NATIVE_WGL)
175 
187 GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
188 #endif
189 
190 #if defined(GLFW_EXPOSE_NATIVE_COCOA)
191 
203 GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
204 
217 GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
218 #endif
219 
220 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
221 
233 GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
234 #endif
235 
236 #if defined(GLFW_EXPOSE_NATIVE_X11)
237 
249 GLFWAPI Display* glfwGetX11Display(void);
250 
263 GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
264 
277 GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
278 
291 GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
292 
313 GLFWAPI void glfwSetX11SelectionString(const char* string);
314 
341 GLFWAPI const char* glfwGetX11SelectionString(void);
342 #endif
343 
344 #if defined(GLFW_EXPOSE_NATIVE_GLX)
345 
357 GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
358 
371 GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
372 #endif
373 
374 #if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
375 
387 GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
388 
401 GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
402 
415 GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
416 #endif
417 
418 #if defined(GLFW_EXPOSE_NATIVE_EGL)
419 
431 GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
432 
445 GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
446 
459 GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
460 #endif
461 
462 #if defined(GLFW_EXPOSE_NATIVE_OSMESA)
463 
482 GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
483 
503 GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
504 
517 GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
518 #endif
519 
520 #ifdef __cplusplus
521 }
522 #endif
523 
524 #endif /* _glfw3_native_h_ */
525 
int glfwGetOSMesaDepthBuffer(GLFWwindow *window, int *width, int *height, int *bytesPerValue, void **buffer)
Retrieves the depth buffer associated with the specified window.
const char * glfwGetX11SelectionString(void)
Returns the contents of the current primary selection as a string.
GLXWindow glfwGetGLXWindow(GLFWwindow *window)
Returns the GLXWindow of the specified window.
struct wl_display * glfwGetWaylandDisplay(void)
Returns the struct wl_display* used by GLFW.
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1152
CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor *monitor)
Returns the CGDirectDisplayID of the specified monitor.
EGLContext glfwGetEGLContext(GLFWwindow *window)
Returns the EGLContext of the specified window.
void glfwSetX11SelectionString(const char *string)
Sets the current primary selection to the specified string.
struct wl_output * glfwGetWaylandMonitor(GLFWmonitor *monitor)
Returns the struct wl_output* of the specified monitor.
HGLRC glfwGetWGLContext(GLFWwindow *window)
Returns the HGLRC of the specified window.
GLXContext glfwGetGLXContext(GLFWwindow *window)
Returns the GLXContext of the specified window.
Display * glfwGetX11Display(void)
Returns the Display used by GLFW.
id glfwGetCocoaWindow(GLFWwindow *window)
Returns the NSWindow of the specified window.
struct wl_surface * glfwGetWaylandWindow(GLFWwindow *window)
Returns the main struct wl_surface* of the specified window.
const char * glfwGetWin32Monitor(GLFWmonitor *monitor)
Returns the display device name of the specified monitor.
id glfwGetNSGLContext(GLFWwindow *window)
Returns the NSOpenGLContext of the specified window.
const char * glfwGetWin32Adapter(GLFWmonitor *monitor)
Returns the adapter device name of the specified monitor.
OSMesaContext glfwGetOSMesaContext(GLFWwindow *window)
Returns the OSMesaContext of the specified window.
Window glfwGetX11Window(GLFWwindow *window)
Returns the Window of the specified window.
EGLSurface glfwGetEGLSurface(GLFWwindow *window)
Returns the EGLSurface of the specified window.
int glfwGetOSMesaColorBuffer(GLFWwindow *window, int *width, int *height, int *format, void **buffer)
Retrieves the color buffer associated with the specified window.
RROutput glfwGetX11Monitor(GLFWmonitor *monitor)
Returns the RROutput of the specified monitor.
RRCrtc glfwGetX11Adapter(GLFWmonitor *monitor)
Returns the RRCrtc of the specified monitor.
EGLDisplay glfwGetEGLDisplay(void)
Returns the EGLDisplay used by GLFW.
HWND glfwGetWin32Window(GLFWwindow *window)
Returns the HWND of the specified window.
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
Definition: glfw3.h:1140
================================================ FILE: thirdparty/glfw/docs/html/group__buttons.html ================================================ GLFW: Mouse buttons
Mouse buttons

Description

See mouse button input for how these are used.

Macros

#define GLFW_MOUSE_BUTTON_1   0
 
#define GLFW_MOUSE_BUTTON_2   1
 
#define GLFW_MOUSE_BUTTON_3   2
 
#define GLFW_MOUSE_BUTTON_4   3
 
#define GLFW_MOUSE_BUTTON_5   4
 
#define GLFW_MOUSE_BUTTON_6   5
 
#define GLFW_MOUSE_BUTTON_7   6
 
#define GLFW_MOUSE_BUTTON_8   7
 
#define GLFW_MOUSE_BUTTON_LAST   GLFW_MOUSE_BUTTON_8
 
#define GLFW_MOUSE_BUTTON_LEFT   GLFW_MOUSE_BUTTON_1
 
#define GLFW_MOUSE_BUTTON_RIGHT   GLFW_MOUSE_BUTTON_2
 
#define GLFW_MOUSE_BUTTON_MIDDLE   GLFW_MOUSE_BUTTON_3
 

Macro Definition Documentation

◆ GLFW_MOUSE_BUTTON_1

#define GLFW_MOUSE_BUTTON_1   0

◆ GLFW_MOUSE_BUTTON_2

#define GLFW_MOUSE_BUTTON_2   1

◆ GLFW_MOUSE_BUTTON_3

#define GLFW_MOUSE_BUTTON_3   2

◆ GLFW_MOUSE_BUTTON_4

#define GLFW_MOUSE_BUTTON_4   3

◆ GLFW_MOUSE_BUTTON_5

#define GLFW_MOUSE_BUTTON_5   4

◆ GLFW_MOUSE_BUTTON_6

#define GLFW_MOUSE_BUTTON_6   5

◆ GLFW_MOUSE_BUTTON_7

#define GLFW_MOUSE_BUTTON_7   6

◆ GLFW_MOUSE_BUTTON_8

#define GLFW_MOUSE_BUTTON_8   7

◆ GLFW_MOUSE_BUTTON_LAST

#define GLFW_MOUSE_BUTTON_LAST   GLFW_MOUSE_BUTTON_8

◆ GLFW_MOUSE_BUTTON_LEFT

#define GLFW_MOUSE_BUTTON_LEFT   GLFW_MOUSE_BUTTON_1

◆ GLFW_MOUSE_BUTTON_RIGHT

#define GLFW_MOUSE_BUTTON_RIGHT   GLFW_MOUSE_BUTTON_2

◆ GLFW_MOUSE_BUTTON_MIDDLE

#define GLFW_MOUSE_BUTTON_MIDDLE   GLFW_MOUSE_BUTTON_3
================================================ FILE: thirdparty/glfw/docs/html/group__context.html ================================================ GLFW: Context reference
Context reference

Description

This is the reference documentation for OpenGL and OpenGL ES context related functions. For more task-oriented information, see the Context guide.

Typedefs

typedef void(* GLFWglproc) (void)
 Client API function pointer type. More...
 

Functions

void glfwMakeContextCurrent (GLFWwindow *window)
 Makes the context of the specified window current for the calling thread. More...
 
GLFWwindowglfwGetCurrentContext (void)
 Returns the window whose context is current on the calling thread. More...
 
void glfwSwapInterval (int interval)
 Sets the swap interval for the current context. More...
 
int glfwExtensionSupported (const char *extension)
 Returns whether the specified extension is available. More...
 
GLFWglproc glfwGetProcAddress (const char *procname)
 Returns the address of the specified function for the current context. More...
 

Typedef Documentation

◆ GLFWglproc

typedef void(* GLFWglproc) (void)

Generic function pointer used for returning client API function pointers without forcing a cast from a regular pointer.

See also
OpenGL and OpenGL ES extensions
glfwGetProcAddress
Since
Added in version 3.0.

Function Documentation

◆ glfwMakeContextCurrent()

void glfwMakeContextCurrent ( GLFWwindow window)

This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread. A context must only be made current on a single thread at a time and each thread can have only a single current context at a time.

When moving a context between threads, you must make it non-current on the old thread before making it current on the new one.

By default, making a context non-current implicitly forces a pipeline flush. On machines that support GL_KHR_context_flush_control, you can control whether a context performs this flush by setting the GLFW_CONTEXT_RELEASE_BEHAVIOR hint.

The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate a GLFW_NO_WINDOW_CONTEXT error.

Parameters
[in]windowThe window whose context to make current, or NULL to detach the current context.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_WINDOW_CONTEXT and GLFW_PLATFORM_ERROR.
Thread safety
This function may be called from any thread.
See also
Current context
glfwGetCurrentContext
Since
Added in version 3.0.

◆ glfwGetCurrentContext()

GLFWwindow* glfwGetCurrentContext ( void  )

This function returns the window whose OpenGL or OpenGL ES context is current on the calling thread.

Returns
The window whose context is current, or NULL if no window's context is current.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread.
See also
Current context
glfwMakeContextCurrent
Since
Added in version 3.0.

◆ glfwSwapInterval()

void glfwSwapInterval ( int  interval)

This function sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of screen updates to wait from the time glfwSwapBuffers was called before swapping the buffers and returning. This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.

A context that supports either of the WGL_EXT_swap_control_tear and GLX_EXT_swap_control_tear extensions also accepts negative swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. You can check for these extensions with glfwExtensionSupported.

A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see the present mode of your swapchain instead.

Parameters
[in]intervalThe minimum number of screen updates to wait for until the buffers are swapped by glfwSwapBuffers.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_CURRENT_CONTEXT and GLFW_PLATFORM_ERROR.
Remarks
This function is not called during context creation, leaving the swap interval set to whatever is the default on that platform. This is done because some swap interval extensions used by GLFW do not allow the swap interval to be reset to zero once it has been set to a non-zero value.
Some GPU drivers do not honor the requested swap interval, either because of a user setting that overrides the application's request or due to bugs in the driver.
Thread safety
This function may be called from any thread.
See also
Buffer swapping
glfwSwapBuffers
Since
Added in version 1.0.

◆ glfwExtensionSupported()

int glfwExtensionSupported ( const char *  extension)

This function returns whether the specified API extension is supported by the current OpenGL or OpenGL ES context. It searches both for client API extension and context creation API extensions.

A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.

As this functions retrieves and searches one or more extension strings each call, it is recommended that you cache its results if it is going to be used frequently. The extension strings will not change during the lifetime of a context, so there is no danger in doing this.

This function does not apply to Vulkan. If you are using Vulkan, see glfwGetRequiredInstanceExtensions, vkEnumerateInstanceExtensionProperties and vkEnumerateDeviceExtensionProperties instead.

Parameters
[in]extensionThe ASCII encoded name of the extension.
Returns
GLFW_TRUE if the extension is available, or GLFW_FALSE otherwise.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_CURRENT_CONTEXT, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.
Thread safety
This function may be called from any thread.
See also
OpenGL and OpenGL ES extensions
glfwGetProcAddress
Since
Added in version 1.0.

◆ glfwGetProcAddress()

GLFWglproc glfwGetProcAddress ( const char *  procname)

This function returns the address of the specified OpenGL or OpenGL ES core or extension function, if it is supported by the current context.

A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see glfwGetInstanceProcAddress, vkGetInstanceProcAddr and vkGetDeviceProcAddr instead.

Parameters
[in]procnameThe ASCII encoded name of the function.
Returns
The address of the function, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_CURRENT_CONTEXT and GLFW_PLATFORM_ERROR.
Remarks
The address of a given function is not guaranteed to be the same between contexts.
This function may return a non-NULL address despite the associated version or extension not being available. Always check the context version or extension string first.
Pointer lifetime
The returned function pointer is valid until the context is destroyed or the library is terminated.
Thread safety
This function may be called from any thread.
See also
OpenGL and OpenGL ES extensions
glfwExtensionSupported
Since
Added in version 1.0.
================================================ FILE: thirdparty/glfw/docs/html/group__errors.html ================================================ GLFW: Error codes

Description

See error handling for how these are used.

Macros

#define GLFW_NO_ERROR   0
 No error has occurred. More...
 
#define GLFW_NOT_INITIALIZED   0x00010001
 GLFW has not been initialized. More...
 
#define GLFW_NO_CURRENT_CONTEXT   0x00010002
 No context is current for this thread. More...
 
#define GLFW_INVALID_ENUM   0x00010003
 One of the arguments to the function was an invalid enum value. More...
 
#define GLFW_INVALID_VALUE   0x00010004
 One of the arguments to the function was an invalid value. More...
 
#define GLFW_OUT_OF_MEMORY   0x00010005
 A memory allocation failed. More...
 
#define GLFW_API_UNAVAILABLE   0x00010006
 GLFW could not find support for the requested API on the system. More...
 
#define GLFW_VERSION_UNAVAILABLE   0x00010007
 The requested OpenGL or OpenGL ES version is not available. More...
 
#define GLFW_PLATFORM_ERROR   0x00010008
 A platform-specific error occurred that does not match any of the more specific categories. More...
 
#define GLFW_FORMAT_UNAVAILABLE   0x00010009
 The requested format is not supported or available. More...
 
#define GLFW_NO_WINDOW_CONTEXT   0x0001000A
 The specified window does not have an OpenGL or OpenGL ES context. More...
 

Macro Definition Documentation

◆ GLFW_NO_ERROR

#define GLFW_NO_ERROR   0

No error has occurred.

Analysis
Yay.

◆ GLFW_NOT_INITIALIZED

#define GLFW_NOT_INITIALIZED   0x00010001

This occurs if a GLFW function was called that must not be called unless the library is initialized.

Analysis
Application programmer error. Initialize GLFW before calling any function that requires initialization.

◆ GLFW_NO_CURRENT_CONTEXT

#define GLFW_NO_CURRENT_CONTEXT   0x00010002

This occurs if a GLFW function was called that needs and operates on the current OpenGL or OpenGL ES context but no context is current on the calling thread. One such function is glfwSwapInterval.

Analysis
Application programmer error. Ensure a context is current before calling functions that require a current context.

◆ GLFW_INVALID_ENUM

#define GLFW_INVALID_ENUM   0x00010003

One of the arguments to the function was an invalid enum value, for example requesting GLFW_RED_BITS with glfwGetWindowAttrib.

Analysis
Application programmer error. Fix the offending call.

◆ GLFW_INVALID_VALUE

#define GLFW_INVALID_VALUE   0x00010004

One of the arguments to the function was an invalid value, for example requesting a non-existent OpenGL or OpenGL ES version like 2.7.

Requesting a valid but unavailable OpenGL or OpenGL ES version will instead result in a GLFW_VERSION_UNAVAILABLE error.

Analysis
Application programmer error. Fix the offending call.

◆ GLFW_OUT_OF_MEMORY

#define GLFW_OUT_OF_MEMORY   0x00010005

A memory allocation failed.

Analysis
A bug in GLFW or the underlying operating system. Report the bug to our issue tracker.

◆ GLFW_API_UNAVAILABLE

#define GLFW_API_UNAVAILABLE   0x00010006

GLFW could not find support for the requested API on the system.

Analysis
The installed graphics driver does not support the requested API, or does not support it via the chosen context creation backend. Below are a few examples.
Some pre-installed Windows graphics drivers do not support OpenGL. AMD only supports OpenGL ES via EGL, while Nvidia and Intel only support it via a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary driver. Older graphics drivers do not support Vulkan.

◆ GLFW_VERSION_UNAVAILABLE

#define GLFW_VERSION_UNAVAILABLE   0x00010007

The requested OpenGL or OpenGL ES version (including any requested context or framebuffer hints) is not available on this machine.

Analysis
The machine does not support your requirements. If your application is sufficiently flexible, downgrade your requirements and try again. Otherwise, inform the user that their machine does not match your requirements.
Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 comes out before the 4.x series gets that far, also fail with this error and not GLFW_INVALID_VALUE, because GLFW cannot know what future versions will exist.

◆ GLFW_PLATFORM_ERROR

#define GLFW_PLATFORM_ERROR   0x00010008

A platform-specific error occurred that does not match any of the more specific categories.

Analysis
A bug or configuration error in GLFW, the underlying operating system or its drivers, or a lack of required resources. Report the issue to our issue tracker.

◆ GLFW_FORMAT_UNAVAILABLE

#define GLFW_FORMAT_UNAVAILABLE   0x00010009

If emitted during window creation, the requested pixel format is not supported.

If emitted when querying the clipboard, the contents of the clipboard could not be converted to the requested format.

Analysis
If emitted during window creation, one or more hard constraints did not match any of the available pixel formats. If your application is sufficiently flexible, downgrade your requirements and try again. Otherwise, inform the user that their machine does not match your requirements.
If emitted when querying the clipboard, ignore the error or report it to the user, as appropriate.

◆ GLFW_NO_WINDOW_CONTEXT

#define GLFW_NO_WINDOW_CONTEXT   0x0001000A

A window that does not have an OpenGL or OpenGL ES context was passed to a function that requires it to have one.

Analysis
Application programmer error. Fix the offending call.
================================================ FILE: thirdparty/glfw/docs/html/group__gamepad__axes.html ================================================ GLFW: Gamepad axes
Gamepad axes

Description

See Gamepad input for how these are used.

Macros

#define GLFW_GAMEPAD_AXIS_LEFT_X   0
 
#define GLFW_GAMEPAD_AXIS_LEFT_Y   1
 
#define GLFW_GAMEPAD_AXIS_RIGHT_X   2
 
#define GLFW_GAMEPAD_AXIS_RIGHT_Y   3
 
#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER   4
 
#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER   5
 
#define GLFW_GAMEPAD_AXIS_LAST   GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
 

Macro Definition Documentation

◆ GLFW_GAMEPAD_AXIS_LEFT_X

#define GLFW_GAMEPAD_AXIS_LEFT_X   0

◆ GLFW_GAMEPAD_AXIS_LEFT_Y

#define GLFW_GAMEPAD_AXIS_LEFT_Y   1

◆ GLFW_GAMEPAD_AXIS_RIGHT_X

#define GLFW_GAMEPAD_AXIS_RIGHT_X   2

◆ GLFW_GAMEPAD_AXIS_RIGHT_Y

#define GLFW_GAMEPAD_AXIS_RIGHT_Y   3

◆ GLFW_GAMEPAD_AXIS_LEFT_TRIGGER

#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER   4

◆ GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER

#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER   5

◆ GLFW_GAMEPAD_AXIS_LAST

#define GLFW_GAMEPAD_AXIS_LAST   GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
================================================ FILE: thirdparty/glfw/docs/html/group__gamepad__buttons.html ================================================ GLFW: Gamepad buttons
Gamepad buttons

Description

See Gamepad input for how these are used.

Macros

#define GLFW_GAMEPAD_BUTTON_A   0
 
#define GLFW_GAMEPAD_BUTTON_B   1
 
#define GLFW_GAMEPAD_BUTTON_X   2
 
#define GLFW_GAMEPAD_BUTTON_Y   3
 
#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER   4
 
#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER   5
 
#define GLFW_GAMEPAD_BUTTON_BACK   6
 
#define GLFW_GAMEPAD_BUTTON_START   7
 
#define GLFW_GAMEPAD_BUTTON_GUIDE   8
 
#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB   9
 
#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB   10
 
#define GLFW_GAMEPAD_BUTTON_DPAD_UP   11
 
#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT   12
 
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN   13
 
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT   14
 
#define GLFW_GAMEPAD_BUTTON_LAST   GLFW_GAMEPAD_BUTTON_DPAD_LEFT
 
#define GLFW_GAMEPAD_BUTTON_CROSS   GLFW_GAMEPAD_BUTTON_A
 
#define GLFW_GAMEPAD_BUTTON_CIRCLE   GLFW_GAMEPAD_BUTTON_B
 
#define GLFW_GAMEPAD_BUTTON_SQUARE   GLFW_GAMEPAD_BUTTON_X
 
#define GLFW_GAMEPAD_BUTTON_TRIANGLE   GLFW_GAMEPAD_BUTTON_Y
 

Macro Definition Documentation

◆ GLFW_GAMEPAD_BUTTON_A

#define GLFW_GAMEPAD_BUTTON_A   0

◆ GLFW_GAMEPAD_BUTTON_B

#define GLFW_GAMEPAD_BUTTON_B   1

◆ GLFW_GAMEPAD_BUTTON_X

#define GLFW_GAMEPAD_BUTTON_X   2

◆ GLFW_GAMEPAD_BUTTON_Y

#define GLFW_GAMEPAD_BUTTON_Y   3

◆ GLFW_GAMEPAD_BUTTON_LEFT_BUMPER

#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER   4

◆ GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER

#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER   5

◆ GLFW_GAMEPAD_BUTTON_BACK

#define GLFW_GAMEPAD_BUTTON_BACK   6

◆ GLFW_GAMEPAD_BUTTON_START

#define GLFW_GAMEPAD_BUTTON_START   7

◆ GLFW_GAMEPAD_BUTTON_GUIDE

#define GLFW_GAMEPAD_BUTTON_GUIDE   8

◆ GLFW_GAMEPAD_BUTTON_LEFT_THUMB

#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB   9

◆ GLFW_GAMEPAD_BUTTON_RIGHT_THUMB

#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB   10

◆ GLFW_GAMEPAD_BUTTON_DPAD_UP

#define GLFW_GAMEPAD_BUTTON_DPAD_UP   11

◆ GLFW_GAMEPAD_BUTTON_DPAD_RIGHT

#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT   12

◆ GLFW_GAMEPAD_BUTTON_DPAD_DOWN

#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN   13

◆ GLFW_GAMEPAD_BUTTON_DPAD_LEFT

#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT   14

◆ GLFW_GAMEPAD_BUTTON_LAST

#define GLFW_GAMEPAD_BUTTON_LAST   GLFW_GAMEPAD_BUTTON_DPAD_LEFT

◆ GLFW_GAMEPAD_BUTTON_CROSS

#define GLFW_GAMEPAD_BUTTON_CROSS   GLFW_GAMEPAD_BUTTON_A

◆ GLFW_GAMEPAD_BUTTON_CIRCLE

#define GLFW_GAMEPAD_BUTTON_CIRCLE   GLFW_GAMEPAD_BUTTON_B

◆ GLFW_GAMEPAD_BUTTON_SQUARE

#define GLFW_GAMEPAD_BUTTON_SQUARE   GLFW_GAMEPAD_BUTTON_X

◆ GLFW_GAMEPAD_BUTTON_TRIANGLE

#define GLFW_GAMEPAD_BUTTON_TRIANGLE   GLFW_GAMEPAD_BUTTON_Y
================================================ FILE: thirdparty/glfw/docs/html/group__hat__state.html ================================================ GLFW: Joystick hat states
Joystick hat states

Description

See joystick hat input for how these are used.

Macros

#define GLFW_HAT_CENTERED   0
 
#define GLFW_HAT_UP   1
 
#define GLFW_HAT_RIGHT   2
 
#define GLFW_HAT_DOWN   4
 
#define GLFW_HAT_LEFT   8
 
#define GLFW_HAT_RIGHT_UP   (GLFW_HAT_RIGHT | GLFW_HAT_UP)
 
#define GLFW_HAT_RIGHT_DOWN   (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
 
#define GLFW_HAT_LEFT_UP   (GLFW_HAT_LEFT | GLFW_HAT_UP)
 
#define GLFW_HAT_LEFT_DOWN   (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
 

Macro Definition Documentation

◆ GLFW_HAT_CENTERED

#define GLFW_HAT_CENTERED   0

◆ GLFW_HAT_UP

#define GLFW_HAT_UP   1

◆ GLFW_HAT_RIGHT

#define GLFW_HAT_RIGHT   2

◆ GLFW_HAT_DOWN

#define GLFW_HAT_DOWN   4

◆ GLFW_HAT_LEFT

#define GLFW_HAT_LEFT   8

◆ GLFW_HAT_RIGHT_UP

#define GLFW_HAT_RIGHT_UP   (GLFW_HAT_RIGHT | GLFW_HAT_UP)

◆ GLFW_HAT_RIGHT_DOWN

#define GLFW_HAT_RIGHT_DOWN   (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)

◆ GLFW_HAT_LEFT_UP

#define GLFW_HAT_LEFT_UP   (GLFW_HAT_LEFT | GLFW_HAT_UP)

◆ GLFW_HAT_LEFT_DOWN

#define GLFW_HAT_LEFT_DOWN   (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
================================================ FILE: thirdparty/glfw/docs/html/group__init.html ================================================ GLFW: Initialization, version and error reference
Initialization, version and error reference

Description

This is the reference documentation for initialization and termination of the library, version management and error handling. For more task-oriented information, see the Introduction to the API.

Modules

 Error codes
 Error codes.
 

Macros

#define GLFW_TRUE   1
 One. More...
 
#define GLFW_FALSE   0
 Zero. More...
 
#define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001
 Joystick hat buttons init hint. More...
 
#define GLFW_COCOA_CHDIR_RESOURCES   0x00051001
 macOS specific init hint. More...
 
#define GLFW_COCOA_MENUBAR   0x00051002
 macOS specific init hint. More...
 

Typedefs

typedef void(* GLFWerrorfun) (int, const char *)
 The function pointer type for error callbacks. More...
 

Functions

int glfwInit (void)
 Initializes the GLFW library. More...
 
void glfwTerminate (void)
 Terminates the GLFW library. More...
 
void glfwInitHint (int hint, int value)
 Sets the specified init hint to the desired value. More...
 
void glfwGetVersion (int *major, int *minor, int *rev)
 Retrieves the version of the GLFW library. More...
 
const char * glfwGetVersionString (void)
 Returns a string describing the compile-time configuration. More...
 
int glfwGetError (const char **description)
 Returns and clears the last error for the calling thread. More...
 
GLFWerrorfun glfwSetErrorCallback (GLFWerrorfun callback)
 Sets the error callback. More...
 

Macro Definition Documentation

◆ GLFW_VERSION_MAJOR

#define GLFW_VERSION_MAJOR   3

This is incremented when the API is changed in non-compatible ways.

◆ GLFW_VERSION_MINOR

#define GLFW_VERSION_MINOR   3

This is incremented when features are added to the API but it remains backward-compatible.

◆ GLFW_VERSION_REVISION

#define GLFW_VERSION_REVISION   2

This is incremented when a bug fix release is made that does not contain any API changes.

◆ GLFW_TRUE

#define GLFW_TRUE   1

This is only semantic sugar for the number 1. You can instead use 1 or true or _True or GL_TRUE or VK_TRUE or anything else that is equal to one.

◆ GLFW_FALSE

#define GLFW_FALSE   0

This is only semantic sugar for the number 0. You can instead use 0 or false or _False or GL_FALSE or VK_FALSE or anything else that is equal to zero.

◆ GLFW_JOYSTICK_HAT_BUTTONS

#define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001

Joystick hat buttons init hint.

◆ GLFW_COCOA_CHDIR_RESOURCES

#define GLFW_COCOA_CHDIR_RESOURCES   0x00051001

macOS specific init hint.

◆ GLFW_COCOA_MENUBAR

#define GLFW_COCOA_MENUBAR   0x00051002

macOS specific init hint.

Typedef Documentation

◆ GLFWerrorfun

typedef void(* GLFWerrorfun) (int, const char *)

This is the function pointer type for error callbacks. An error callback function has the following signature:

void callback_name(int error_code, const char* description)
Parameters
[in]error_codeAn error code. Future releases may add more error codes.
[in]descriptionA UTF-8 encoded string describing the error.
Pointer lifetime
The error description string is valid until the callback function returns.
See also
Error handling
glfwSetErrorCallback
Since
Added in version 3.0.

Function Documentation

◆ glfwInit()

int glfwInit ( void  )

This function initializes the GLFW library. Before most GLFW functions can be used, GLFW must be initialized, and before an application terminates GLFW should be terminated in order to free any resources allocated during or after initialization.

If this function fails, it calls glfwTerminate before returning. If it succeeds, you should call glfwTerminate before the application exits.

Additional calls to this function after successful initialization but before termination will return GLFW_TRUE immediately.

Returns
GLFW_TRUE if successful, or GLFW_FALSE if an error occurred.
Errors
Possible errors include GLFW_PLATFORM_ERROR.
Remarks
macOS: This function will change the current directory of the application to the Contents/Resources subdirectory of the application's bundle, if present. This can be disabled with the GLFW_COCOA_CHDIR_RESOURCES init hint.
Thread safety
This function must only be called from the main thread.
See also
Initialization and termination
glfwTerminate
Since
Added in version 1.0.

◆ glfwTerminate()

void glfwTerminate ( void  )

This function destroys all remaining windows and cursors, restores any modified gamma ramps and frees any other allocated resources. Once this function is called, you must again call glfwInit successfully before you will be able to use most GLFW functions.

If GLFW has been successfully initialized, this function should be called before the application exits. If initialization fails, there is no need to call this function, as it is called by glfwInit before it returns failure.

Errors
Possible errors include GLFW_PLATFORM_ERROR.
Remarks
This function may be called before glfwInit.
Warning
The contexts of any remaining windows must not be current on any other thread when this function is called.
Reentrancy
This function must not be called from a callback.
Thread safety
This function must only be called from the main thread.
See also
Initialization and termination
glfwInit
Since
Added in version 1.0.

◆ glfwInitHint()

void glfwInitHint ( int  hint,
int  value 
)

This function sets hints for the next initialization of GLFW.

The values you set hints to are never reset by GLFW, but they only take effect during initialization. Once GLFW has been initialized, any values you set will be ignored until the library is terminated and initialized again.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters
[in]hintThe init hint to set.
[in]valueThe new value of the init hint.
Errors
Possible errors include GLFW_INVALID_ENUM and GLFW_INVALID_VALUE.
Remarks
This function may be called before glfwInit.
Thread safety
This function must only be called from the main thread.
See also
init_hints
glfwInit
Since
Added in version 3.3.

◆ glfwGetVersion()

void glfwGetVersion ( int *  major,
int *  minor,
int *  rev 
)

This function retrieves the major, minor and revision numbers of the GLFW library. It is intended for when you are using GLFW as a shared library and want to ensure that you are using the minimum required version.

Any or all of the version arguments may be NULL.

Parameters
[out]majorWhere to store the major version number, or NULL.
[out]minorWhere to store the minor version number, or NULL.
[out]revWhere to store the revision number, or NULL.
Errors
None.
Remarks
This function may be called before glfwInit.
Thread safety
This function may be called from any thread.
See also
Version management
glfwGetVersionString
Since
Added in version 1.0.

◆ glfwGetVersionString()

const char* glfwGetVersionString ( void  )

This function returns the compile-time generated version string of the GLFW library binary. It describes the version, platform, compiler and any platform-specific compile-time options. It should not be confused with the OpenGL or OpenGL ES version string, queried with glGetString.

Do not use the version string to parse the GLFW library version. The glfwGetVersion function provides the version of the running library binary in numerical format.

Returns
The ASCII encoded GLFW version string.
Errors
None.
Remarks
This function may be called before glfwInit.
Pointer lifetime
The returned string is static and compile-time generated.
Thread safety
This function may be called from any thread.
See also
Version management
glfwGetVersion
Since
Added in version 3.0.

◆ glfwGetError()

int glfwGetError ( const char **  description)

This function returns and clears the error code of the last error that occurred on the calling thread, and optionally a UTF-8 encoded human-readable description of it. If no error has occurred since the last call, it returns GLFW_NO_ERROR (zero) and the description pointer is set to NULL.

Parameters
[in]descriptionWhere to store the error description pointer, or NULL.
Returns
The last error code for the calling thread, or GLFW_NO_ERROR (zero).
Errors
None.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the next error occurs or the library is terminated.
Remarks
This function may be called before glfwInit.
Thread safety
This function may be called from any thread.
See also
Error handling
glfwSetErrorCallback
Since
Added in version 3.3.

◆ glfwSetErrorCallback()

GLFWerrorfun glfwSetErrorCallback ( GLFWerrorfun  callback)

This function sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.

The error code is set before the callback is called. Calling glfwGetError from the error callback will return the same value as the error code argument.

The error callback is called on the thread where the error occurred. If you are using GLFW from multiple threads, your error callback needs to be written accordingly.

Because the description string may have been generated specifically for that error, it is not guaranteed to be valid after the callback has returned. If you wish to use it after the callback returns, you need to make a copy.

Once set, the error callback remains set even after the library has been terminated.

Parameters
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set.
Callback signature
void callback_name(int error_code, const char* description)
For more information about the callback parameters, see the callback pointer type.
Errors
None.
Remarks
This function may be called before glfwInit.
Thread safety
This function must only be called from the main thread.
See also
Error handling
glfwGetError
Since
Added in version 3.0.
================================================ FILE: thirdparty/glfw/docs/html/group__input.html ================================================ GLFW: Input reference
Input reference

Description

This is the reference documentation for input related functions and types. For more task-oriented information, see the Input guide.

Modules

 Gamepad axes
 Gamepad axes.
 
 Gamepad buttons
 Gamepad buttons.
 
 Joystick hat states
 Joystick hat states.
 
 Joysticks
 Joystick IDs.
 
 Keyboard keys
 Keyboard key IDs.
 
 Modifier key flags
 Modifier key flags.
 
 Mouse buttons
 Mouse button IDs.
 
 Standard cursor shapes
 Standard system cursor shapes.
 

Typedefs

typedef struct GLFWcursor GLFWcursor
 Opaque cursor object. More...
 
typedef void(* GLFWmousebuttonfun) (GLFWwindow *, int, int, int)
 The function pointer type for mouse button callbacks. More...
 
typedef void(* GLFWcursorposfun) (GLFWwindow *, double, double)
 The function pointer type for cursor position callbacks. More...
 
typedef void(* GLFWcursorenterfun) (GLFWwindow *, int)
 The function pointer type for cursor enter/leave callbacks. More...
 
typedef void(* GLFWscrollfun) (GLFWwindow *, double, double)
 The function pointer type for scroll callbacks. More...
 
typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)
 The function pointer type for keyboard key callbacks. More...
 
typedef void(* GLFWcharfun) (GLFWwindow *, unsigned int)
 The function pointer type for Unicode character callbacks. More...
 
typedef void(* GLFWcharmodsfun) (GLFWwindow *, unsigned int, int)
 The function pointer type for Unicode character with modifiers callbacks. More...
 
typedef void(* GLFWdropfun) (GLFWwindow *, int, const char *[])
 The function pointer type for path drop callbacks. More...
 
typedef void(* GLFWjoystickfun) (int, int)
 The function pointer type for joystick configuration callbacks. More...
 
typedef struct GLFWgamepadstate GLFWgamepadstate
 Gamepad input state. More...
 

Functions

int glfwGetInputMode (GLFWwindow *window, int mode)
 Returns the value of an input option for the specified window. More...
 
void glfwSetInputMode (GLFWwindow *window, int mode, int value)
 Sets an input option for the specified window. More...
 
int glfwRawMouseMotionSupported (void)
 Returns whether raw mouse motion is supported. More...
 
const char * glfwGetKeyName (int key, int scancode)
 Returns the layout-specific name of the specified printable key. More...
 
int glfwGetKeyScancode (int key)
 Returns the platform-specific scancode of the specified key. More...
 
int glfwGetKey (GLFWwindow *window, int key)
 Returns the last reported state of a keyboard key for the specified window. More...
 
int glfwGetMouseButton (GLFWwindow *window, int button)
 Returns the last reported state of a mouse button for the specified window. More...
 
void glfwGetCursorPos (GLFWwindow *window, double *xpos, double *ypos)
 Retrieves the position of the cursor relative to the content area of the window. More...
 
void glfwSetCursorPos (GLFWwindow *window, double xpos, double ypos)
 Sets the position of the cursor, relative to the content area of the window. More...
 
GLFWcursorglfwCreateCursor (const GLFWimage *image, int xhot, int yhot)
 Creates a custom cursor. More...
 
GLFWcursorglfwCreateStandardCursor (int shape)
 Creates a cursor with a standard shape. More...
 
void glfwDestroyCursor (GLFWcursor *cursor)
 Destroys a cursor. More...
 
void glfwSetCursor (GLFWwindow *window, GLFWcursor *cursor)
 Sets the cursor for the window. More...
 
GLFWkeyfun glfwSetKeyCallback (GLFWwindow *window, GLFWkeyfun callback)
 Sets the key callback. More...
 
GLFWcharfun glfwSetCharCallback (GLFWwindow *window, GLFWcharfun callback)
 Sets the Unicode character callback. More...
 
GLFWcharmodsfun glfwSetCharModsCallback (GLFWwindow *window, GLFWcharmodsfun callback)
 Sets the Unicode character with modifiers callback. More...
 
GLFWmousebuttonfun glfwSetMouseButtonCallback (GLFWwindow *window, GLFWmousebuttonfun callback)
 Sets the mouse button callback. More...
 
GLFWcursorposfun glfwSetCursorPosCallback (GLFWwindow *window, GLFWcursorposfun callback)
 Sets the cursor position callback. More...
 
GLFWcursorenterfun glfwSetCursorEnterCallback (GLFWwindow *window, GLFWcursorenterfun callback)
 Sets the cursor enter/leave callback. More...
 
GLFWscrollfun glfwSetScrollCallback (GLFWwindow *window, GLFWscrollfun callback)
 Sets the scroll callback. More...
 
GLFWdropfun glfwSetDropCallback (GLFWwindow *window, GLFWdropfun callback)
 Sets the path drop callback. More...
 
int glfwJoystickPresent (int jid)
 Returns whether the specified joystick is present. More...
 
const float * glfwGetJoystickAxes (int jid, int *count)
 Returns the values of all axes of the specified joystick. More...
 
const unsigned char * glfwGetJoystickButtons (int jid, int *count)
 Returns the state of all buttons of the specified joystick. More...
 
const unsigned char * glfwGetJoystickHats (int jid, int *count)
 Returns the state of all hats of the specified joystick. More...
 
const char * glfwGetJoystickName (int jid)
 Returns the name of the specified joystick. More...
 
const char * glfwGetJoystickGUID (int jid)
 Returns the SDL compatible GUID of the specified joystick. More...
 
void glfwSetJoystickUserPointer (int jid, void *pointer)
 Sets the user pointer of the specified joystick. More...
 
void * glfwGetJoystickUserPointer (int jid)
 Returns the user pointer of the specified joystick. More...
 
int glfwJoystickIsGamepad (int jid)
 Returns whether the specified joystick has a gamepad mapping. More...
 
GLFWjoystickfun glfwSetJoystickCallback (GLFWjoystickfun callback)
 Sets the joystick configuration callback. More...
 
int glfwUpdateGamepadMappings (const char *string)
 Adds the specified SDL_GameControllerDB gamepad mappings. More...
 
const char * glfwGetGamepadName (int jid)
 Returns the human-readable gamepad name for the specified joystick. More...
 
int glfwGetGamepadState (int jid, GLFWgamepadstate *state)
 Retrieves the state of the specified joystick remapped as a gamepad. More...
 
void glfwSetClipboardString (GLFWwindow *window, const char *string)
 Sets the clipboard to the specified string. More...
 
const char * glfwGetClipboardString (GLFWwindow *window)
 Returns the contents of the clipboard as a string. More...
 
double glfwGetTime (void)
 Returns the GLFW time. More...
 
void glfwSetTime (double time)
 Sets the GLFW time. More...
 
uint64_t glfwGetTimerValue (void)
 Returns the current value of the raw timer. More...
 
uint64_t glfwGetTimerFrequency (void)
 Returns the frequency, in Hz, of the raw timer. More...
 

Macro Definition Documentation

◆ GLFW_RELEASE

#define GLFW_RELEASE   0

The key or mouse button was released.

◆ GLFW_PRESS

#define GLFW_PRESS   1

The key or mouse button was pressed.

◆ GLFW_REPEAT

#define GLFW_REPEAT   2

The key was held down until it repeated.

Typedef Documentation

◆ GLFWcursor

typedef struct GLFWcursor GLFWcursor

Opaque cursor object.

See also
Cursor objects
Since
Added in version 3.1.

◆ GLFWmousebuttonfun

typedef void(* GLFWmousebuttonfun) (GLFWwindow *, int, int, int)

This is the function pointer type for mouse button callback functions. A mouse button callback function has the following signature:

void function_name(GLFWwindow* window, int button, int action, int mods)
Parameters
[in]windowThe window that received the event.
[in]buttonThe mouse button that was pressed or released.
[in]actionOne of GLFW_PRESS or GLFW_RELEASE. Future releases may add more actions.
[in]modsBit field describing which modifier keys were held down.
See also
Mouse button input
glfwSetMouseButtonCallback
Since
Added in version 1.0. GLFW 3: Added window handle and modifier mask parameters.

◆ GLFWcursorposfun

typedef void(* GLFWcursorposfun) (GLFWwindow *, double, double)

This is the function pointer type for cursor position callbacks. A cursor position callback function has the following signature:

void function_name(GLFWwindow* window, double xpos, double ypos);
Parameters
[in]windowThe window that received the event.
[in]xposThe new cursor x-coordinate, relative to the left edge of the content area.
[in]yposThe new cursor y-coordinate, relative to the top edge of the content area.
See also
Cursor position
glfwSetCursorPosCallback
Since
Added in version 3.0. Replaces GLFWmouseposfun.

◆ GLFWcursorenterfun

typedef void(* GLFWcursorenterfun) (GLFWwindow *, int)

This is the function pointer type for cursor enter/leave callbacks. A cursor enter/leave callback function has the following signature:

void function_name(GLFWwindow* window, int entered)
Parameters
[in]windowThe window that received the event.
[in]enteredGLFW_TRUE if the cursor entered the window's content area, or GLFW_FALSE if it left it.
See also
Cursor enter/leave events
glfwSetCursorEnterCallback
Since
Added in version 3.0.

◆ GLFWscrollfun

typedef void(* GLFWscrollfun) (GLFWwindow *, double, double)

This is the function pointer type for scroll callbacks. A scroll callback function has the following signature:

void function_name(GLFWwindow* window, double xoffset, double yoffset)
Parameters
[in]windowThe window that received the event.
[in]xoffsetThe scroll offset along the x-axis.
[in]yoffsetThe scroll offset along the y-axis.
See also
Scroll input
glfwSetScrollCallback
Since
Added in version 3.0. Replaces GLFWmousewheelfun.

◆ GLFWkeyfun

typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)

This is the function pointer type for keyboard key callbacks. A keyboard key callback function has the following signature:

void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
Parameters
[in]windowThe window that received the event.
[in]keyThe keyboard key that was pressed or released.
[in]scancodeThe system-specific scancode of the key.
[in]actionGLFW_PRESS, GLFW_RELEASE or GLFW_REPEAT. Future releases may add more actions.
[in]modsBit field describing which modifier keys were held down.
See also
Key input
glfwSetKeyCallback
Since
Added in version 1.0. GLFW 3: Added window handle, scancode and modifier mask parameters.

◆ GLFWcharfun

typedef void(* GLFWcharfun) (GLFWwindow *, unsigned int)

This is the function pointer type for Unicode character callbacks. A Unicode character callback function has the following signature:

void function_name(GLFWwindow* window, unsigned int codepoint)
Parameters
[in]windowThe window that received the event.
[in]codepointThe Unicode code point of the character.
See also
Text input
glfwSetCharCallback
Since
Added in version 2.4. GLFW 3: Added window handle parameter.

◆ GLFWcharmodsfun

typedef void(* GLFWcharmodsfun) (GLFWwindow *, unsigned int, int)

This is the function pointer type for Unicode character with modifiers callbacks. It is called for each input character, regardless of what modifier keys are held down. A Unicode character with modifiers callback function has the following signature:

void function_name(GLFWwindow* window, unsigned int codepoint, int mods)
Parameters
[in]windowThe window that received the event.
[in]codepointThe Unicode code point of the character.
[in]modsBit field describing which modifier keys were held down.
See also
Text input
glfwSetCharModsCallback
Deprecated:
Scheduled for removal in version 4.0.
Since
Added in version 3.1.

◆ GLFWdropfun

typedef void(* GLFWdropfun) (GLFWwindow *, int, const char *[])

This is the function pointer type for path drop callbacks. A path drop callback function has the following signature:

void function_name(GLFWwindow* window, int path_count, const char* paths[])
Parameters
[in]windowThe window that received the event.
[in]path_countThe number of dropped paths.
[in]pathsThe UTF-8 encoded file and/or directory path names.
Pointer lifetime
The path array and its strings are valid until the callback function returns.
See also
Path drop input
glfwSetDropCallback
Since
Added in version 3.1.

◆ GLFWjoystickfun

typedef void(* GLFWjoystickfun) (int, int)

This is the function pointer type for joystick configuration callbacks. A joystick configuration callback function has the following signature:

void function_name(int jid, int event)
Parameters
[in]jidThe joystick that was connected or disconnected.
[in]eventOne of GLFW_CONNECTED or GLFW_DISCONNECTED. Future releases may add more events.
See also
Joystick configuration changes
glfwSetJoystickCallback
Since
Added in version 3.2.

◆ GLFWgamepadstate

This describes the input state of a gamepad.

See also
Gamepad input
glfwGetGamepadState
Since
Added in version 3.3.

Function Documentation

◆ glfwGetInputMode()

int glfwGetInputMode ( GLFWwindow window,
int  mode 
)

This function returns the value of an input option for the specified window. The mode must be one of GLFW_CURSOR, GLFW_STICKY_KEYS, GLFW_STICKY_MOUSE_BUTTONS, GLFW_LOCK_KEY_MODS or GLFW_RAW_MOUSE_MOTION.

Parameters
[in]windowThe window to query.
[in]modeOne of GLFW_CURSOR, GLFW_STICKY_KEYS, GLFW_STICKY_MOUSE_BUTTONS, GLFW_LOCK_KEY_MODS or GLFW_RAW_MOUSE_MOTION.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Thread safety
This function must only be called from the main thread.
See also
glfwSetInputMode
Since
Added in version 3.0.

◆ glfwSetInputMode()

void glfwSetInputMode ( GLFWwindow window,
int  mode,
int  value 
)

This function sets an input mode option for the specified window. The mode must be one of GLFW_CURSOR, GLFW_STICKY_KEYS, GLFW_STICKY_MOUSE_BUTTONS, GLFW_LOCK_KEY_MODS or GLFW_RAW_MOUSE_MOTION.

If the mode is GLFW_CURSOR, the value must be one of the following cursor modes:

  • GLFW_CURSOR_NORMAL makes the cursor visible and behaving normally.
  • GLFW_CURSOR_HIDDEN makes the cursor invisible when it is over the content area of the window but does not restrict the cursor from leaving.
  • GLFW_CURSOR_DISABLED hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls.

If the mode is GLFW_STICKY_KEYS, the value must be either GLFW_TRUE to enable sticky keys, or GLFW_FALSE to disable it. If sticky keys are enabled, a key press will ensure that glfwGetKey returns GLFW_PRESS the next time it is called even if the key had been released before the call. This is useful when you are only interested in whether keys have been pressed but not when or in which order.

If the mode is GLFW_STICKY_MOUSE_BUTTONS, the value must be either GLFW_TRUE to enable sticky mouse buttons, or GLFW_FALSE to disable it. If sticky mouse buttons are enabled, a mouse button press will ensure that glfwGetMouseButton returns GLFW_PRESS the next time it is called even if the mouse button had been released before the call. This is useful when you are only interested in whether mouse buttons have been pressed but not when or in which order.

If the mode is GLFW_LOCK_KEY_MODS, the value must be either GLFW_TRUE to enable lock key modifier bits, or GLFW_FALSE to disable them. If enabled, callbacks that receive modifier bits will also have the GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, and the GLFW_MOD_NUM_LOCK bit when Num Lock was on.

If the mode is GLFW_RAW_MOUSE_MOTION, the value must be either GLFW_TRUE to enable raw (unscaled and unaccelerated) mouse motion when the cursor is disabled, or GLFW_FALSE to disable it. If raw motion is not supported, attempting to set this will emit GLFW_PLATFORM_ERROR. Call glfwRawMouseMotionSupported to check for support.

Parameters
[in]windowThe window whose input mode to set.
[in]modeOne of GLFW_CURSOR, GLFW_STICKY_KEYS, GLFW_STICKY_MOUSE_BUTTONS, GLFW_LOCK_KEY_MODS or GLFW_RAW_MOUSE_MOTION.
[in]valueThe new value of the specified input mode.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
glfwGetInputMode
Since
Added in version 3.0. Replaces glfwEnable and glfwDisable.

◆ glfwRawMouseMotionSupported()

int glfwRawMouseMotionSupported ( void  )

This function returns whether raw mouse motion is supported on the current system. This status does not change after GLFW has been initialized so you only need to check this once. If you attempt to enable raw motion on a system that does not support it, GLFW_PLATFORM_ERROR will be emitted.

Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse motion is only provided when the cursor is disabled.

Returns
GLFW_TRUE if raw mouse motion is supported on the current machine, or GLFW_FALSE otherwise.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Raw mouse motion
glfwSetInputMode
Since
Added in version 3.3.

◆ glfwGetKeyName()

const char* glfwGetKeyName ( int  key,
int  scancode 
)

This function returns the name of the specified printable key, encoded as UTF-8. This is typically the character that key would produce without any modifier keys, intended for displaying key bindings to the user. For dead keys, it is typically the diacritic it would add to a character.

Do not use this function for text input. You will break text input for many languages even if it happens to work for yours.

If the key is GLFW_KEY_UNKNOWN, the scancode is used to identify the key, otherwise the scancode is ignored. If you specify a non-printable key, or GLFW_KEY_UNKNOWN and a scancode that maps to a non-printable key, this function returns NULL but does not emit an error.

This behavior allows you to always pass in the arguments in the key callback without modification.

The printable keys are:

  • GLFW_KEY_APOSTROPHE
  • GLFW_KEY_COMMA
  • GLFW_KEY_MINUS
  • GLFW_KEY_PERIOD
  • GLFW_KEY_SLASH
  • GLFW_KEY_SEMICOLON
  • GLFW_KEY_EQUAL
  • GLFW_KEY_LEFT_BRACKET
  • GLFW_KEY_RIGHT_BRACKET
  • GLFW_KEY_BACKSLASH
  • GLFW_KEY_WORLD_1
  • GLFW_KEY_WORLD_2
  • GLFW_KEY_0 to GLFW_KEY_9
  • GLFW_KEY_A to GLFW_KEY_Z
  • GLFW_KEY_KP_0 to GLFW_KEY_KP_9
  • GLFW_KEY_KP_DECIMAL
  • GLFW_KEY_KP_DIVIDE
  • GLFW_KEY_KP_MULTIPLY
  • GLFW_KEY_KP_SUBTRACT
  • GLFW_KEY_KP_ADD
  • GLFW_KEY_KP_EQUAL

Names for printable keys depend on keyboard layout, while names for non-printable keys are the same across layouts but depend on the application language and should be localized along with other user interface text.

Parameters
[in]keyThe key to query, or GLFW_KEY_UNKNOWN.
[in]scancodeThe scancode of the key to query.
Returns
The UTF-8 encoded, layout-specific name of the key, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
The contents of the returned string may change when a keyboard layout change event is received.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Key names
Since
Added in version 3.2.

◆ glfwGetKeyScancode()

int glfwGetKeyScancode ( int  key)

This function returns the platform-specific scancode of the specified key.

If the key is GLFW_KEY_UNKNOWN or does not exist on the keyboard this method will return -1.

Parameters
[in]keyAny named key.
Returns
The platform-specific scancode for the key, or -1 if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Thread safety
This function may be called from any thread.
See also
Key input
Since
Added in version 3.3.

◆ glfwGetKey()

int glfwGetKey ( GLFWwindow window,
int  key 
)

This function returns the last state reported for the specified key to the specified window. The returned state is one of GLFW_PRESS or GLFW_RELEASE. The higher-level action GLFW_REPEAT is only reported to the key callback.

If the GLFW_STICKY_KEYS input mode is enabled, this function returns GLFW_PRESS the first time you call it for a key that was pressed, even if that key has already been released.

The key functions deal with physical keys, with key tokens named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.

The modifier key bit masks are not key tokens and cannot be used with this function.

Do not use this function to implement text input.

Parameters
[in]windowThe desired window.
[in]keyThe desired keyboard key. GLFW_KEY_UNKNOWN is not a valid key for this function.
Returns
One of GLFW_PRESS or GLFW_RELEASE.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Thread safety
This function must only be called from the main thread.
See also
Key input
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwGetMouseButton()

int glfwGetMouseButton ( GLFWwindow window,
int  button 
)

This function returns the last state reported for the specified mouse button to the specified window. The returned state is one of GLFW_PRESS or GLFW_RELEASE.

If the GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function returns GLFW_PRESS the first time you call it for a mouse button that was pressed, even if that mouse button has already been released.

Parameters
[in]windowThe desired window.
[in]buttonThe desired mouse button.
Returns
One of GLFW_PRESS or GLFW_RELEASE.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Thread safety
This function must only be called from the main thread.
See also
Mouse button input
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwGetCursorPos()

void glfwGetCursorPos ( GLFWwindow window,
double *  xpos,
double *  ypos 
)

This function returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the content area of the specified window.

If the cursor is disabled (with GLFW_CURSOR_DISABLED) then the cursor position is unbounded and limited only by the minimum and maximum values of a double.

The coordinate can be converted to their integer equivalents with the floor function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.

Any or all of the position arguments may be NULL. If an error occurs, all non-NULL position arguments will be set to zero.

Parameters
[in]windowThe desired window.
[out]xposWhere to store the cursor x-coordinate, relative to the left edge of the content area, or NULL.
[out]yposWhere to store the cursor y-coordinate, relative to the to top edge of the content area, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Cursor position
glfwSetCursorPos
Since
Added in version 3.0. Replaces glfwGetMousePos.

◆ glfwSetCursorPos()

void glfwSetCursorPos ( GLFWwindow window,
double  xpos,
double  ypos 
)

This function sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the content area of the specified window. The window must have input focus. If the window does not have input focus when this function is called, it fails silently.

Do not use this function to implement things like camera controls. GLFW already provides the GLFW_CURSOR_DISABLED cursor mode that hides the cursor, transparently re-centers it and provides unconstrained cursor motion. See glfwSetInputMode for more information.

If the cursor mode is GLFW_CURSOR_DISABLED then the cursor position is unconstrained and limited only by the minimum and maximum values of a double.

Parameters
[in]windowThe desired window.
[in]xposThe desired x-coordinate, relative to the left edge of the content area.
[in]yposThe desired y-coordinate, relative to the top edge of the content area.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: This function will only work when the cursor mode is GLFW_CURSOR_DISABLED, otherwise it will do nothing.
Thread safety
This function must only be called from the main thread.
See also
Cursor position
glfwGetCursorPos
Since
Added in version 3.0. Replaces glfwSetMousePos.

◆ glfwCreateCursor()

GLFWcursor* glfwCreateCursor ( const GLFWimage image,
int  xhot,
int  yhot 
)

Creates a new custom cursor image that can be set for a window with glfwSetCursor. The cursor can be destroyed with glfwDestroyCursor. Any remaining cursors are destroyed by glfwTerminate.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.

Parameters
[in]imageThe desired cursor image.
[in]xhotThe desired x-coordinate, in pixels, of the cursor hotspot.
[in]yhotThe desired y-coordinate, in pixels, of the cursor hotspot.
Returns
The handle of the created cursor, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The specified image data is copied before this function returns.
Thread safety
This function must only be called from the main thread.
See also
Cursor objects
glfwDestroyCursor
glfwCreateStandardCursor
Since
Added in version 3.1.

◆ glfwCreateStandardCursor()

GLFWcursor* glfwCreateStandardCursor ( int  shape)

Returns a cursor with a standard shape, that can be set for a window with glfwSetCursor.

Parameters
[in]shapeOne of the standard shapes.
Returns
A new cursor ready to use or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Cursor objects
glfwCreateCursor
Since
Added in version 3.1.

◆ glfwDestroyCursor()

void glfwDestroyCursor ( GLFWcursor cursor)

This function destroys a cursor previously created with glfwCreateCursor. Any remaining cursors will be destroyed by glfwTerminate.

If the specified cursor is current for any window, that window will be reverted to the default cursor. This does not affect the cursor mode.

Parameters
[in]cursorThe cursor object to destroy.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Reentrancy
This function must not be called from a callback.
Thread safety
This function must only be called from the main thread.
See also
Cursor objects
glfwCreateCursor
Since
Added in version 3.1.

◆ glfwSetCursor()

void glfwSetCursor ( GLFWwindow window,
GLFWcursor cursor 
)

This function sets the cursor image to be used when the cursor is over the content area of the specified window. The set cursor will only be visible when the cursor mode of the window is GLFW_CURSOR_NORMAL.

On some platforms, the set cursor may not be visible unless the window also has input focus.

Parameters
[in]windowThe window to set the cursor for.
[in]cursorThe cursor to set, or NULL to switch back to the default arrow cursor.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Cursor objects
Since
Added in version 3.1.

◆ glfwSetKeyCallback()

GLFWkeyfun glfwSetKeyCallback ( GLFWwindow window,
GLFWkeyfun  callback 
)

This function sets the key callback of the specified window, which is called when a key is pressed, repeated or released.

The key functions deal with physical keys, with layout independent key tokens named after their values in the standard US keyboard layout. If you want to input text, use the character callback instead.

When a window loses input focus, it will generate synthetic key release events for all pressed keys. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the window focus callback has been called.

The scancode of a key is specific to that platform or sometimes even to that machine. Scancodes are intended to allow users to bind keys that don't have a GLFW key token. Such keys have key set to GLFW_KEY_UNKNOWN, their state is not saved and so it cannot be queried with glfwGetKey.

Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new key callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Key input
Since
Added in version 1.0. GLFW 3: Added window handle parameter and return value.

◆ glfwSetCharCallback()

GLFWcharfun glfwSetCharCallback ( GLFWwindow window,
GLFWcharfun  callback 
)

This function sets the character callback of the specified window, which is called when a Unicode character is input.

The character callback is intended for Unicode text input. As it deals with characters, it is keyboard layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.

The character callback behaves as system text input normally does and will not be called if modifier keys are held down that would prevent normal text input on that platform, for example a Super (Command) key on macOS or Alt key on Windows.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, unsigned int codepoint)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Text input
Since
Added in version 2.4. GLFW 3: Added window handle parameter and return value.

◆ glfwSetCharModsCallback()

GLFWcharmodsfun glfwSetCharModsCallback ( GLFWwindow window,
GLFWcharmodsfun  callback 
)

This function sets the character with modifiers callback of the specified window, which is called when a Unicode character is input regardless of what modifier keys are used.

The character with modifiers callback is intended for implementing custom Unicode character input. For regular Unicode text input, see the character callback. Like the character callback, the character with modifiers callback deals with characters and is keyboard layout dependent. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or an error occurred.
Callback signature
void function_name(GLFWwindow* window, unsigned int codepoint, int mods)
For more information about the callback parameters, see the function pointer type.
Deprecated:
Scheduled for removal in version 4.0.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Text input
Since
Added in version 3.1.

◆ glfwSetMouseButtonCallback()

GLFWmousebuttonfun glfwSetMouseButtonCallback ( GLFWwindow window,
GLFWmousebuttonfun  callback 
)

This function sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.

When a window loses input focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the window focus callback has been called.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int button, int action, int mods)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Mouse button input
Since
Added in version 1.0. GLFW 3: Added window handle parameter and return value.

◆ glfwSetCursorPosCallback()

GLFWcursorposfun glfwSetCursorPosCallback ( GLFWwindow window,
GLFWcursorposfun  callback 
)

This function sets the cursor position callback of the specified window, which is called when the cursor is moved. The callback is provided with the position, in screen coordinates, relative to the upper-left corner of the content area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, double xpos, double ypos);
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Cursor position
Since
Added in version 3.0. Replaces glfwSetMousePosCallback.

◆ glfwSetCursorEnterCallback()

GLFWcursorenterfun glfwSetCursorEnterCallback ( GLFWwindow window,
GLFWcursorenterfun  callback 
)

This function sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the content area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int entered)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Cursor enter/leave events
Since
Added in version 3.0.

◆ glfwSetScrollCallback()

GLFWscrollfun glfwSetScrollCallback ( GLFWwindow window,
GLFWscrollfun  callback 
)

This function sets the scroll callback of the specified window, which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.

The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new scroll callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, double xoffset, double yoffset)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Scroll input
Since
Added in version 3.0. Replaces glfwSetMouseWheelCallback.

◆ glfwSetDropCallback()

GLFWdropfun glfwSetDropCallback ( GLFWwindow window,
GLFWdropfun  callback 
)

This function sets the path drop callback of the specified window, which is called when one or more dragged paths are dropped on the window.

Because the path array and its strings may have been generated specifically for that event, they are not guaranteed to be valid after the callback has returned. If you wish to use them after the callback returns, you need to make a deep copy.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new file drop callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int path_count, const char* paths[])
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Remarks
Wayland: File drop is currently unimplemented.
Thread safety
This function must only be called from the main thread.
See also
Path drop input
Since
Added in version 3.1.

◆ glfwJoystickPresent()

int glfwJoystickPresent ( int  jid)

This function returns whether the specified joystick is present.

There is no need to call this function before other functions that accept a joystick ID, as they all check for presence before performing any other work.

Parameters
[in]jidThe joystick to query.
Returns
GLFW_TRUE if the joystick is present, or GLFW_FALSE otherwise.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Joystick input
Since
Added in version 3.0. Replaces glfwGetJoystickParam.

◆ glfwGetJoystickAxes()

const float* glfwGetJoystickAxes ( int  jid,
int *  count 
)

This function returns the values of all axes of the specified joystick. Each element in the array is a value between -1.0 and 1.0.

If the specified joystick is not present this function will return NULL but will not generate an error. This can be used instead of first calling glfwJoystickPresent.

Parameters
[in]jidThe joystick to query.
[out]countWhere to store the number of axis values in the returned array. This is set to zero if the joystick is not present or an error occurred.
Returns
An array of axis values, or NULL if the joystick is not present or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Joystick axis states
Since
Added in version 3.0. Replaces glfwGetJoystickPos.

◆ glfwGetJoystickButtons()

const unsigned char* glfwGetJoystickButtons ( int  jid,
int *  count 
)

This function returns the state of all buttons of the specified joystick. Each element in the array is either GLFW_PRESS or GLFW_RELEASE.

For backward compatibility with earlier versions that did not have glfwGetJoystickHats, the button array also includes all hats, each represented as four buttons. The hats are in the same order as returned by glfwGetJoystickHats and are in the order up, right, down and left. To disable these extra buttons, set the GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.

If the specified joystick is not present this function will return NULL but will not generate an error. This can be used instead of first calling glfwJoystickPresent.

Parameters
[in]jidThe joystick to query.
[out]countWhere to store the number of button states in the returned array. This is set to zero if the joystick is not present or an error occurred.
Returns
An array of button states, or NULL if the joystick is not present or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Joystick button states
Since
Added in version 2.2. GLFW 3: Changed to return a dynamic array.

◆ glfwGetJoystickHats()

const unsigned char* glfwGetJoystickHats ( int  jid,
int *  count 
)

This function returns the state of all hats of the specified joystick. Each element in the array is one of the following values:

Name Value
GLFW_HAT_CENTERED 0
GLFW_HAT_UP 1
GLFW_HAT_RIGHT 2
GLFW_HAT_DOWN 4
GLFW_HAT_LEFT 8
GLFW_HAT_RIGHT_UP GLFW_HAT_RIGHT | GLFW_HAT_UP
GLFW_HAT_RIGHT_DOWN GLFW_HAT_RIGHT | GLFW_HAT_DOWN
GLFW_HAT_LEFT_UP GLFW_HAT_LEFT | GLFW_HAT_UP
GLFW_HAT_LEFT_DOWN GLFW_HAT_LEFT | GLFW_HAT_DOWN

The diagonal directions are bitwise combinations of the primary (up, right, down and left) directions and you can test for these individually by ANDing it with the corresponding direction.

if (hats[2] & GLFW_HAT_RIGHT)
{
// State of hat 2 could be right-up, right or right-down
}

If the specified joystick is not present this function will return NULL but will not generate an error. This can be used instead of first calling glfwJoystickPresent.

Parameters
[in]jidThe joystick to query.
[out]countWhere to store the number of hat states in the returned array. This is set to zero if the joystick is not present or an error occurred.
Returns
An array of hat states, or NULL if the joystick is not present or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, this function is called again for that joystick or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Joystick hat states
Since
Added in version 3.3.

◆ glfwGetJoystickName()

const char* glfwGetJoystickName ( int  jid)

This function returns the name, encoded as UTF-8, of the specified joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.

If the specified joystick is not present this function will return NULL but will not generate an error. This can be used instead of first calling glfwJoystickPresent.

Parameters
[in]jidThe joystick to query.
Returns
The UTF-8 encoded name of the joystick, or NULL if the joystick is not present or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Joystick name
Since
Added in version 3.0.

◆ glfwGetJoystickGUID()

const char* glfwGetJoystickGUID ( int  jid)

This function returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.

The GUID is what connects a joystick to a gamepad mapping. A connected joystick will always have a GUID even if there is no gamepad mapping assigned to it.

If the specified joystick is not present this function will return NULL but will not generate an error. This can be used instead of first calling glfwJoystickPresent.

The GUID uses the format introduced in SDL 2.0.5. This GUID tries to uniquely identify the make and model of a joystick but does not identify a specific unit, e.g. all wired Xbox 360 controllers will have the same GUID on that platform. The GUID for a unit may vary between platforms depending on what hardware information the platform specific APIs provide.

Parameters
[in]jidThe joystick to query.
Returns
The UTF-8 encoded GUID of the joystick, or NULL if the joystick is not present or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Gamepad input
Since
Added in version 3.3.

◆ glfwSetJoystickUserPointer()

void glfwSetJoystickUserPointer ( int  jid,
void *  pointer 
)

This function sets the user-defined pointer of the specified joystick. The current value is retained until the joystick is disconnected. The initial value is NULL.

This function may be called from the joystick callback, even for a joystick that is being disconnected.

Parameters
[in]jidThe joystick whose pointer to set.
[in]pointerThe new value.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
Joystick user pointer
glfwGetJoystickUserPointer
Since
Added in version 3.3.

◆ glfwGetJoystickUserPointer()

void* glfwGetJoystickUserPointer ( int  jid)

This function returns the current value of the user-defined pointer of the specified joystick. The initial value is NULL.

This function may be called from the joystick callback, even for a joystick that is being disconnected.

Parameters
[in]jidThe joystick whose pointer to return.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
Joystick user pointer
glfwSetJoystickUserPointer
Since
Added in version 3.3.

◆ glfwJoystickIsGamepad()

int glfwJoystickIsGamepad ( int  jid)

This function returns whether the specified joystick is both present and has a gamepad mapping.

If the specified joystick is present but does not have a gamepad mapping this function will return GLFW_FALSE but will not generate an error. Call glfwJoystickPresent to check if a joystick is present regardless of whether it has a mapping.

Parameters
[in]jidThe joystick to query.
Returns
GLFW_TRUE if a joystick is both present and has a gamepad mapping, or GLFW_FALSE otherwise.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Thread safety
This function must only be called from the main thread.
See also
Gamepad input
glfwGetGamepadState
Since
Added in version 3.3.

◆ glfwSetJoystickCallback()

GLFWjoystickfun glfwSetJoystickCallback ( GLFWjoystickfun  callback)

This function sets the joystick configuration callback, or removes the currently set callback. This is called when a joystick is connected to or disconnected from the system.

For joystick connection and disconnection events to be delivered on all platforms, you need to call one of the event processing functions. Joystick disconnection may also be detected and the callback called by joystick functions. The function will then return whatever it returns if the joystick is not present.

Parameters
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(int jid, int event)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Joystick configuration changes
Since
Added in version 3.2.

◆ glfwUpdateGamepadMappings()

int glfwUpdateGamepadMappings ( const char *  string)

This function parses the specified ASCII encoded string and updates the internal list with any gamepad mappings it finds. This string may contain either a single gamepad mapping or many mappings separated by newlines. The parser supports the full format of the gamecontrollerdb.txt source file including empty lines and comments.

See Gamepad mappings for a description of the format.

If there is already a gamepad mapping for a given GUID in the internal list, it will be replaced by the one passed to this function. If the library is terminated and re-initialized the internal list will revert to the built-in default.

Parameters
[in]stringThe string containing the gamepad mappings.
Returns
GLFW_TRUE if successful, or GLFW_FALSE if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_VALUE.
Thread safety
This function must only be called from the main thread.
See also
Gamepad input
glfwJoystickIsGamepad
glfwGetGamepadName
Since
Added in version 3.3.

◆ glfwGetGamepadName()

const char* glfwGetGamepadName ( int  jid)

This function returns the human-readable name of the gamepad from the gamepad mapping assigned to the specified joystick.

If the specified joystick is not present or does not have a gamepad mapping this function will return NULL but will not generate an error. Call glfwJoystickPresent to check whether it is present regardless of whether it has a mapping.

Parameters
[in]jidThe joystick to query.
Returns
The UTF-8 encoded name of the gamepad, or NULL if the joystick is not present, does not have a mapping or an error occurred.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, the gamepad mappings are updated or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Gamepad input
glfwJoystickIsGamepad
Since
Added in version 3.3.

◆ glfwGetGamepadState()

int glfwGetGamepadState ( int  jid,
GLFWgamepadstate state 
)

This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.

If the specified joystick is not present or does not have a gamepad mapping this function will return GLFW_FALSE but will not generate an error. Call glfwJoystickPresent to check whether it is present regardless of whether it has a mapping.

The Guide button may not be available for input as it is often hooked by the system or the Steam client.

Not all devices have all the buttons or axes provided by GLFWgamepadstate. Unavailable buttons and axes will always report GLFW_RELEASE and 0.0 respectively.

Parameters
[in]jidThe joystick to query.
[out]stateThe gamepad input state of the joystick.
Returns
GLFW_TRUE if successful, or GLFW_FALSE if no joystick is connected, it has no gamepad mapping or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Thread safety
This function must only be called from the main thread.
See also
Gamepad input
glfwUpdateGamepadMappings
glfwJoystickIsGamepad
Since
Added in version 3.3.

◆ glfwSetClipboardString()

void glfwSetClipboardString ( GLFWwindow window,
const char *  string 
)

This function sets the system clipboard to the specified, UTF-8 encoded string.

Parameters
[in]windowDeprecated. Any valid window or NULL.
[in]stringA UTF-8 encoded string.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The specified string is copied before this function returns.
Thread safety
This function must only be called from the main thread.
See also
Clipboard input and output
glfwGetClipboardString
Since
Added in version 3.0.

◆ glfwGetClipboardString()

const char* glfwGetClipboardString ( GLFWwindow window)

This function returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string. If the clipboard is empty or if its contents cannot be converted, NULL is returned and a GLFW_FORMAT_UNAVAILABLE error is generated.

Parameters
[in]windowDeprecated. Any valid window or NULL.
Returns
The contents of the clipboard as a UTF-8 encoded string, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the next call to glfwGetClipboardString or glfwSetClipboardString, or until the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Clipboard input and output
glfwSetClipboardString
Since
Added in version 3.0.

◆ glfwGetTime()

double glfwGetTime ( void  )

This function returns the current GLFW time, in seconds. Unless the time has been set using glfwSetTime it measures time elapsed since GLFW was initialized.

This function and glfwSetTime are helper functions on top of glfwGetTimerFrequency and glfwGetTimerValue.

The resolution of the timer is system dependent, but is usually on the order of a few micro- or nanoseconds. It uses the highest-resolution monotonic time source on each supported platform.

Returns
The current time, in seconds, or zero if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Reading and writing of the internal base time is not atomic, so it needs to be externally synchronized with calls to glfwSetTime.
See also
Time input
Since
Added in version 1.0.

◆ glfwSetTime()

void glfwSetTime ( double  time)

This function sets the current GLFW time, in seconds. The value must be a positive finite number less than or equal to 18446744073.0, which is approximately 584.5 years.

This function and glfwGetTime are helper functions on top of glfwGetTimerFrequency and glfwGetTimerValue.

Parameters
[in]timeThe new value, in seconds.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_VALUE.
Remarks
The upper limit of GLFW time is calculated as floor((264 - 1) / 109) and is due to implementations storing nanoseconds in 64 bits. The limit may be increased in the future.
Thread safety
This function may be called from any thread. Reading and writing of the internal base time is not atomic, so it needs to be externally synchronized with calls to glfwGetTime.
See also
Time input
Since
Added in version 2.2.

◆ glfwGetTimerValue()

uint64_t glfwGetTimerValue ( void  )

This function returns the current value of the raw timer, measured in 1 / frequency seconds. To get the frequency, call glfwGetTimerFrequency.

Returns
The value of the timer, or zero if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread.
See also
Time input
glfwGetTimerFrequency
Since
Added in version 3.2.

◆ glfwGetTimerFrequency()

uint64_t glfwGetTimerFrequency ( void  )

This function returns the frequency, in Hz, of the raw timer.

Returns
The frequency of the timer, in Hz, or zero if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread.
See also
Time input
glfwGetTimerValue
Since
Added in version 3.2.
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1152
#define GLFW_HAT_RIGHT
Definition: glfw3.h:325
================================================ FILE: thirdparty/glfw/docs/html/group__joysticks.html ================================================ GLFW: Joysticks

Description

See joystick input for how these are used.

Macros

#define GLFW_JOYSTICK_1   0
 
#define GLFW_JOYSTICK_2   1
 
#define GLFW_JOYSTICK_3   2
 
#define GLFW_JOYSTICK_4   3
 
#define GLFW_JOYSTICK_5   4
 
#define GLFW_JOYSTICK_6   5
 
#define GLFW_JOYSTICK_7   6
 
#define GLFW_JOYSTICK_8   7
 
#define GLFW_JOYSTICK_9   8
 
#define GLFW_JOYSTICK_10   9
 
#define GLFW_JOYSTICK_11   10
 
#define GLFW_JOYSTICK_12   11
 
#define GLFW_JOYSTICK_13   12
 
#define GLFW_JOYSTICK_14   13
 
#define GLFW_JOYSTICK_15   14
 
#define GLFW_JOYSTICK_16   15
 
#define GLFW_JOYSTICK_LAST   GLFW_JOYSTICK_16
 

Macro Definition Documentation

◆ GLFW_JOYSTICK_1

#define GLFW_JOYSTICK_1   0

◆ GLFW_JOYSTICK_2

#define GLFW_JOYSTICK_2   1

◆ GLFW_JOYSTICK_3

#define GLFW_JOYSTICK_3   2

◆ GLFW_JOYSTICK_4

#define GLFW_JOYSTICK_4   3

◆ GLFW_JOYSTICK_5

#define GLFW_JOYSTICK_5   4

◆ GLFW_JOYSTICK_6

#define GLFW_JOYSTICK_6   5

◆ GLFW_JOYSTICK_7

#define GLFW_JOYSTICK_7   6

◆ GLFW_JOYSTICK_8

#define GLFW_JOYSTICK_8   7

◆ GLFW_JOYSTICK_9

#define GLFW_JOYSTICK_9   8

◆ GLFW_JOYSTICK_10

#define GLFW_JOYSTICK_10   9

◆ GLFW_JOYSTICK_11

#define GLFW_JOYSTICK_11   10

◆ GLFW_JOYSTICK_12

#define GLFW_JOYSTICK_12   11

◆ GLFW_JOYSTICK_13

#define GLFW_JOYSTICK_13   12

◆ GLFW_JOYSTICK_14

#define GLFW_JOYSTICK_14   13

◆ GLFW_JOYSTICK_15

#define GLFW_JOYSTICK_15   14

◆ GLFW_JOYSTICK_16

#define GLFW_JOYSTICK_16   15

◆ GLFW_JOYSTICK_LAST

#define GLFW_JOYSTICK_LAST   GLFW_JOYSTICK_16
================================================ FILE: thirdparty/glfw/docs/html/group__keys.html ================================================ GLFW: Keyboard keys
Keyboard keys

Description

See key input for how these are used.

These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), but re-arranged to map to 7-bit ASCII for printable keys (function keys are put in the 256+ range).

The naming of the key codes follow these rules:

  • The US keyboard layout is used
  • Names of printable alpha-numeric characters are used (e.g. "A", "R", "3", etc.)
  • For non-alphanumeric characters, Unicode:ish names are used (e.g. "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not correspond to the Unicode standard (usually for brevity)
  • Keys that lack a clear US mapping are named "WORLD_x"
  • For non-printable keys, custom names are used (e.g. "F4", "BACKSPACE", etc.)

Macros

#define GLFW_KEY_UNKNOWN   -1
 
#define GLFW_KEY_SPACE   32
 
#define GLFW_KEY_APOSTROPHE   39 /* ' */
 
#define GLFW_KEY_COMMA   44 /* , */
 
#define GLFW_KEY_MINUS   45 /* - */
 
#define GLFW_KEY_PERIOD   46 /* . */
 
#define GLFW_KEY_SLASH   47 /* / */
 
#define GLFW_KEY_0   48
 
#define GLFW_KEY_1   49
 
#define GLFW_KEY_2   50
 
#define GLFW_KEY_3   51
 
#define GLFW_KEY_4   52
 
#define GLFW_KEY_5   53
 
#define GLFW_KEY_6   54
 
#define GLFW_KEY_7   55
 
#define GLFW_KEY_8   56
 
#define GLFW_KEY_9   57
 
#define GLFW_KEY_SEMICOLON   59 /* ; */
 
#define GLFW_KEY_EQUAL   61 /* = */
 
#define GLFW_KEY_A   65
 
#define GLFW_KEY_B   66
 
#define GLFW_KEY_C   67
 
#define GLFW_KEY_D   68
 
#define GLFW_KEY_E   69
 
#define GLFW_KEY_F   70
 
#define GLFW_KEY_G   71
 
#define GLFW_KEY_H   72
 
#define GLFW_KEY_I   73
 
#define GLFW_KEY_J   74
 
#define GLFW_KEY_K   75
 
#define GLFW_KEY_L   76
 
#define GLFW_KEY_M   77
 
#define GLFW_KEY_N   78
 
#define GLFW_KEY_O   79
 
#define GLFW_KEY_P   80
 
#define GLFW_KEY_Q   81
 
#define GLFW_KEY_R   82
 
#define GLFW_KEY_S   83
 
#define GLFW_KEY_T   84
 
#define GLFW_KEY_U   85
 
#define GLFW_KEY_V   86
 
#define GLFW_KEY_W   87
 
#define GLFW_KEY_X   88
 
#define GLFW_KEY_Y   89
 
#define GLFW_KEY_Z   90
 
#define GLFW_KEY_LEFT_BRACKET   91 /* [ */
 
#define GLFW_KEY_BACKSLASH   92 /* \ */
 
#define GLFW_KEY_RIGHT_BRACKET   93 /* ] */
 
#define GLFW_KEY_GRAVE_ACCENT   96 /* ` */
 
#define GLFW_KEY_WORLD_1   161 /* non-US #1 */
 
#define GLFW_KEY_WORLD_2   162 /* non-US #2 */
 
#define GLFW_KEY_ESCAPE   256
 
#define GLFW_KEY_ENTER   257
 
#define GLFW_KEY_TAB   258
 
#define GLFW_KEY_BACKSPACE   259
 
#define GLFW_KEY_INSERT   260
 
#define GLFW_KEY_DELETE   261
 
#define GLFW_KEY_RIGHT   262
 
#define GLFW_KEY_LEFT   263
 
#define GLFW_KEY_DOWN   264
 
#define GLFW_KEY_UP   265
 
#define GLFW_KEY_PAGE_UP   266
 
#define GLFW_KEY_PAGE_DOWN   267
 
#define GLFW_KEY_HOME   268
 
#define GLFW_KEY_END   269
 
#define GLFW_KEY_CAPS_LOCK   280
 
#define GLFW_KEY_SCROLL_LOCK   281
 
#define GLFW_KEY_NUM_LOCK   282
 
#define GLFW_KEY_PRINT_SCREEN   283
 
#define GLFW_KEY_PAUSE   284
 
#define GLFW_KEY_F1   290
 
#define GLFW_KEY_F2   291
 
#define GLFW_KEY_F3   292
 
#define GLFW_KEY_F4   293
 
#define GLFW_KEY_F5   294
 
#define GLFW_KEY_F6   295
 
#define GLFW_KEY_F7   296
 
#define GLFW_KEY_F8   297
 
#define GLFW_KEY_F9   298
 
#define GLFW_KEY_F10   299
 
#define GLFW_KEY_F11   300
 
#define GLFW_KEY_F12   301
 
#define GLFW_KEY_F13   302
 
#define GLFW_KEY_F14   303
 
#define GLFW_KEY_F15   304
 
#define GLFW_KEY_F16   305
 
#define GLFW_KEY_F17   306
 
#define GLFW_KEY_F18   307
 
#define GLFW_KEY_F19   308
 
#define GLFW_KEY_F20   309
 
#define GLFW_KEY_F21   310
 
#define GLFW_KEY_F22   311
 
#define GLFW_KEY_F23   312
 
#define GLFW_KEY_F24   313
 
#define GLFW_KEY_F25   314
 
#define GLFW_KEY_KP_0   320
 
#define GLFW_KEY_KP_1   321
 
#define GLFW_KEY_KP_2   322
 
#define GLFW_KEY_KP_3   323
 
#define GLFW_KEY_KP_4   324
 
#define GLFW_KEY_KP_5   325
 
#define GLFW_KEY_KP_6   326
 
#define GLFW_KEY_KP_7   327
 
#define GLFW_KEY_KP_8   328
 
#define GLFW_KEY_KP_9   329
 
#define GLFW_KEY_KP_DECIMAL   330
 
#define GLFW_KEY_KP_DIVIDE   331
 
#define GLFW_KEY_KP_MULTIPLY   332
 
#define GLFW_KEY_KP_SUBTRACT   333
 
#define GLFW_KEY_KP_ADD   334
 
#define GLFW_KEY_KP_ENTER   335
 
#define GLFW_KEY_KP_EQUAL   336
 
#define GLFW_KEY_LEFT_SHIFT   340
 
#define GLFW_KEY_LEFT_CONTROL   341
 
#define GLFW_KEY_LEFT_ALT   342
 
#define GLFW_KEY_LEFT_SUPER   343
 
#define GLFW_KEY_RIGHT_SHIFT   344
 
#define GLFW_KEY_RIGHT_CONTROL   345
 
#define GLFW_KEY_RIGHT_ALT   346
 
#define GLFW_KEY_RIGHT_SUPER   347
 
#define GLFW_KEY_MENU   348
 
#define GLFW_KEY_LAST   GLFW_KEY_MENU
 

Macro Definition Documentation

◆ GLFW_KEY_UNKNOWN

#define GLFW_KEY_UNKNOWN   -1

◆ GLFW_KEY_SPACE

#define GLFW_KEY_SPACE   32

◆ GLFW_KEY_APOSTROPHE

#define GLFW_KEY_APOSTROPHE   39 /* ' */

◆ GLFW_KEY_COMMA

#define GLFW_KEY_COMMA   44 /* , */

◆ GLFW_KEY_MINUS

#define GLFW_KEY_MINUS   45 /* - */

◆ GLFW_KEY_PERIOD

#define GLFW_KEY_PERIOD   46 /* . */

◆ GLFW_KEY_SLASH

#define GLFW_KEY_SLASH   47 /* / */

◆ GLFW_KEY_0

#define GLFW_KEY_0   48

◆ GLFW_KEY_1

#define GLFW_KEY_1   49

◆ GLFW_KEY_2

#define GLFW_KEY_2   50

◆ GLFW_KEY_3

#define GLFW_KEY_3   51

◆ GLFW_KEY_4

#define GLFW_KEY_4   52

◆ GLFW_KEY_5

#define GLFW_KEY_5   53

◆ GLFW_KEY_6

#define GLFW_KEY_6   54

◆ GLFW_KEY_7

#define GLFW_KEY_7   55

◆ GLFW_KEY_8

#define GLFW_KEY_8   56

◆ GLFW_KEY_9

#define GLFW_KEY_9   57

◆ GLFW_KEY_SEMICOLON

#define GLFW_KEY_SEMICOLON   59 /* ; */

◆ GLFW_KEY_EQUAL

#define GLFW_KEY_EQUAL   61 /* = */

◆ GLFW_KEY_A

#define GLFW_KEY_A   65

◆ GLFW_KEY_B

#define GLFW_KEY_B   66

◆ GLFW_KEY_C

#define GLFW_KEY_C   67

◆ GLFW_KEY_D

#define GLFW_KEY_D   68

◆ GLFW_KEY_E

#define GLFW_KEY_E   69

◆ GLFW_KEY_F

#define GLFW_KEY_F   70

◆ GLFW_KEY_G

#define GLFW_KEY_G   71

◆ GLFW_KEY_H

#define GLFW_KEY_H   72

◆ GLFW_KEY_I

#define GLFW_KEY_I   73

◆ GLFW_KEY_J

#define GLFW_KEY_J   74

◆ GLFW_KEY_K

#define GLFW_KEY_K   75

◆ GLFW_KEY_L

#define GLFW_KEY_L   76

◆ GLFW_KEY_M

#define GLFW_KEY_M   77

◆ GLFW_KEY_N

#define GLFW_KEY_N   78

◆ GLFW_KEY_O

#define GLFW_KEY_O   79

◆ GLFW_KEY_P

#define GLFW_KEY_P   80

◆ GLFW_KEY_Q

#define GLFW_KEY_Q   81

◆ GLFW_KEY_R

#define GLFW_KEY_R   82

◆ GLFW_KEY_S

#define GLFW_KEY_S   83

◆ GLFW_KEY_T

#define GLFW_KEY_T   84

◆ GLFW_KEY_U

#define GLFW_KEY_U   85

◆ GLFW_KEY_V

#define GLFW_KEY_V   86

◆ GLFW_KEY_W

#define GLFW_KEY_W   87

◆ GLFW_KEY_X

#define GLFW_KEY_X   88

◆ GLFW_KEY_Y

#define GLFW_KEY_Y   89

◆ GLFW_KEY_Z

#define GLFW_KEY_Z   90

◆ GLFW_KEY_LEFT_BRACKET

#define GLFW_KEY_LEFT_BRACKET   91 /* [ */

◆ GLFW_KEY_BACKSLASH

#define GLFW_KEY_BACKSLASH   92 /* \ */

◆ GLFW_KEY_RIGHT_BRACKET

#define GLFW_KEY_RIGHT_BRACKET   93 /* ] */

◆ GLFW_KEY_GRAVE_ACCENT

#define GLFW_KEY_GRAVE_ACCENT   96 /* ` */

◆ GLFW_KEY_WORLD_1

#define GLFW_KEY_WORLD_1   161 /* non-US #1 */

◆ GLFW_KEY_WORLD_2

#define GLFW_KEY_WORLD_2   162 /* non-US #2 */

◆ GLFW_KEY_ESCAPE

#define GLFW_KEY_ESCAPE   256

◆ GLFW_KEY_ENTER

#define GLFW_KEY_ENTER   257

◆ GLFW_KEY_TAB

#define GLFW_KEY_TAB   258

◆ GLFW_KEY_BACKSPACE

#define GLFW_KEY_BACKSPACE   259

◆ GLFW_KEY_INSERT

#define GLFW_KEY_INSERT   260

◆ GLFW_KEY_DELETE

#define GLFW_KEY_DELETE   261

◆ GLFW_KEY_RIGHT

#define GLFW_KEY_RIGHT   262

◆ GLFW_KEY_LEFT

#define GLFW_KEY_LEFT   263

◆ GLFW_KEY_DOWN

#define GLFW_KEY_DOWN   264

◆ GLFW_KEY_UP

#define GLFW_KEY_UP   265

◆ GLFW_KEY_PAGE_UP

#define GLFW_KEY_PAGE_UP   266

◆ GLFW_KEY_PAGE_DOWN

#define GLFW_KEY_PAGE_DOWN   267

◆ GLFW_KEY_HOME

#define GLFW_KEY_HOME   268

◆ GLFW_KEY_END

#define GLFW_KEY_END   269

◆ GLFW_KEY_CAPS_LOCK

#define GLFW_KEY_CAPS_LOCK   280

◆ GLFW_KEY_SCROLL_LOCK

#define GLFW_KEY_SCROLL_LOCK   281

◆ GLFW_KEY_NUM_LOCK

#define GLFW_KEY_NUM_LOCK   282

◆ GLFW_KEY_PRINT_SCREEN

#define GLFW_KEY_PRINT_SCREEN   283

◆ GLFW_KEY_PAUSE

#define GLFW_KEY_PAUSE   284

◆ GLFW_KEY_F1

#define GLFW_KEY_F1   290

◆ GLFW_KEY_F2

#define GLFW_KEY_F2   291

◆ GLFW_KEY_F3

#define GLFW_KEY_F3   292

◆ GLFW_KEY_F4

#define GLFW_KEY_F4   293

◆ GLFW_KEY_F5

#define GLFW_KEY_F5   294

◆ GLFW_KEY_F6

#define GLFW_KEY_F6   295

◆ GLFW_KEY_F7

#define GLFW_KEY_F7   296

◆ GLFW_KEY_F8

#define GLFW_KEY_F8   297

◆ GLFW_KEY_F9

#define GLFW_KEY_F9   298

◆ GLFW_KEY_F10

#define GLFW_KEY_F10   299

◆ GLFW_KEY_F11

#define GLFW_KEY_F11   300

◆ GLFW_KEY_F12

#define GLFW_KEY_F12   301

◆ GLFW_KEY_F13

#define GLFW_KEY_F13   302

◆ GLFW_KEY_F14

#define GLFW_KEY_F14   303

◆ GLFW_KEY_F15

#define GLFW_KEY_F15   304

◆ GLFW_KEY_F16

#define GLFW_KEY_F16   305

◆ GLFW_KEY_F17

#define GLFW_KEY_F17   306

◆ GLFW_KEY_F18

#define GLFW_KEY_F18   307

◆ GLFW_KEY_F19

#define GLFW_KEY_F19   308

◆ GLFW_KEY_F20

#define GLFW_KEY_F20   309

◆ GLFW_KEY_F21

#define GLFW_KEY_F21   310

◆ GLFW_KEY_F22

#define GLFW_KEY_F22   311

◆ GLFW_KEY_F23

#define GLFW_KEY_F23   312

◆ GLFW_KEY_F24

#define GLFW_KEY_F24   313

◆ GLFW_KEY_F25

#define GLFW_KEY_F25   314

◆ GLFW_KEY_KP_0

#define GLFW_KEY_KP_0   320

◆ GLFW_KEY_KP_1

#define GLFW_KEY_KP_1   321

◆ GLFW_KEY_KP_2

#define GLFW_KEY_KP_2   322

◆ GLFW_KEY_KP_3

#define GLFW_KEY_KP_3   323

◆ GLFW_KEY_KP_4

#define GLFW_KEY_KP_4   324

◆ GLFW_KEY_KP_5

#define GLFW_KEY_KP_5   325

◆ GLFW_KEY_KP_6

#define GLFW_KEY_KP_6   326

◆ GLFW_KEY_KP_7

#define GLFW_KEY_KP_7   327

◆ GLFW_KEY_KP_8

#define GLFW_KEY_KP_8   328

◆ GLFW_KEY_KP_9

#define GLFW_KEY_KP_9   329

◆ GLFW_KEY_KP_DECIMAL

#define GLFW_KEY_KP_DECIMAL   330

◆ GLFW_KEY_KP_DIVIDE

#define GLFW_KEY_KP_DIVIDE   331

◆ GLFW_KEY_KP_MULTIPLY

#define GLFW_KEY_KP_MULTIPLY   332

◆ GLFW_KEY_KP_SUBTRACT

#define GLFW_KEY_KP_SUBTRACT   333

◆ GLFW_KEY_KP_ADD

#define GLFW_KEY_KP_ADD   334

◆ GLFW_KEY_KP_ENTER

#define GLFW_KEY_KP_ENTER   335

◆ GLFW_KEY_KP_EQUAL

#define GLFW_KEY_KP_EQUAL   336

◆ GLFW_KEY_LEFT_SHIFT

#define GLFW_KEY_LEFT_SHIFT   340

◆ GLFW_KEY_LEFT_CONTROL

#define GLFW_KEY_LEFT_CONTROL   341

◆ GLFW_KEY_LEFT_ALT

#define GLFW_KEY_LEFT_ALT   342

◆ GLFW_KEY_LEFT_SUPER

#define GLFW_KEY_LEFT_SUPER   343

◆ GLFW_KEY_RIGHT_SHIFT

#define GLFW_KEY_RIGHT_SHIFT   344

◆ GLFW_KEY_RIGHT_CONTROL

#define GLFW_KEY_RIGHT_CONTROL   345

◆ GLFW_KEY_RIGHT_ALT

#define GLFW_KEY_RIGHT_ALT   346

◆ GLFW_KEY_RIGHT_SUPER

#define GLFW_KEY_RIGHT_SUPER   347

◆ GLFW_KEY_MENU

#define GLFW_KEY_MENU   348

◆ GLFW_KEY_LAST

#define GLFW_KEY_LAST   GLFW_KEY_MENU
================================================ FILE: thirdparty/glfw/docs/html/group__mods.html ================================================ GLFW: Modifier key flags
Modifier key flags

Description

See key input for how these are used.

Macros

#define GLFW_MOD_SHIFT   0x0001
 If this bit is set one or more Shift keys were held down. More...
 
#define GLFW_MOD_CONTROL   0x0002
 If this bit is set one or more Control keys were held down. More...
 
#define GLFW_MOD_ALT   0x0004
 If this bit is set one or more Alt keys were held down. More...
 
#define GLFW_MOD_SUPER   0x0008
 If this bit is set one or more Super keys were held down. More...
 
#define GLFW_MOD_CAPS_LOCK   0x0010
 If this bit is set the Caps Lock key is enabled. More...
 
#define GLFW_MOD_NUM_LOCK   0x0020
 If this bit is set the Num Lock key is enabled. More...
 

Macro Definition Documentation

◆ GLFW_MOD_SHIFT

#define GLFW_MOD_SHIFT   0x0001

If this bit is set one or more Shift keys were held down.

◆ GLFW_MOD_CONTROL

#define GLFW_MOD_CONTROL   0x0002

If this bit is set one or more Control keys were held down.

◆ GLFW_MOD_ALT

#define GLFW_MOD_ALT   0x0004

If this bit is set one or more Alt keys were held down.

◆ GLFW_MOD_SUPER

#define GLFW_MOD_SUPER   0x0008

If this bit is set one or more Super keys were held down.

◆ GLFW_MOD_CAPS_LOCK

#define GLFW_MOD_CAPS_LOCK   0x0010

If this bit is set the Caps Lock key is enabled and the GLFW_LOCK_KEY_MODS input mode is set.

◆ GLFW_MOD_NUM_LOCK

#define GLFW_MOD_NUM_LOCK   0x0020

If this bit is set the Num Lock key is enabled and the GLFW_LOCK_KEY_MODS input mode is set.

================================================ FILE: thirdparty/glfw/docs/html/group__monitor.html ================================================ GLFW: Monitor reference
Monitor reference

Description

This is the reference documentation for monitor related functions and types. For more task-oriented information, see the Monitor guide.

Typedefs

typedef struct GLFWmonitor GLFWmonitor
 Opaque monitor object. More...
 
typedef void(* GLFWmonitorfun) (GLFWmonitor *, int)
 The function pointer type for monitor configuration callbacks. More...
 
typedef struct GLFWvidmode GLFWvidmode
 Video mode type. More...
 
typedef struct GLFWgammaramp GLFWgammaramp
 Gamma ramp. More...
 

Functions

GLFWmonitor ** glfwGetMonitors (int *count)
 Returns the currently connected monitors. More...
 
GLFWmonitorglfwGetPrimaryMonitor (void)
 Returns the primary monitor. More...
 
void glfwGetMonitorPos (GLFWmonitor *monitor, int *xpos, int *ypos)
 Returns the position of the monitor's viewport on the virtual screen. More...
 
void glfwGetMonitorWorkarea (GLFWmonitor *monitor, int *xpos, int *ypos, int *width, int *height)
 Retrieves the work area of the monitor. More...
 
void glfwGetMonitorPhysicalSize (GLFWmonitor *monitor, int *widthMM, int *heightMM)
 Returns the physical size of the monitor. More...
 
void glfwGetMonitorContentScale (GLFWmonitor *monitor, float *xscale, float *yscale)
 Retrieves the content scale for the specified monitor. More...
 
const char * glfwGetMonitorName (GLFWmonitor *monitor)
 Returns the name of the specified monitor. More...
 
void glfwSetMonitorUserPointer (GLFWmonitor *monitor, void *pointer)
 Sets the user pointer of the specified monitor. More...
 
void * glfwGetMonitorUserPointer (GLFWmonitor *monitor)
 Returns the user pointer of the specified monitor. More...
 
GLFWmonitorfun glfwSetMonitorCallback (GLFWmonitorfun callback)
 Sets the monitor configuration callback. More...
 
const GLFWvidmodeglfwGetVideoModes (GLFWmonitor *monitor, int *count)
 Returns the available video modes for the specified monitor. More...
 
const GLFWvidmodeglfwGetVideoMode (GLFWmonitor *monitor)
 Returns the current mode of the specified monitor. More...
 
void glfwSetGamma (GLFWmonitor *monitor, float gamma)
 Generates a gamma ramp and sets it for the specified monitor. More...
 
const GLFWgammarampglfwGetGammaRamp (GLFWmonitor *monitor)
 Returns the current gamma ramp for the specified monitor. More...
 
void glfwSetGammaRamp (GLFWmonitor *monitor, const GLFWgammaramp *ramp)
 Sets the current gamma ramp for the specified monitor. More...
 

Typedef Documentation

◆ GLFWmonitor

typedef struct GLFWmonitor GLFWmonitor

Opaque monitor object.

See also
Monitor objects
Since
Added in version 3.0.

◆ GLFWmonitorfun

typedef void(* GLFWmonitorfun) (GLFWmonitor *, int)

This is the function pointer type for monitor configuration callbacks. A monitor callback function has the following signature:

void function_name(GLFWmonitor* monitor, int event)
Parameters
[in]monitorThe monitor that was connected or disconnected.
[in]eventOne of GLFW_CONNECTED or GLFW_DISCONNECTED. Future releases may add more events.
See also
Monitor configuration changes
glfwSetMonitorCallback
Since
Added in version 3.0.

◆ GLFWvidmode

typedef struct GLFWvidmode GLFWvidmode

This describes a single video mode.

See also
Video modes
glfwGetVideoMode
glfwGetVideoModes
Since
Added in version 1.0. GLFW 3: Added refresh rate member.

◆ GLFWgammaramp

typedef struct GLFWgammaramp GLFWgammaramp

This describes the gamma ramp for a monitor.

See also
Gamma ramp
glfwGetGammaRamp
glfwSetGammaRamp
Since
Added in version 3.0.

Function Documentation

◆ glfwGetMonitors()

GLFWmonitor** glfwGetMonitors ( int *  count)

This function returns an array of handles for all currently connected monitors. The primary monitor is always first in the returned array. If no monitors were found, this function returns NULL.

Parameters
[out]countWhere to store the number of monitors in the returned array. This is set to zero if an error occurred.
Returns
An array of monitor handles, or NULL if no monitors were found or if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the monitor configuration changes or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Retrieving monitors
Monitor configuration changes
glfwGetPrimaryMonitor
Since
Added in version 3.0.

◆ glfwGetPrimaryMonitor()

GLFWmonitor* glfwGetPrimaryMonitor ( void  )

This function returns the primary monitor. This is usually the monitor where elements like the task bar or global menu bar are located.

Returns
The primary monitor, or NULL if no monitors were found or if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
Remarks
The primary monitor is always first in the array returned by glfwGetMonitors.
See also
Retrieving monitors
glfwGetMonitors
Since
Added in version 3.0.

◆ glfwGetMonitorPos()

void glfwGetMonitorPos ( GLFWmonitor monitor,
int *  xpos,
int *  ypos 
)

This function returns the position, in screen coordinates, of the upper-left corner of the specified monitor.

Any or all of the position arguments may be NULL. If an error occurs, all non-NULL position arguments will be set to zero.

Parameters
[in]monitorThe monitor to query.
[out]xposWhere to store the monitor x-coordinate, or NULL.
[out]yposWhere to store the monitor y-coordinate, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Monitor properties
Since
Added in version 3.0.

◆ glfwGetMonitorWorkarea()

void glfwGetMonitorWorkarea ( GLFWmonitor monitor,
int *  xpos,
int *  ypos,
int *  width,
int *  height 
)

This function returns the position, in screen coordinates, of the upper-left corner of the work area of the specified monitor along with the work area size in screen coordinates. The work area is defined as the area of the monitor not occluded by the operating system task bar where present. If no task bar exists then the work area is the monitor resolution in screen coordinates.

Any or all of the position and size arguments may be NULL. If an error occurs, all non-NULL position and size arguments will be set to zero.

Parameters
[in]monitorThe monitor to query.
[out]xposWhere to store the monitor x-coordinate, or NULL.
[out]yposWhere to store the monitor y-coordinate, or NULL.
[out]widthWhere to store the monitor width, or NULL.
[out]heightWhere to store the monitor height, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Work area
Since
Added in version 3.3.

◆ glfwGetMonitorPhysicalSize()

void glfwGetMonitorPhysicalSize ( GLFWmonitor monitor,
int *  widthMM,
int *  heightMM 
)

This function returns the size, in millimetres, of the display area of the specified monitor.

Some systems do not provide accurate monitor size information, either because the monitor EDID data is incorrect or because the driver does not report it accurately.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]monitorThe monitor to query.
[out]widthMMWhere to store the width, in millimetres, of the monitor's display area, or NULL.
[out]heightMMWhere to store the height, in millimetres, of the monitor's display area, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Remarks
Windows: calculates the returned physical size from the current resolution and system DPI instead of querying the monitor EDID data.
Thread safety
This function must only be called from the main thread.
See also
Monitor properties
Since
Added in version 3.0.

◆ glfwGetMonitorContentScale()

void glfwGetMonitorContentScale ( GLFWmonitor monitor,
float *  xscale,
float *  yscale 
)

This function retrieves the content scale for the specified monitor. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

The content scale may depend on both the monitor resolution and pixel density and on user settings. It may be very different from the raw DPI calculated from the physical size and current resolution.

Parameters
[in]monitorThe monitor to query.
[out]xscaleWhere to store the x-axis content scale, or NULL.
[out]yscaleWhere to store the y-axis content scale, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Content scale
glfwGetWindowContentScale
Since
Added in version 3.3.

◆ glfwGetMonitorName()

const char* glfwGetMonitorName ( GLFWmonitor monitor)

This function returns a human-readable name, encoded as UTF-8, of the specified monitor. The name typically reflects the make and model of the monitor and is not guaranteed to be unique among the connected monitors.

Parameters
[in]monitorThe monitor to query.
Returns
The UTF-8 encoded name of the monitor, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Monitor properties
Since
Added in version 3.0.

◆ glfwSetMonitorUserPointer()

void glfwSetMonitorUserPointer ( GLFWmonitor monitor,
void *  pointer 
)

This function sets the user-defined pointer of the specified monitor. The current value is retained until the monitor is disconnected. The initial value is NULL.

This function may be called from the monitor callback, even for a monitor that is being disconnected.

Parameters
[in]monitorThe monitor whose pointer to set.
[in]pointerThe new value.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
User pointer
glfwGetMonitorUserPointer
Since
Added in version 3.3.

◆ glfwGetMonitorUserPointer()

void* glfwGetMonitorUserPointer ( GLFWmonitor monitor)

This function returns the current value of the user-defined pointer of the specified monitor. The initial value is NULL.

This function may be called from the monitor callback, even for a monitor that is being disconnected.

Parameters
[in]monitorThe monitor whose pointer to return.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
User pointer
glfwSetMonitorUserPointer
Since
Added in version 3.3.

◆ glfwSetMonitorCallback()

GLFWmonitorfun glfwSetMonitorCallback ( GLFWmonitorfun  callback)

This function sets the monitor configuration callback, or removes the currently set callback. This is called when a monitor is connected to or disconnected from the system.

Parameters
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWmonitor* monitor, int event)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Monitor configuration changes
Since
Added in version 3.0.

◆ glfwGetVideoModes()

const GLFWvidmode* glfwGetVideoModes ( GLFWmonitor monitor,
int *  count 
)

This function returns an array of all video modes supported by the specified monitor. The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths) and then by resolution area (the product of width and height).

Parameters
[in]monitorThe monitor to query.
[out]countWhere to store the number of video modes in the returned array. This is set to zero if an error occurred.
Returns
An array of video modes, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected, this function is called again for that monitor or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Video modes
glfwGetVideoMode
Since
Added in version 1.0. GLFW 3: Changed to return an array of modes for a specific monitor.

◆ glfwGetVideoMode()

const GLFWvidmode* glfwGetVideoMode ( GLFWmonitor monitor)

This function returns the current video mode of the specified monitor. If you have created a full screen window for that monitor, the return value will depend on whether that window is iconified.

Parameters
[in]monitorThe monitor to query.
Returns
The current mode of the monitor, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Video modes
glfwGetVideoModes
Since
Added in version 3.0. Replaces glfwGetDesktopMode.

◆ glfwSetGamma()

void glfwSetGamma ( GLFWmonitor monitor,
float  gamma 
)

This function generates an appropriately sized gamma ramp from the specified exponent and then calls glfwSetGammaRamp with it. The value must be a finite number greater than zero.

The software controlled gamma ramp is applied in addition to the hardware gamma correction, which today is usually an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior.

For gamma correct rendering with OpenGL or OpenGL ES, see the GLFW_SRGB_CAPABLE hint.

Parameters
[in]monitorThe monitor whose gamma ramp to set.
[in]gammaThe desired exponent.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.
Remarks
Wayland: Gamma handling is a privileged protocol, this function will thus never be implemented and emits GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Gamma ramp
Since
Added in version 3.0.

◆ glfwGetGammaRamp()

const GLFWgammaramp* glfwGetGammaRamp ( GLFWmonitor monitor)

This function returns the current gamma ramp of the specified monitor.

Parameters
[in]monitorThe monitor to query.
Returns
The current gamma ramp, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: Gamma handling is a privileged protocol, this function will thus never be implemented and emits GLFW_PLATFORM_ERROR while returning NULL.
Pointer lifetime
The returned structure and its arrays are allocated and freed by GLFW. You should not free them yourself. They are valid until the specified monitor is disconnected, this function is called again for that monitor or the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Gamma ramp
Since
Added in version 3.0.

◆ glfwSetGammaRamp()

void glfwSetGammaRamp ( GLFWmonitor monitor,
const GLFWgammaramp ramp 
)

This function sets the current gamma ramp for the specified monitor. The original gamma ramp for that monitor is saved by GLFW the first time this function is called and is restored by glfwTerminate.

The software controlled gamma ramp is applied in addition to the hardware gamma correction, which today is usually an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior.

For gamma correct rendering with OpenGL or OpenGL ES, see the GLFW_SRGB_CAPABLE hint.

Parameters
[in]monitorThe monitor whose gamma ramp to set.
[in]rampThe gamma ramp to use.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
The size of the specified gamma ramp should match the size of the current ramp for that monitor.
Windows: The gamma ramp size must be 256.
Wayland: Gamma handling is a privileged protocol, this function will thus never be implemented and emits GLFW_PLATFORM_ERROR.
Pointer lifetime
The specified gamma ramp is copied before this function returns.
Thread safety
This function must only be called from the main thread.
See also
Gamma ramp
Since
Added in version 3.0.
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
Definition: glfw3.h:1140
================================================ FILE: thirdparty/glfw/docs/html/group__native.html ================================================ GLFW: Native access
Native access

Description

By using the native access functions you assert that you know what you're doing and how to fix problems caused by using them. If you don't, you shouldn't be using them.

Before the inclusion of glfw3native.h, you may define zero or more window system API macro and zero or more context creation API macros.

The chosen backends must match those the library was compiled for. Failure to do this will cause a link-time error.

The available window API macros are:

  • GLFW_EXPOSE_NATIVE_WIN32
  • GLFW_EXPOSE_NATIVE_COCOA
  • GLFW_EXPOSE_NATIVE_X11
  • GLFW_EXPOSE_NATIVE_WAYLAND

The available context API macros are:

  • GLFW_EXPOSE_NATIVE_WGL
  • GLFW_EXPOSE_NATIVE_NSGL
  • GLFW_EXPOSE_NATIVE_GLX
  • GLFW_EXPOSE_NATIVE_EGL
  • GLFW_EXPOSE_NATIVE_OSMESA

These macros select which of the native access functions that are declared and which platform-specific headers to include. It is then up your (by definition platform-specific) code to handle which of these should be defined.

Functions

const char * glfwGetWin32Adapter (GLFWmonitor *monitor)
 Returns the adapter device name of the specified monitor. More...
 
const char * glfwGetWin32Monitor (GLFWmonitor *monitor)
 Returns the display device name of the specified monitor. More...
 
HWND glfwGetWin32Window (GLFWwindow *window)
 Returns the HWND of the specified window. More...
 
HGLRC glfwGetWGLContext (GLFWwindow *window)
 Returns the HGLRC of the specified window. More...
 
CGDirectDisplayID glfwGetCocoaMonitor (GLFWmonitor *monitor)
 Returns the CGDirectDisplayID of the specified monitor. More...
 
id glfwGetCocoaWindow (GLFWwindow *window)
 Returns the NSWindow of the specified window. More...
 
id glfwGetNSGLContext (GLFWwindow *window)
 Returns the NSOpenGLContext of the specified window. More...
 
Display * glfwGetX11Display (void)
 Returns the Display used by GLFW. More...
 
RRCrtc glfwGetX11Adapter (GLFWmonitor *monitor)
 Returns the RRCrtc of the specified monitor. More...
 
RROutput glfwGetX11Monitor (GLFWmonitor *monitor)
 Returns the RROutput of the specified monitor. More...
 
Window glfwGetX11Window (GLFWwindow *window)
 Returns the Window of the specified window. More...
 
void glfwSetX11SelectionString (const char *string)
 Sets the current primary selection to the specified string. More...
 
const char * glfwGetX11SelectionString (void)
 Returns the contents of the current primary selection as a string. More...
 
GLXContext glfwGetGLXContext (GLFWwindow *window)
 Returns the GLXContext of the specified window. More...
 
GLXWindow glfwGetGLXWindow (GLFWwindow *window)
 Returns the GLXWindow of the specified window. More...
 
struct wl_display * glfwGetWaylandDisplay (void)
 Returns the struct wl_display* used by GLFW. More...
 
struct wl_output * glfwGetWaylandMonitor (GLFWmonitor *monitor)
 Returns the struct wl_output* of the specified monitor. More...
 
struct wl_surface * glfwGetWaylandWindow (GLFWwindow *window)
 Returns the main struct wl_surface* of the specified window. More...
 
EGLDisplay glfwGetEGLDisplay (void)
 Returns the EGLDisplay used by GLFW. More...
 
EGLContext glfwGetEGLContext (GLFWwindow *window)
 Returns the EGLContext of the specified window. More...
 
EGLSurface glfwGetEGLSurface (GLFWwindow *window)
 Returns the EGLSurface of the specified window. More...
 
int glfwGetOSMesaColorBuffer (GLFWwindow *window, int *width, int *height, int *format, void **buffer)
 Retrieves the color buffer associated with the specified window. More...
 
int glfwGetOSMesaDepthBuffer (GLFWwindow *window, int *width, int *height, int *bytesPerValue, void **buffer)
 Retrieves the depth buffer associated with the specified window. More...
 
OSMesaContext glfwGetOSMesaContext (GLFWwindow *window)
 Returns the OSMesaContext of the specified window. More...
 

Function Documentation

◆ glfwGetWin32Adapter()

const char* glfwGetWin32Adapter ( GLFWmonitor monitor)
Returns
The UTF-8 encoded adapter device name (for example \\.\DISPLAY1) of the specified monitor, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.1.

◆ glfwGetWin32Monitor()

const char* glfwGetWin32Monitor ( GLFWmonitor monitor)
Returns
The UTF-8 encoded display device name (for example \\.\DISPLAY1\Monitor0) of the specified monitor, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.1.

◆ glfwGetWin32Window()

HWND glfwGetWin32Window ( GLFWwindow window)
Returns
The HWND of the specified window, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetWGLContext()

HGLRC glfwGetWGLContext ( GLFWwindow window)
Returns
The HGLRC of the specified window, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetCocoaMonitor()

CGDirectDisplayID glfwGetCocoaMonitor ( GLFWmonitor monitor)
Returns
The CGDirectDisplayID of the specified monitor, or kCGNullDirectDisplay if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.1.

◆ glfwGetCocoaWindow()

id glfwGetCocoaWindow ( GLFWwindow window)
Returns
The NSWindow of the specified window, or nil if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetNSGLContext()

id glfwGetNSGLContext ( GLFWwindow window)
Returns
The NSOpenGLContext of the specified window, or nil if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetX11Display()

Display* glfwGetX11Display ( void  )
Returns
The Display used by GLFW, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetX11Adapter()

RRCrtc glfwGetX11Adapter ( GLFWmonitor monitor)
Returns
The RRCrtc of the specified monitor, or None if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.1.

◆ glfwGetX11Monitor()

RROutput glfwGetX11Monitor ( GLFWmonitor monitor)
Returns
The RROutput of the specified monitor, or None if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.1.

◆ glfwGetX11Window()

Window glfwGetX11Window ( GLFWwindow window)
Returns
The Window of the specified window, or None if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwSetX11SelectionString()

void glfwSetX11SelectionString ( const char *  string)
Parameters
[in]stringA UTF-8 encoded string.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The specified string is copied before this function returns.
Thread safety
This function must only be called from the main thread.
See also
Clipboard input and output
glfwGetX11SelectionString
glfwSetClipboardString
Since
Added in version 3.3.

◆ glfwGetX11SelectionString()

const char* glfwGetX11SelectionString ( void  )

If the selection is empty or if its contents cannot be converted, NULL is returned and a GLFW_FORMAT_UNAVAILABLE error is generated.

Returns
The contents of the selection as a UTF-8 encoded string, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the next call to glfwGetX11SelectionString or glfwSetX11SelectionString, or until the library is terminated.
Thread safety
This function must only be called from the main thread.
See also
Clipboard input and output
glfwSetX11SelectionString
glfwGetClipboardString
Since
Added in version 3.3.

◆ glfwGetGLXContext()

GLXContext glfwGetGLXContext ( GLFWwindow window)
Returns
The GLXContext of the specified window, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetGLXWindow()

GLXWindow glfwGetGLXWindow ( GLFWwindow window)
Returns
The GLXWindow of the specified window, or None if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.2.

◆ glfwGetWaylandDisplay()

struct wl_display* glfwGetWaylandDisplay ( void  )
Returns
The struct wl_display* used by GLFW, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.2.

◆ glfwGetWaylandMonitor()

struct wl_output* glfwGetWaylandMonitor ( GLFWmonitor monitor)
Returns
The struct wl_output* of the specified monitor, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.2.

◆ glfwGetWaylandWindow()

struct wl_surface* glfwGetWaylandWindow ( GLFWwindow window)
Returns
The main struct wl_surface* of the specified window, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.2.

◆ glfwGetEGLDisplay()

EGLDisplay glfwGetEGLDisplay ( void  )
Returns
The EGLDisplay used by GLFW, or EGL_NO_DISPLAY if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetEGLContext()

EGLContext glfwGetEGLContext ( GLFWwindow window)
Returns
The EGLContext of the specified window, or EGL_NO_CONTEXT if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetEGLSurface()

EGLSurface glfwGetEGLSurface ( GLFWwindow window)
Returns
The EGLSurface of the specified window, or EGL_NO_SURFACE if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

◆ glfwGetOSMesaColorBuffer()

int glfwGetOSMesaColorBuffer ( GLFWwindow window,
int *  width,
int *  height,
int *  format,
void **  buffer 
)
Parameters
[in]windowThe window whose color buffer to retrieve.
[out]widthWhere to store the width of the color buffer, or NULL.
[out]heightWhere to store the height of the color buffer, or NULL.
[out]formatWhere to store the OSMesa pixel format of the color buffer, or NULL.
[out]bufferWhere to store the address of the color buffer, or NULL.
Returns
GLFW_TRUE if successful, or GLFW_FALSE if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.3.

◆ glfwGetOSMesaDepthBuffer()

int glfwGetOSMesaDepthBuffer ( GLFWwindow window,
int *  width,
int *  height,
int *  bytesPerValue,
void **  buffer 
)
Parameters
[in]windowThe window whose depth buffer to retrieve.
[out]widthWhere to store the width of the depth buffer, or NULL.
[out]heightWhere to store the height of the depth buffer, or NULL.
[out]bytesPerValueWhere to store the number of bytes per depth buffer element, or NULL.
[out]bufferWhere to store the address of the depth buffer, or NULL.
Returns
GLFW_TRUE if successful, or GLFW_FALSE if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.3.

◆ glfwGetOSMesaContext()

OSMesaContext glfwGetOSMesaContext ( GLFWwindow window)
Returns
The OSMesaContext of the specified window, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.3.
================================================ FILE: thirdparty/glfw/docs/html/group__shapes.html ================================================ GLFW: Standard cursor shapes
Standard cursor shapes

Description

See standard cursor creation for how these are used.

Macros

#define GLFW_ARROW_CURSOR   0x00036001
 The regular arrow cursor shape. More...
 
#define GLFW_IBEAM_CURSOR   0x00036002
 The text input I-beam cursor shape. More...
 
#define GLFW_CROSSHAIR_CURSOR   0x00036003
 The crosshair shape. More...
 
#define GLFW_HAND_CURSOR   0x00036004
 The hand shape. More...
 
#define GLFW_HRESIZE_CURSOR   0x00036005
 The horizontal resize arrow shape. More...
 
#define GLFW_VRESIZE_CURSOR   0x00036006
 The vertical resize arrow shape. More...
 

Macro Definition Documentation

◆ GLFW_ARROW_CURSOR

#define GLFW_ARROW_CURSOR   0x00036001

The regular arrow cursor.

◆ GLFW_IBEAM_CURSOR

#define GLFW_IBEAM_CURSOR   0x00036002

The text input I-beam cursor shape.

◆ GLFW_CROSSHAIR_CURSOR

#define GLFW_CROSSHAIR_CURSOR   0x00036003

The crosshair shape.

◆ GLFW_HAND_CURSOR

#define GLFW_HAND_CURSOR   0x00036004

The hand shape.

◆ GLFW_HRESIZE_CURSOR

#define GLFW_HRESIZE_CURSOR   0x00036005

The horizontal resize arrow shape.

◆ GLFW_VRESIZE_CURSOR

#define GLFW_VRESIZE_CURSOR   0x00036006

The vertical resize arrow shape.

================================================ FILE: thirdparty/glfw/docs/html/group__vulkan.html ================================================ GLFW: Vulkan reference
Vulkan reference

Description

This is the reference documentation for Vulkan related functions and types. For more task-oriented information, see the Vulkan guide.

Typedefs

typedef void(* GLFWvkproc) (void)
 Vulkan API function pointer type. More...
 

Functions

int glfwVulkanSupported (void)
 Returns whether the Vulkan loader and an ICD have been found. More...
 
const char ** glfwGetRequiredInstanceExtensions (uint32_t *count)
 Returns the Vulkan instance extensions required by GLFW. More...
 
GLFWvkproc glfwGetInstanceProcAddress (VkInstance instance, const char *procname)
 Returns the address of the specified Vulkan instance function. More...
 
int glfwGetPhysicalDevicePresentationSupport (VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily)
 Returns whether the specified queue family can present images. More...
 
VkResult glfwCreateWindowSurface (VkInstance instance, GLFWwindow *window, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
 Creates a Vulkan surface for the specified window. More...
 

Typedef Documentation

◆ GLFWvkproc

typedef void(* GLFWvkproc) (void)

Generic function pointer used for returning Vulkan API function pointers without forcing a cast from a regular pointer.

See also
Querying Vulkan function pointers
glfwGetInstanceProcAddress
Since
Added in version 3.2.

Function Documentation

◆ glfwVulkanSupported()

int glfwVulkanSupported ( void  )

This function returns whether the Vulkan loader and any minimally functional ICD have been found.

The availability of a Vulkan loader and even an ICD does not by itself guarantee that surface creation or even instance creation is possible. For example, on Fermi systems Nvidia will install an ICD that provides no actual Vulkan support. Call glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan surface creation are available and glfwGetPhysicalDevicePresentationSupport to check whether a queue family of a physical device supports image presentation.

Returns
GLFW_TRUE if Vulkan is minimally available, or GLFW_FALSE otherwise.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread.
See also
Querying for Vulkan support
Since
Added in version 3.2.

◆ glfwGetRequiredInstanceExtensions()

const char** glfwGetRequiredInstanceExtensions ( uint32_t *  count)

This function returns an array of names of Vulkan instance extensions required by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the list will always contain VK_KHR_surface, so if you don't require any additional extensions you can pass this list directly to the VkInstanceCreateInfo struct.

If Vulkan is not available on the machine, this function returns NULL and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is at least minimally available.

If Vulkan is available but no set of extensions allowing window surface creation was found, this function returns NULL. You may still use Vulkan for off-screen rendering and compute work.

Parameters
[out]countWhere to store the number of extensions in the returned array. This is set to zero if an error occurred.
Returns
An array of ASCII encoded extension names, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_API_UNAVAILABLE.
Remarks
Additional extensions may be required by future versions of GLFW. You should check if any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the VkInstanceCreateInfo struct.
macOS: This function currently supports either the VK_MVK_macos_surface extension from MoltenVK or VK_EXT_metal_surface extension.
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the library is terminated.
Thread safety
This function may be called from any thread.
See also
Querying required Vulkan extensions
glfwCreateWindowSurface
Since
Added in version 3.2.

◆ glfwGetInstanceProcAddress()

GLFWvkproc glfwGetInstanceProcAddress ( VkInstance  instance,
const char *  procname 
)

This function returns the address of the specified Vulkan core or extension function for the specified instance. If instance is set to NULL it can return any function exported from the Vulkan loader, including at least the following functions:

  • vkEnumerateInstanceExtensionProperties
  • vkEnumerateInstanceLayerProperties
  • vkCreateInstance
  • vkGetInstanceProcAddr

If Vulkan is not available on the machine, this function returns NULL and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is at least minimally available.

This function is equivalent to calling vkGetInstanceProcAddr with a platform-specific query of the Vulkan loader as a fallback.

Parameters
[in]instanceThe Vulkan instance to query, or NULL to retrieve functions related to instance creation.
[in]procnameThe ASCII encoded name of the function.
Returns
The address of the function, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_API_UNAVAILABLE.
Pointer lifetime
The returned function pointer is valid until the library is terminated.
Thread safety
This function may be called from any thread.
See also
Querying Vulkan function pointers
Since
Added in version 3.2.

◆ glfwGetPhysicalDevicePresentationSupport()

int glfwGetPhysicalDevicePresentationSupport ( VkInstance  instance,
VkPhysicalDevice  device,
uint32_t  queuefamily 
)

This function returns whether the specified queue family of the specified physical device supports presentation to the platform GLFW was built for.

If Vulkan or the required window surface creation instance extensions are not available on the machine, or if the specified instance was not created with the required extensions, this function returns GLFW_FALSE and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is at least minimally available and glfwGetRequiredInstanceExtensions to check what instance extensions are required.

Parameters
[in]instanceThe instance that the physical device belongs to.
[in]deviceThe physical device that the queue family belongs to.
[in]queuefamilyThe index of the queue family to query.
Returns
GLFW_TRUE if the queue family supports presentation, or GLFW_FALSE otherwise.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_API_UNAVAILABLE and GLFW_PLATFORM_ERROR.
Remarks
macOS: This function currently always returns GLFW_TRUE, as the VK_MVK_macos_surface extension does not provide a vkGetPhysicalDevice*PresentationSupport type function.
Thread safety
This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.
See also
Querying for Vulkan presentation support
Since
Added in version 3.2.

◆ glfwCreateWindowSurface()

VkResult glfwCreateWindowSurface ( VkInstance  instance,
GLFWwindow window,
const VkAllocationCallbacks *  allocator,
VkSurfaceKHR *  surface 
)

This function creates a Vulkan surface for the specified window.

If the Vulkan loader or at least one minimally functional ICD were not found, this function returns VK_ERROR_INITIALIZATION_FAILED and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is at least minimally available.

If the required window surface creation instance extensions are not available or if the specified instance was not created with these extensions enabled, this function returns VK_ERROR_EXTENSION_NOT_PRESENT and generates a GLFW_API_UNAVAILABLE error. Call glfwGetRequiredInstanceExtensions to check what instance extensions are required.

The window surface cannot be shared with another API so the window must have been created with the client api hint set to GLFW_NO_API otherwise it generates a GLFW_INVALID_VALUE error and returns VK_ERROR_NATIVE_WINDOW_IN_USE_KHR.

The window surface must be destroyed before the specified Vulkan instance. It is the responsibility of the caller to destroy the window surface. GLFW does not destroy it for you. Call vkDestroySurfaceKHR to destroy the surface.

Parameters
[in]instanceThe Vulkan instance to create the surface in.
[in]windowThe window to create the surface for.
[in]allocatorThe allocator to use, or NULL to use the default allocator.
[out]surfaceWhere to store the handle of the surface. This is set to VK_NULL_HANDLE if an error occurred.
Returns
VK_SUCCESS if successful, or a Vulkan error code if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_API_UNAVAILABLE, GLFW_PLATFORM_ERROR and GLFW_INVALID_VALUE
Remarks
If an error occurs before the creation call is made, GLFW returns the Vulkan error code most appropriate for the error. Appropriate use of glfwVulkanSupported and glfwGetRequiredInstanceExtensions should eliminate almost all occurrences of these errors.
macOS: This function currently only supports the VK_MVK_macos_surface extension from MoltenVK.
macOS: This function creates and sets a CAMetalLayer instance for the window content view, which is required for MoltenVK to function.
Thread safety
This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.
See also
Creating a Vulkan window surface
glfwGetRequiredInstanceExtensions
Since
Added in version 3.2.
================================================ FILE: thirdparty/glfw/docs/html/group__window.html ================================================ GLFW: Window reference
Window reference

Description

This is the reference documentation for window related functions and types, including creation, deletion and event polling. For more task-oriented information, see the Window guide.

Macros

#define GLFW_FOCUSED   0x00020001
 Input focus window hint and attribute. More...
 
#define GLFW_ICONIFIED   0x00020002
 Window iconification window attribute. More...
 
#define GLFW_RESIZABLE   0x00020003
 Window resize-ability window hint and attribute. More...
 
#define GLFW_VISIBLE   0x00020004
 Window visibility window hint and attribute. More...
 
#define GLFW_DECORATED   0x00020005
 Window decoration window hint and attribute. More...
 
#define GLFW_AUTO_ICONIFY   0x00020006
 Window auto-iconification window hint and attribute. More...
 
#define GLFW_FLOATING   0x00020007
 Window decoration window hint and attribute. More...
 
#define GLFW_MAXIMIZED   0x00020008
 Window maximization window hint and attribute. More...
 
#define GLFW_CENTER_CURSOR   0x00020009
 Cursor centering window hint. More...
 
#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A
 Window framebuffer transparency hint and attribute. More...
 
#define GLFW_HOVERED   0x0002000B
 Mouse cursor hover window attribute. More...
 
#define GLFW_FOCUS_ON_SHOW   0x0002000C
 Input focus on calling show window hint and attribute. More...
 
#define GLFW_RED_BITS   0x00021001
 Framebuffer bit depth hint. More...
 
#define GLFW_GREEN_BITS   0x00021002
 Framebuffer bit depth hint. More...
 
#define GLFW_BLUE_BITS   0x00021003
 Framebuffer bit depth hint. More...
 
#define GLFW_ALPHA_BITS   0x00021004
 Framebuffer bit depth hint. More...
 
#define GLFW_DEPTH_BITS   0x00021005
 Framebuffer bit depth hint. More...
 
#define GLFW_STENCIL_BITS   0x00021006
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_RED_BITS   0x00021007
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_GREEN_BITS   0x00021008
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_BLUE_BITS   0x00021009
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_ALPHA_BITS   0x0002100A
 Framebuffer bit depth hint. More...
 
#define GLFW_AUX_BUFFERS   0x0002100B
 Framebuffer auxiliary buffer hint. More...
 
#define GLFW_STEREO   0x0002100C
 OpenGL stereoscopic rendering hint. More...
 
#define GLFW_SAMPLES   0x0002100D
 Framebuffer MSAA samples hint. More...
 
#define GLFW_SRGB_CAPABLE   0x0002100E
 Framebuffer sRGB hint. More...
 
#define GLFW_REFRESH_RATE   0x0002100F
 Monitor refresh rate hint. More...
 
#define GLFW_DOUBLEBUFFER   0x00021010
 Framebuffer double buffering hint. More...
 
#define GLFW_CLIENT_API   0x00022001
 Context client API hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002
 Context client API major version hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MINOR   0x00022003
 Context client API minor version hint and attribute. More...
 
#define GLFW_CONTEXT_REVISION   0x00022004
 Context client API revision number hint and attribute. More...
 
#define GLFW_CONTEXT_ROBUSTNESS   0x00022005
 Context robustness hint and attribute. More...
 
#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006
 OpenGL forward-compatibility hint and attribute. More...
 
#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
 OpenGL debug context hint and attribute. More...
 
#define GLFW_OPENGL_PROFILE   0x00022008
 OpenGL profile hint and attribute. More...
 
#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009
 Context flush-on-release hint and attribute. More...
 
#define GLFW_CONTEXT_NO_ERROR   0x0002200A
 Context error suppression hint and attribute. More...
 
#define GLFW_CONTEXT_CREATION_API   0x0002200B
 Context creation API hint and attribute. More...
 
#define GLFW_SCALE_TO_MONITOR   0x0002200C
 Window content area scaling window window hint. More...
 
#define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001
 macOS specific window hint. More...
 
#define GLFW_COCOA_FRAME_NAME   0x00023002
 macOS specific window hint. More...
 
#define GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003
 macOS specific window hint. More...
 
#define GLFW_X11_CLASS_NAME   0x00024001
 X11 specific window hint. More...
 
#define GLFW_X11_INSTANCE_NAME   0x00024002
 X11 specific window hint. More...
 

Typedefs

typedef struct GLFWwindow GLFWwindow
 Opaque window object. More...
 
typedef void(* GLFWwindowposfun) (GLFWwindow *, int, int)
 The function pointer type for window position callbacks. More...
 
typedef void(* GLFWwindowsizefun) (GLFWwindow *, int, int)
 The function pointer type for window size callbacks. More...
 
typedef void(* GLFWwindowclosefun) (GLFWwindow *)
 The function pointer type for window close callbacks. More...
 
typedef void(* GLFWwindowrefreshfun) (GLFWwindow *)
 The function pointer type for window content refresh callbacks. More...
 
typedef void(* GLFWwindowfocusfun) (GLFWwindow *, int)
 The function pointer type for window focus callbacks. More...
 
typedef void(* GLFWwindowiconifyfun) (GLFWwindow *, int)
 The function pointer type for window iconify callbacks. More...
 
typedef void(* GLFWwindowmaximizefun) (GLFWwindow *, int)
 The function pointer type for window maximize callbacks. More...
 
typedef void(* GLFWframebuffersizefun) (GLFWwindow *, int, int)
 The function pointer type for framebuffer size callbacks. More...
 
typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *, float, float)
 The function pointer type for window content scale callbacks. More...
 
typedef struct GLFWimage GLFWimage
 Image data. More...
 

Functions

void glfwDefaultWindowHints (void)
 Resets all window hints to their default values. More...
 
void glfwWindowHint (int hint, int value)
 Sets the specified window hint to the desired value. More...
 
void glfwWindowHintString (int hint, const char *value)
 Sets the specified window hint to the desired value. More...
 
GLFWwindowglfwCreateWindow (int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
 Creates a window and its associated context. More...
 
void glfwDestroyWindow (GLFWwindow *window)
 Destroys the specified window and its context. More...
 
int glfwWindowShouldClose (GLFWwindow *window)
 Checks the close flag of the specified window. More...
 
void glfwSetWindowShouldClose (GLFWwindow *window, int value)
 Sets the close flag of the specified window. More...
 
void glfwSetWindowTitle (GLFWwindow *window, const char *title)
 Sets the title of the specified window. More...
 
void glfwSetWindowIcon (GLFWwindow *window, int count, const GLFWimage *images)
 Sets the icon for the specified window. More...
 
void glfwGetWindowPos (GLFWwindow *window, int *xpos, int *ypos)
 Retrieves the position of the content area of the specified window. More...
 
void glfwSetWindowPos (GLFWwindow *window, int xpos, int ypos)
 Sets the position of the content area of the specified window. More...
 
void glfwGetWindowSize (GLFWwindow *window, int *width, int *height)
 Retrieves the size of the content area of the specified window. More...
 
void glfwSetWindowSizeLimits (GLFWwindow *window, int minwidth, int minheight, int maxwidth, int maxheight)
 Sets the size limits of the specified window. More...
 
void glfwSetWindowAspectRatio (GLFWwindow *window, int numer, int denom)
 Sets the aspect ratio of the specified window. More...
 
void glfwSetWindowSize (GLFWwindow *window, int width, int height)
 Sets the size of the content area of the specified window. More...
 
void glfwGetFramebufferSize (GLFWwindow *window, int *width, int *height)
 Retrieves the size of the framebuffer of the specified window. More...
 
void glfwGetWindowFrameSize (GLFWwindow *window, int *left, int *top, int *right, int *bottom)
 Retrieves the size of the frame of the window. More...
 
void glfwGetWindowContentScale (GLFWwindow *window, float *xscale, float *yscale)
 Retrieves the content scale for the specified window. More...
 
float glfwGetWindowOpacity (GLFWwindow *window)
 Returns the opacity of the whole window. More...
 
void glfwSetWindowOpacity (GLFWwindow *window, float opacity)
 Sets the opacity of the whole window. More...
 
void glfwIconifyWindow (GLFWwindow *window)
 Iconifies the specified window. More...
 
void glfwRestoreWindow (GLFWwindow *window)
 Restores the specified window. More...
 
void glfwMaximizeWindow (GLFWwindow *window)
 Maximizes the specified window. More...
 
void glfwShowWindow (GLFWwindow *window)
 Makes the specified window visible. More...
 
void glfwHideWindow (GLFWwindow *window)
 Hides the specified window. More...
 
void glfwFocusWindow (GLFWwindow *window)
 Brings the specified window to front and sets input focus. More...
 
void glfwRequestWindowAttention (GLFWwindow *window)
 Requests user attention to the specified window. More...
 
GLFWmonitorglfwGetWindowMonitor (GLFWwindow *window)
 Returns the monitor that the window uses for full screen mode. More...
 
void glfwSetWindowMonitor (GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)
 Sets the mode, monitor, video mode and placement of a window. More...
 
int glfwGetWindowAttrib (GLFWwindow *window, int attrib)
 Returns an attribute of the specified window. More...
 
void glfwSetWindowAttrib (GLFWwindow *window, int attrib, int value)
 Sets an attribute of the specified window. More...
 
void glfwSetWindowUserPointer (GLFWwindow *window, void *pointer)
 Sets the user pointer of the specified window. More...
 
void * glfwGetWindowUserPointer (GLFWwindow *window)
 Returns the user pointer of the specified window. More...
 
GLFWwindowposfun glfwSetWindowPosCallback (GLFWwindow *window, GLFWwindowposfun callback)
 Sets the position callback for the specified window. More...
 
GLFWwindowsizefun glfwSetWindowSizeCallback (GLFWwindow *window, GLFWwindowsizefun callback)
 Sets the size callback for the specified window. More...
 
GLFWwindowclosefun glfwSetWindowCloseCallback (GLFWwindow *window, GLFWwindowclosefun callback)
 Sets the close callback for the specified window. More...
 
GLFWwindowrefreshfun glfwSetWindowRefreshCallback (GLFWwindow *window, GLFWwindowrefreshfun callback)
 Sets the refresh callback for the specified window. More...
 
GLFWwindowfocusfun glfwSetWindowFocusCallback (GLFWwindow *window, GLFWwindowfocusfun callback)
 Sets the focus callback for the specified window. More...
 
GLFWwindowiconifyfun glfwSetWindowIconifyCallback (GLFWwindow *window, GLFWwindowiconifyfun callback)
 Sets the iconify callback for the specified window. More...
 
GLFWwindowmaximizefun glfwSetWindowMaximizeCallback (GLFWwindow *window, GLFWwindowmaximizefun callback)
 Sets the maximize callback for the specified window. More...
 
GLFWframebuffersizefun glfwSetFramebufferSizeCallback (GLFWwindow *window, GLFWframebuffersizefun callback)
 Sets the framebuffer resize callback for the specified window. More...
 
GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback (GLFWwindow *window, GLFWwindowcontentscalefun callback)
 Sets the window content scale callback for the specified window. More...
 
void glfwPollEvents (void)
 Processes all pending events. More...
 
void glfwWaitEvents (void)
 Waits until events are queued and processes them. More...
 
void glfwWaitEventsTimeout (double timeout)
 Waits with timeout until events are queued and processes them. More...
 
void glfwPostEmptyEvent (void)
 Posts an empty event to the event queue. More...
 
void glfwSwapBuffers (GLFWwindow *window)
 Swaps the front and back buffers of the specified window. More...
 

Macro Definition Documentation

◆ GLFW_FOCUSED

#define GLFW_FOCUSED   0x00020001

Input focus window hint or window attribute.

◆ GLFW_ICONIFIED

#define GLFW_ICONIFIED   0x00020002

Window iconification window attribute.

◆ GLFW_RESIZABLE

#define GLFW_RESIZABLE   0x00020003

Window resize-ability window hint and window attribute.

◆ GLFW_VISIBLE

#define GLFW_VISIBLE   0x00020004

Window visibility window hint and window attribute.

◆ GLFW_DECORATED

#define GLFW_DECORATED   0x00020005

Window decoration window hint and window attribute.

◆ GLFW_AUTO_ICONIFY

#define GLFW_AUTO_ICONIFY   0x00020006

Window auto-iconification window hint and window attribute.

◆ GLFW_FLOATING

#define GLFW_FLOATING   0x00020007

Window decoration window hint and window attribute.

◆ GLFW_MAXIMIZED

#define GLFW_MAXIMIZED   0x00020008

Window maximization window hint and window attribute.

◆ GLFW_CENTER_CURSOR

#define GLFW_CENTER_CURSOR   0x00020009

Cursor centering window hint.

◆ GLFW_TRANSPARENT_FRAMEBUFFER

#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A

Window framebuffer transparency window hint and window attribute.

◆ GLFW_HOVERED

#define GLFW_HOVERED   0x0002000B

Mouse cursor hover window attribute.

◆ GLFW_FOCUS_ON_SHOW

#define GLFW_FOCUS_ON_SHOW   0x0002000C

Input focus window hint or window attribute.

◆ GLFW_RED_BITS

#define GLFW_RED_BITS   0x00021001

Framebuffer bit depth hint.

◆ GLFW_GREEN_BITS

#define GLFW_GREEN_BITS   0x00021002

Framebuffer bit depth hint.

◆ GLFW_BLUE_BITS

#define GLFW_BLUE_BITS   0x00021003

Framebuffer bit depth hint.

◆ GLFW_ALPHA_BITS

#define GLFW_ALPHA_BITS   0x00021004

Framebuffer bit depth hint.

◆ GLFW_DEPTH_BITS

#define GLFW_DEPTH_BITS   0x00021005

Framebuffer bit depth hint.

◆ GLFW_STENCIL_BITS

#define GLFW_STENCIL_BITS   0x00021006

Framebuffer bit depth hint.

◆ GLFW_ACCUM_RED_BITS

#define GLFW_ACCUM_RED_BITS   0x00021007

Framebuffer bit depth hint.

◆ GLFW_ACCUM_GREEN_BITS

#define GLFW_ACCUM_GREEN_BITS   0x00021008

Framebuffer bit depth hint.

◆ GLFW_ACCUM_BLUE_BITS

#define GLFW_ACCUM_BLUE_BITS   0x00021009

Framebuffer bit depth hint.

◆ GLFW_ACCUM_ALPHA_BITS

#define GLFW_ACCUM_ALPHA_BITS   0x0002100A

Framebuffer bit depth hint.

◆ GLFW_AUX_BUFFERS

#define GLFW_AUX_BUFFERS   0x0002100B

Framebuffer auxiliary buffer hint.

◆ GLFW_STEREO

#define GLFW_STEREO   0x0002100C

OpenGL stereoscopic rendering hint.

◆ GLFW_SAMPLES

#define GLFW_SAMPLES   0x0002100D

Framebuffer MSAA samples hint.

◆ GLFW_SRGB_CAPABLE

#define GLFW_SRGB_CAPABLE   0x0002100E

Framebuffer sRGB hint.

◆ GLFW_REFRESH_RATE

#define GLFW_REFRESH_RATE   0x0002100F

Monitor refresh rate hint.

◆ GLFW_DOUBLEBUFFER

#define GLFW_DOUBLEBUFFER   0x00021010

Framebuffer double buffering hint.

◆ GLFW_CLIENT_API

#define GLFW_CLIENT_API   0x00022001

Context client API hint and attribute.

◆ GLFW_CONTEXT_VERSION_MAJOR

#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002

Context client API major version hint and attribute.

◆ GLFW_CONTEXT_VERSION_MINOR

#define GLFW_CONTEXT_VERSION_MINOR   0x00022003

Context client API minor version hint and attribute.

◆ GLFW_CONTEXT_REVISION

#define GLFW_CONTEXT_REVISION   0x00022004

Context client API revision number attribute.

◆ GLFW_CONTEXT_ROBUSTNESS

#define GLFW_CONTEXT_ROBUSTNESS   0x00022005

Context client API revision number hint and attribute.

◆ GLFW_OPENGL_FORWARD_COMPAT

#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006

OpenGL forward-compatibility hint and attribute.

◆ GLFW_OPENGL_DEBUG_CONTEXT

#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007

OpenGL debug context hint and attribute.

◆ GLFW_OPENGL_PROFILE

#define GLFW_OPENGL_PROFILE   0x00022008

OpenGL profile hint and attribute.

◆ GLFW_CONTEXT_RELEASE_BEHAVIOR

#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009

Context flush-on-release hint and attribute.

◆ GLFW_CONTEXT_NO_ERROR

#define GLFW_CONTEXT_NO_ERROR   0x0002200A

Context error suppression hint and attribute.

◆ GLFW_CONTEXT_CREATION_API

#define GLFW_CONTEXT_CREATION_API   0x0002200B

Context creation API hint and attribute.

◆ GLFW_SCALE_TO_MONITOR

#define GLFW_SCALE_TO_MONITOR   0x0002200C

◆ GLFW_COCOA_RETINA_FRAMEBUFFER

#define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001

◆ GLFW_COCOA_FRAME_NAME

#define GLFW_COCOA_FRAME_NAME   0x00023002

◆ GLFW_COCOA_GRAPHICS_SWITCHING

#define GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003

◆ GLFW_X11_CLASS_NAME

#define GLFW_X11_CLASS_NAME   0x00024001

◆ GLFW_X11_INSTANCE_NAME

#define GLFW_X11_INSTANCE_NAME   0x00024002

Typedef Documentation

◆ GLFWwindow

typedef struct GLFWwindow GLFWwindow

Opaque window object.

See also
Window objects
Since
Added in version 3.0.

◆ GLFWwindowposfun

typedef void(* GLFWwindowposfun) (GLFWwindow *, int, int)

This is the function pointer type for window position callbacks. A window position callback function has the following signature:

void callback_name(GLFWwindow* window, int xpos, int ypos)
Parameters
[in]windowThe window that was moved.
[in]xposThe new x-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.
[in]yposThe new y-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.
See also
Window position
glfwSetWindowPosCallback
Since
Added in version 3.0.

◆ GLFWwindowsizefun

typedef void(* GLFWwindowsizefun) (GLFWwindow *, int, int)

This is the function pointer type for window size callbacks. A window size callback function has the following signature:

void callback_name(GLFWwindow* window, int width, int height)
Parameters
[in]windowThe window that was resized.
[in]widthThe new width, in screen coordinates, of the window.
[in]heightThe new height, in screen coordinates, of the window.
See also
Window size
glfwSetWindowSizeCallback
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ GLFWwindowclosefun

typedef void(* GLFWwindowclosefun) (GLFWwindow *)

This is the function pointer type for window close callbacks. A window close callback function has the following signature:

void function_name(GLFWwindow* window)
Parameters
[in]windowThe window that the user attempted to close.
See also
Window closing and close flag
glfwSetWindowCloseCallback
Since
Added in version 2.5. GLFW 3: Added window handle parameter.

◆ GLFWwindowrefreshfun

typedef void(* GLFWwindowrefreshfun) (GLFWwindow *)

This is the function pointer type for window content refresh callbacks. A window content refresh callback function has the following signature:

void function_name(GLFWwindow* window);
Parameters
[in]windowThe window whose content needs to be refreshed.
See also
Window damage and refresh
glfwSetWindowRefreshCallback
Since
Added in version 2.5. GLFW 3: Added window handle parameter.

◆ GLFWwindowfocusfun

typedef void(* GLFWwindowfocusfun) (GLFWwindow *, int)

This is the function pointer type for window focus callbacks. A window focus callback function has the following signature:

void function_name(GLFWwindow* window, int focused)
Parameters
[in]windowThe window that gained or lost input focus.
[in]focusedGLFW_TRUE if the window was given input focus, or GLFW_FALSE if it lost it.
See also
Window input focus
glfwSetWindowFocusCallback
Since
Added in version 3.0.

◆ GLFWwindowiconifyfun

typedef void(* GLFWwindowiconifyfun) (GLFWwindow *, int)

This is the function pointer type for window iconify callbacks. A window iconify callback function has the following signature:

void function_name(GLFWwindow* window, int iconified)
Parameters
[in]windowThe window that was iconified or restored.
[in]iconifiedGLFW_TRUE if the window was iconified, or GLFW_FALSE if it was restored.
See also
Window iconification
glfwSetWindowIconifyCallback
Since
Added in version 3.0.

◆ GLFWwindowmaximizefun

typedef void(* GLFWwindowmaximizefun) (GLFWwindow *, int)

This is the function pointer type for window maximize callbacks. A window maximize callback function has the following signature:

void function_name(GLFWwindow* window, int maximized)
Parameters
[in]windowThe window that was maximized or restored.
[in]iconifiedGLFW_TRUE if the window was maximized, or GLFW_FALSE if it was restored.
See also
Window maximization
glfwSetWindowMaximizeCallback
Since
Added in version 3.3.

◆ GLFWframebuffersizefun

typedef void(* GLFWframebuffersizefun) (GLFWwindow *, int, int)

This is the function pointer type for framebuffer size callbacks. A framebuffer size callback function has the following signature:

void function_name(GLFWwindow* window, int width, int height)
Parameters
[in]windowThe window whose framebuffer was resized.
[in]widthThe new width, in pixels, of the framebuffer.
[in]heightThe new height, in pixels, of the framebuffer.
See also
Framebuffer size
glfwSetFramebufferSizeCallback
Since
Added in version 3.0.

◆ GLFWwindowcontentscalefun

typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *, float, float)

This is the function pointer type for window content scale callbacks. A window content scale callback function has the following signature:

void function_name(GLFWwindow* window, float xscale, float yscale)
Parameters
[in]windowThe window whose content scale changed.
[in]xscaleThe new x-axis content scale of the window.
[in]yscaleThe new y-axis content scale of the window.
See also
Window content scale
glfwSetWindowContentScaleCallback
Since
Added in version 3.3.

◆ GLFWimage

typedef struct GLFWimage GLFWimage

This describes a single 2D image. See the documentation for each related function what the expected pixel format is.

See also
Custom cursor creation
Window icon
Since
Added in version 2.1. GLFW 3: Removed format and bytes-per-pixel members.

Function Documentation

◆ glfwDefaultWindowHints()

void glfwDefaultWindowHints ( void  )

This function resets all window hints to their default values.

Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window creation hints
glfwWindowHint
glfwWindowHintString
Since
Added in version 3.0.

◆ glfwWindowHint()

void glfwWindowHint ( int  hint,
int  value 
)

This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to this function or glfwDefaultWindowHints, or until the library is terminated.

Only integer value hints can be set with this function. String value hints are set with glfwWindowHintString.

This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to glfwCreateWindow.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters
[in]hintThe window hint to set.
[in]valueThe new value of the window hint.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Thread safety
This function must only be called from the main thread.
See also
Window creation hints
glfwWindowHintString
glfwDefaultWindowHints
Since
Added in version 3.0. Replaces glfwOpenWindowHint.

◆ glfwWindowHintString()

void glfwWindowHintString ( int  hint,
const char *  value 
)

This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to this function or glfwDefaultWindowHints, or until the library is terminated.

Only string type hints can be set with this function. Integer value hints are set with glfwWindowHint.

This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to glfwCreateWindow.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters
[in]hintThe window hint to set.
[in]valueThe new value of the window hint.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.
Pointer lifetime
The specified string is copied before this function returns.
Thread safety
This function must only be called from the main thread.
See also
Window creation hints
glfwWindowHint
glfwDefaultWindowHints
Since
Added in version 3.3.

◆ glfwCreateWindow()

GLFWwindow* glfwCreateWindow ( int  width,
int  height,
const char *  title,
GLFWmonitor monitor,
GLFWwindow share 
)

This function creates a window and its associated OpenGL or OpenGL ES context. Most of the options controlling how the window and its context should be created are specified with window hints.

Successful creation does not change which context is current. Before you can use the newly created context, you need to make it current. For information about the share parameter, see Context object sharing.

The created window, framebuffer and context may differ from what you requested, as not all parameters and hints are hard constraints. This includes the size of the window, especially for full screen windows. To query the actual attributes of the created window, framebuffer and context, see glfwGetWindowAttrib, glfwGetWindowSize and glfwGetFramebufferSize.

To create a full screen window, you need to specify the monitor the window will cover. If no monitor is specified, the window will be windowed mode. Unless you have a way for the user to choose a specific monitor, it is recommended that you pick the primary monitor. For more information on how to query connected monitors, see Retrieving monitors.

For full screen windows, the specified size becomes the resolution of the window's desired video mode. As long as a full screen window is not iconified, the supported video mode most closely matching the desired video mode is set for the specified monitor. For more information about full screen windows, including the creation of so called windowed full screen or borderless full screen windows, see "Windowed full screen" windows.

Once you have created the window, you can switch it between windowed and full screen mode with glfwSetWindowMonitor. This will not affect its OpenGL or OpenGL ES context.

By default, newly created windows use the placement recommended by the window system. To create the window at a specific position, make it initially invisible using the GLFW_VISIBLE window hint, set its position and then show it.

As long as at least one full screen window is not iconified, the screensaver is prohibited from starting.

Window systems put limits on window sizes. Very large or very small window dimensions may be overridden by the window system on creation. Check the actual size after creation.

The swap interval is not set during window creation and the initial value may vary depending on driver settings and defaults.

Parameters
[in]widthThe desired width, in screen coordinates, of the window. This must be greater than zero.
[in]heightThe desired height, in screen coordinates, of the window. This must be greater than zero.
[in]titleThe initial, UTF-8 encoded window title.
[in]monitorThe monitor to use for full screen mode, or NULL for windowed mode.
[in]shareThe window whose context to share resources with, or NULL to not share resources.
Returns
The handle of the created window, or NULL if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE, GLFW_API_UNAVAILABLE, GLFW_VERSION_UNAVAILABLE, GLFW_FORMAT_UNAVAILABLE and GLFW_PLATFORM_ERROR.
Remarks
Windows: Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.
Windows: If the executable has an icon resource named GLFW_ICON, it will be set as the initial icon for the window. If no such icon is present, the IDI_APPLICATION icon will be used instead. To set a different icon, see glfwSetWindowIcon.
Windows: The context to share resources with must not be current on any other thread.
macOS: The OS only supports forward-compatible core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the GLFW_OPENGL_FORWARD_COMPAT and GLFW_OPENGL_PROFILE hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
macOS: The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
macOS: The first time a window is created the menu bar is created. If GLFW finds a MainMenu.nib it is loaded and assumed to contain a menu bar. Otherwise a minimal menu bar is created manually with common commands like Hide, Quit and About. The About entry opens a minimal about dialog with information from the application's bundle. Menu bar creation can be disabled entirely with the GLFW_COCOA_MENUBAR init hint.
macOS: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the GLFW_COCOA_RETINA_FRAMEBUFFER hint is GLFW_TRUE and the NSHighResolutionCapable key is enabled in the application bundle's Info.plist. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. The GLFW test and example programs use a custom Info.plist template for this, which can be found as CMake/MacOSXBundleInfo.plist.in in the source tree.
macOS: When activating frame autosaving with GLFW_COCOA_FRAME_NAME, the specified window size and position may be overridden by previously saved values.
X11: Some window managers will not respect the placement of initially hidden windows.
X11: Due to the asynchronous nature of X11, it may take a moment for a window to reach its requested state. This means you may not be able to query the final size, position or other attributes directly after window creation.
X11: The class part of the WM_CLASS window property will by default be set to the window title passed to this function. The instance part will use the contents of the RESOURCE_NAME environment variable, if present and not empty, or fall back to the window title. Set the GLFW_X11_CLASS_NAME and GLFW_X11_INSTANCE_NAME window hints to override this.
Wayland: Compositors should implement the xdg-decoration protocol for GLFW to decorate the window properly. If this protocol isn't supported, or if the compositor prefers client-side decorations, a very simple fallback frame will be drawn using the wp_viewporter protocol. A compositor can still emit close, maximize or fullscreen events, using for instance a keybind mechanism. If neither of these protocols is supported, the window won't be decorated.
Wayland: A full screen window will not attempt to change the mode, no matter what the requested size or refresh rate.
Wayland: Screensaver inhibition requires the idle-inhibit protocol to be implemented in the user's compositor.
Thread safety
This function must only be called from the main thread.
See also
Window creation
glfwDestroyWindow
Since
Added in version 3.0. Replaces glfwOpenWindow.

◆ glfwDestroyWindow()

void glfwDestroyWindow ( GLFWwindow window)

This function destroys the specified window and its context. On calling this function, no further callbacks will be called for that window.

If the context of the specified window is current on the main thread, it is detached before being destroyed.

Parameters
[in]windowThe window to destroy.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Note
The context of the specified window must not be current on any other thread when this function is called.
Reentrancy
This function must not be called from a callback.
Thread safety
This function must only be called from the main thread.
See also
Window creation
glfwCreateWindow
Since
Added in version 3.0. Replaces glfwCloseWindow.

◆ glfwWindowShouldClose()

int glfwWindowShouldClose ( GLFWwindow window)

This function returns the value of the close flag of the specified window.

Parameters
[in]windowThe window to query.
Returns
The value of the close flag.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
Window closing and close flag
Since
Added in version 3.0.

◆ glfwSetWindowShouldClose()

void glfwSetWindowShouldClose ( GLFWwindow window,
int  value 
)

This function sets the value of the close flag of the specified window. This can be used to override the user's attempt to close the window, or to signal that it should be closed.

Parameters
[in]windowThe window whose flag to change.
[in]valueThe new value.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
Window closing and close flag
Since
Added in version 3.0.

◆ glfwSetWindowTitle()

void glfwSetWindowTitle ( GLFWwindow window,
const char *  title 
)

This function sets the window title, encoded as UTF-8, of the specified window.

Parameters
[in]windowThe window whose title to change.
[in]titleThe UTF-8 encoded window title.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
macOS: The window title will not be updated until the next time you process events.
Thread safety
This function must only be called from the main thread.
See also
Window title
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwSetWindowIcon()

void glfwSetWindowIcon ( GLFWwindow window,
int  count,
const GLFWimage images 
)

This function sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.

Parameters
[in]windowThe window whose icon to set.
[in]countThe number of images in the specified array, or zero to revert to the default window icon.
[in]imagesThe images to create the icon from. This is ignored if count is zero.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Pointer lifetime
The specified image data is copied before this function returns.
Remarks
macOS: The GLFW window has no icon, as it is not a document window, so this function does nothing. The dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
Wayland: There is no existing protocol to change an icon, the window will thus inherit the one defined in the application's desktop file. This function always emits GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window icon
Since
Added in version 3.2.

◆ glfwGetWindowPos()

void glfwGetWindowPos ( GLFWwindow window,
int *  xpos,
int *  ypos 
)

This function retrieves the position, in screen coordinates, of the upper-left corner of the content area of the specified window.

Any or all of the position arguments may be NULL. If an error occurs, all non-NULL position arguments will be set to zero.

Parameters
[in]windowThe window to query.
[out]xposWhere to store the x-coordinate of the upper-left corner of the content area, or NULL.
[out]yposWhere to store the y-coordinate of the upper-left corner of the content area, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: There is no way for an application to retrieve the global position of its windows, this function will always emit GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window position
glfwSetWindowPos
Since
Added in version 3.0.

◆ glfwSetWindowPos()

void glfwSetWindowPos ( GLFWwindow window,
int  xpos,
int  ypos 
)

This function sets the position, in screen coordinates, of the upper-left corner of the content area of the specified windowed mode window. If the window is a full screen window, this function does nothing.

Do not use this function to move an already visible window unless you have very good reasons for doing so, as it will confuse and annoy the user.

The window manager may put limits on what positions are allowed. GLFW cannot and should not override these limits.

Parameters
[in]windowThe window to query.
[in]xposThe x-coordinate of the upper-left corner of the content area.
[in]yposThe y-coordinate of the upper-left corner of the content area.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: There is no way for an application to set the global position of its windows, this function will always emit GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window position
glfwGetWindowPos
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwGetWindowSize()

void glfwGetWindowSize ( GLFWwindow window,
int *  width,
int *  height 
)

This function retrieves the size, in screen coordinates, of the content area of the specified window. If you wish to retrieve the size of the framebuffer of the window in pixels, see glfwGetFramebufferSize.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]windowThe window whose size to retrieve.
[out]widthWhere to store the width, in screen coordinates, of the content area, or NULL.
[out]heightWhere to store the height, in screen coordinates, of the content area, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window size
glfwSetWindowSize
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwSetWindowSizeLimits()

void glfwSetWindowSizeLimits ( GLFWwindow window,
int  minwidth,
int  minheight,
int  maxwidth,
int  maxheight 
)

This function sets the size limits of the content area of the specified window. If the window is full screen, the size limits only take effect once it is made windowed. If the window is not resizable, this function does nothing.

The size limits are applied immediately to a windowed mode window and may cause it to be resized.

The maximum dimensions must be greater than or equal to the minimum dimensions and all must be greater than or equal to zero.

Parameters
[in]windowThe window to set limits for.
[in]minwidthThe minimum width, in screen coordinates, of the content area, or GLFW_DONT_CARE.
[in]minheightThe minimum height, in screen coordinates, of the content area, or GLFW_DONT_CARE.
[in]maxwidthThe maximum width, in screen coordinates, of the content area, or GLFW_DONT_CARE.
[in]maxheightThe maximum height, in screen coordinates, of the content area, or GLFW_DONT_CARE.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.
Remarks
If you set size limits and an aspect ratio that conflict, the results are undefined.
Wayland: The size limits will not be applied until the window is actually resized, either by the user or by the compositor.
Thread safety
This function must only be called from the main thread.
See also
Window size limits
glfwSetWindowAspectRatio
Since
Added in version 3.2.

◆ glfwSetWindowAspectRatio()

void glfwSetWindowAspectRatio ( GLFWwindow window,
int  numer,
int  denom 
)

This function sets the required aspect ratio of the content area of the specified window. If the window is full screen, the aspect ratio only takes effect once it is made windowed. If the window is not resizable, this function does nothing.

The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero. For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.

If the numerator and denominator is set to GLFW_DONT_CARE then the aspect ratio limit is disabled.

The aspect ratio is applied immediately to a windowed mode window and may cause it to be resized.

Parameters
[in]windowThe window to set limits for.
[in]numerThe numerator of the desired aspect ratio, or GLFW_DONT_CARE.
[in]denomThe denominator of the desired aspect ratio, or GLFW_DONT_CARE.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.
Remarks
If you set size limits and an aspect ratio that conflict, the results are undefined.
Wayland: The aspect ratio will not be applied until the window is actually resized, either by the user or by the compositor.
Thread safety
This function must only be called from the main thread.
See also
Window size limits
glfwSetWindowSizeLimits
Since
Added in version 3.2.

◆ glfwSetWindowSize()

void glfwSetWindowSize ( GLFWwindow window,
int  width,
int  height 
)

This function sets the size, in screen coordinates, of the content area of the specified window.

For full screen windows, this function updates the resolution of its desired video mode and switches to the video mode closest to it, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.

If you wish to update the refresh rate of the desired video mode in addition to its resolution, see glfwSetWindowMonitor.

The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.

Parameters
[in]windowThe window to resize.
[in]widthThe desired width, in screen coordinates, of the window content area.
[in]heightThe desired height, in screen coordinates, of the window content area.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: A full screen window will not attempt to change the mode, no matter what the requested size.
Thread safety
This function must only be called from the main thread.
See also
Window size
glfwGetWindowSize
glfwSetWindowMonitor
Since
Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwGetFramebufferSize()

void glfwGetFramebufferSize ( GLFWwindow window,
int *  width,
int *  height 
)

This function retrieves the size, in pixels, of the framebuffer of the specified window. If you wish to retrieve the size of the window in screen coordinates, see glfwGetWindowSize.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]windowThe window whose framebuffer to query.
[out]widthWhere to store the width, in pixels, of the framebuffer, or NULL.
[out]heightWhere to store the height, in pixels, of the framebuffer, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Framebuffer size
glfwSetFramebufferSizeCallback
Since
Added in version 3.0.

◆ glfwGetWindowFrameSize()

void glfwGetWindowFrameSize ( GLFWwindow window,
int *  left,
int *  top,
int *  right,
int *  bottom 
)

This function retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the window-related hints used to create it.

Because this function retrieves the size of each window frame edge and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]windowThe window whose frame size to query.
[out]leftWhere to store the size, in screen coordinates, of the left edge of the window frame, or NULL.
[out]topWhere to store the size, in screen coordinates, of the top edge of the window frame, or NULL.
[out]rightWhere to store the size, in screen coordinates, of the right edge of the window frame, or NULL.
[out]bottomWhere to store the size, in screen coordinates, of the bottom edge of the window frame, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window size
Since
Added in version 3.1.

◆ glfwGetWindowContentScale()

void glfwGetWindowContentScale ( GLFWwindow window,
float *  xscale,
float *  yscale 
)

This function retrieves the content scale for the specified window. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

On systems where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on.

Parameters
[in]windowThe window to query.
[out]xscaleWhere to store the x-axis content scale, or NULL.
[out]yscaleWhere to store the y-axis content scale, or NULL.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window content scale
glfwSetWindowContentScaleCallback
glfwGetMonitorContentScale
Since
Added in version 3.3.

◆ glfwGetWindowOpacity()

float glfwGetWindowOpacity ( GLFWwindow window)

This function returns the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque. If the system does not support whole window transparency, this function always returns one.

The initial opacity value for newly created windows is one.

Parameters
[in]windowThe window to query.
Returns
The opacity value of the specified window.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window transparency
glfwSetWindowOpacity
Since
Added in version 3.3.

◆ glfwSetWindowOpacity()

void glfwSetWindowOpacity ( GLFWwindow window,
float  opacity 
)

This function sets the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque.

The initial opacity value for newly created windows is one.

A window created with framebuffer transparency may not use whole window transparency. The results of doing this are undefined.

Parameters
[in]windowThe window to set the opacity for.
[in]opacityThe desired opacity of the specified window.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window transparency
glfwGetWindowOpacity
Since
Added in version 3.3.

◆ glfwIconifyWindow()

void glfwIconifyWindow ( GLFWwindow window)

This function iconifies (minimizes) the specified window if it was previously restored. If the window is already iconified, this function does nothing.

If the specified window is a full screen window, the original monitor resolution is restored until the window is restored.

Parameters
[in]windowThe window to iconify.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: There is no concept of iconification in wl_shell, this function will emit GLFW_PLATFORM_ERROR when using this deprecated protocol.
Thread safety
This function must only be called from the main thread.
See also
Window iconification
glfwRestoreWindow
glfwMaximizeWindow
Since
Added in version 2.1. GLFW 3: Added window handle parameter.

◆ glfwRestoreWindow()

void glfwRestoreWindow ( GLFWwindow window)

This function restores the specified window if it was previously iconified (minimized) or maximized. If the window is already restored, this function does nothing.

If the specified window is a full screen window, the resolution chosen for the window is restored on the selected monitor.

Parameters
[in]windowThe window to restore.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window iconification
glfwIconifyWindow
glfwMaximizeWindow
Since
Added in version 2.1. GLFW 3: Added window handle parameter.

◆ glfwMaximizeWindow()

void glfwMaximizeWindow ( GLFWwindow window)

This function maximizes the specified window if it was previously not maximized. If the window is already maximized, this function does nothing.

If the specified window is a full screen window, this function does nothing.

Parameters
[in]windowThe window to maximize.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread Safety
This function may only be called from the main thread.
See also
Window iconification
glfwIconifyWindow
glfwRestoreWindow
Since
Added in GLFW 3.2.

◆ glfwShowWindow()

void glfwShowWindow ( GLFWwindow window)

This function makes the specified window visible if it was previously hidden. If the window is already visible or is in full screen mode, this function does nothing.

By default, windowed mode windows are focused when shown Set the GLFW_FOCUS_ON_SHOW window hint to change this behavior for all newly created windows, or change the behavior for an existing window with glfwSetWindowAttrib.

Parameters
[in]windowThe window to make visible.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window visibility
glfwHideWindow
Since
Added in version 3.0.

◆ glfwHideWindow()

void glfwHideWindow ( GLFWwindow window)

This function hides the specified window if it was previously visible. If the window is already hidden or is in full screen mode, this function does nothing.

Parameters
[in]windowThe window to hide.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window visibility
glfwShowWindow
Since
Added in version 3.0.

◆ glfwFocusWindow()

void glfwFocusWindow ( GLFWwindow window)

This function brings the specified window to front and sets input focus. The window should already be visible and not iconified.

By default, both windowed and full screen mode windows are focused when initially created. Set the GLFW_FOCUSED to disable this behavior.

Also by default, windowed mode windows are focused when shown with glfwShowWindow. Set the GLFW_FOCUS_ON_SHOW to disable this behavior.

Do not use this function to steal focus from other applications unless you are certain that is what the user wants. Focus stealing can be extremely disruptive.

For a less disruptive way of getting the user's attention, see attention requests.

Parameters
[in]windowThe window to give input focus.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
Wayland: It is not possible for an application to bring its windows to front, this function will always emit GLFW_PLATFORM_ERROR.
Thread safety
This function must only be called from the main thread.
See also
Window input focus
Window attention request
Since
Added in version 3.2.

◆ glfwRequestWindowAttention()

void glfwRequestWindowAttention ( GLFWwindow window)

This function requests user attention to the specified window. On platforms where this is not supported, attention is requested to the application as a whole.

Once the user has given attention, usually by focusing the window or application, the system will end the request automatically.

Parameters
[in]windowThe window to request attention to.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
macOS: Attention is requested to the application as a whole, not the specific window.
Thread safety
This function must only be called from the main thread.
See also
Window attention request
Since
Added in version 3.3.

◆ glfwGetWindowMonitor()

GLFWmonitor* glfwGetWindowMonitor ( GLFWwindow window)

This function returns the handle of the monitor that the specified window is in full screen on.

Parameters
[in]windowThe window to query.
Returns
The monitor, or NULL if the window is in windowed mode or an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window monitor
glfwSetWindowMonitor
Since
Added in version 3.0.

◆ glfwSetWindowMonitor()

void glfwSetWindowMonitor ( GLFWwindow window,
GLFWmonitor monitor,
int  xpos,
int  ypos,
int  width,
int  height,
int  refreshRate 
)

This function sets the monitor that the window uses for full screen mode or, if the monitor is NULL, makes it windowed mode.

When setting a monitor, this function updates the width, height and refresh rate of the desired video mode and switches to the video mode closest to it. The window position is ignored when setting a monitor.

When the monitor is NULL, the position, width and height are used to place the window content area. The refresh rate is ignored when no monitor is specified.

If you only wish to update the resolution of a full screen window or the size of a windowed mode window, see glfwSetWindowSize.

When a window transitions from full screen to windowed mode, this function restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.

Parameters
[in]windowThe window whose monitor, size or video mode to set.
[in]monitorThe desired monitor, or NULL to set windowed mode.
[in]xposThe desired x-coordinate of the upper-left corner of the content area.
[in]yposThe desired y-coordinate of the upper-left corner of the content area.
[in]widthThe desired with, in screen coordinates, of the content area or video mode.
[in]heightThe desired height, in screen coordinates, of the content area or video mode.
[in]refreshRateThe desired refresh rate, in Hz, of the video mode, or GLFW_DONT_CARE.
Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Remarks
The OpenGL or OpenGL ES context will not be destroyed or otherwise affected by any resizing or mode switching, although you may need to update your viewport if the framebuffer size has changed.
Wayland: The desired window position is ignored, as there is no way for an application to set this property.
Wayland: Setting the window to full screen will not attempt to change the mode, no matter what the requested size or refresh rate.
Thread safety
This function must only be called from the main thread.
See also
Window monitor
Full screen windows
glfwGetWindowMonitor
glfwSetWindowSize
Since
Added in version 3.2.

◆ glfwGetWindowAttrib()

int glfwGetWindowAttrib ( GLFWwindow window,
int  attrib 
)

This function returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.

Parameters
[in]windowThe window to query.
[in]attribThe window attribute whose value to return.
Returns
The value of the attribute, or zero if an error occurred.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.
Remarks
Framebuffer related hints are not window attributes. See Framebuffer related attributes for more information.
Zero is a valid value for many window and context related attributes so you cannot use a return value of zero as an indication of errors. However, this function should not fail as long as it is passed valid arguments and the library has been initialized.
Thread safety
This function must only be called from the main thread.
See also
Window attributes
glfwSetWindowAttrib
Since
Added in version 3.0. Replaces glfwGetWindowParam and glfwGetGLVersion.

◆ glfwSetWindowAttrib()

void glfwSetWindowAttrib ( GLFWwindow window,
int  attrib,
int  value 
)

This function sets the value of an attribute of the specified window.

The supported attributes are GLFW_DECORATED, GLFW_RESIZABLE, GLFW_FLOATING, GLFW_AUTO_ICONIFY and GLFW_FOCUS_ON_SHOW.

Some of these attributes are ignored for full screen windows. The new value will take effect if the window is later made windowed.

Some of these attributes are ignored for windowed mode windows. The new value will take effect if the window is later made full screen.

Parameters
[in]windowThe window to set the attribute for.
[in]attribA supported window attribute.
[in]valueGLFW_TRUE or GLFW_FALSE.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.
Remarks
Calling glfwGetWindowAttrib will always return the latest value, even if that value is ignored by the current mode of the window.
Thread safety
This function must only be called from the main thread.
See also
Window attributes
glfwGetWindowAttrib
Since
Added in version 3.3.

◆ glfwSetWindowUserPointer()

void glfwSetWindowUserPointer ( GLFWwindow window,
void *  pointer 
)

This function sets the user-defined pointer of the specified window. The current value is retained until the window is destroyed. The initial value is NULL.

Parameters
[in]windowThe window whose pointer to set.
[in]pointerThe new value.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
User pointer
glfwGetWindowUserPointer
Since
Added in version 3.0.

◆ glfwGetWindowUserPointer()

void* glfwGetWindowUserPointer ( GLFWwindow window)

This function returns the current value of the user-defined pointer of the specified window. The initial value is NULL.

Parameters
[in]windowThe window whose pointer to return.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function may be called from any thread. Access is not synchronized.
See also
User pointer
glfwSetWindowUserPointer
Since
Added in version 3.0.

◆ glfwSetWindowPosCallback()

GLFWwindowposfun glfwSetWindowPosCallback ( GLFWwindow window,
GLFWwindowposfun  callback 
)

This function sets the position callback of the specified window, which is called when the window is moved. The callback is provided with the position, in screen coordinates, of the upper-left corner of the content area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int xpos, int ypos)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Remarks
Wayland: This callback will never be called, as there is no way for an application to know its global position.
Thread safety
This function must only be called from the main thread.
See also
Window position
Since
Added in version 3.0.

◆ glfwSetWindowSizeCallback()

GLFWwindowsizefun glfwSetWindowSizeCallback ( GLFWwindow window,
GLFWwindowsizefun  callback 
)

This function sets the size callback of the specified window, which is called when the window is resized. The callback is provided with the size, in screen coordinates, of the content area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int width, int height)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window size
Since
Added in version 1.0. GLFW 3: Added window handle parameter and return value.

◆ glfwSetWindowCloseCallback()

GLFWwindowclosefun glfwSetWindowCloseCallback ( GLFWwindow window,
GLFWwindowclosefun  callback 
)

This function sets the close callback of the specified window, which is called when the user attempts to close the window, for example by clicking the close widget in the title bar.

The close flag is set before this callback is called, but you can modify it at any time with glfwSetWindowShouldClose.

The close callback is not triggered by glfwDestroyWindow.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Remarks
macOS: Selecting Quit from the application menu will trigger the close callback for all windows.
Thread safety
This function must only be called from the main thread.
See also
Window closing and close flag
Since
Added in version 2.5. GLFW 3: Added window handle parameter and return value.

◆ glfwSetWindowRefreshCallback()

GLFWwindowrefreshfun glfwSetWindowRefreshCallback ( GLFWwindow window,
GLFWwindowrefreshfun  callback 
)

This function sets the refresh callback of the specified window, which is called when the content area of the window needs to be redrawn, for example if the window has been exposed after having been covered by another window.

On compositing window systems such as Aero, Compiz, Aqua or Wayland, where the window contents are saved off-screen, this callback may be called only very infrequently or never at all.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window);
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window damage and refresh
Since
Added in version 2.5. GLFW 3: Added window handle parameter and return value.

◆ glfwSetWindowFocusCallback()

GLFWwindowfocusfun glfwSetWindowFocusCallback ( GLFWwindow window,
GLFWwindowfocusfun  callback 
)

This function sets the focus callback of the specified window, which is called when the window gains or loses input focus.

After the focus callback is called for a window that lost input focus, synthetic key and mouse button release events will be generated for all such that had been pressed. For more information, see glfwSetKeyCallback and glfwSetMouseButtonCallback.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int focused)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window input focus
Since
Added in version 3.0.

◆ glfwSetWindowIconifyCallback()

GLFWwindowiconifyfun glfwSetWindowIconifyCallback ( GLFWwindow window,
GLFWwindowiconifyfun  callback 
)

This function sets the iconification callback of the specified window, which is called when the window is iconified or restored.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int iconified)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Remarks
Wayland: The wl_shell protocol has no concept of iconification, this callback will never be called when using this deprecated protocol.
Thread safety
This function must only be called from the main thread.
See also
Window iconification
Since
Added in version 3.0.

◆ glfwSetWindowMaximizeCallback()

GLFWwindowmaximizefun glfwSetWindowMaximizeCallback ( GLFWwindow window,
GLFWwindowmaximizefun  callback 
)

This function sets the maximization callback of the specified window, which is called when the window is maximized or restored.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int maximized)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window maximization
Since
Added in version 3.3.

◆ glfwSetFramebufferSizeCallback()

GLFWframebuffersizefun glfwSetFramebufferSizeCallback ( GLFWwindow window,
GLFWframebuffersizefun  callback 
)

This function sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, int width, int height)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Framebuffer size
Since
Added in version 3.0.

◆ glfwSetWindowContentScaleCallback()

GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback ( GLFWwindow window,
GLFWwindowcontentscalefun  callback 
)

This function sets the window content scale callback of the specified window, which is called when the content scale of the specified window changes.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
Callback signature
void function_name(GLFWwindow* window, float xscale, float yscale)
For more information about the callback parameters, see the function pointer type.
Errors
Possible errors include GLFW_NOT_INITIALIZED.
Thread safety
This function must only be called from the main thread.
See also
Window content scale
glfwGetWindowContentScale
Since
Added in version 3.3.

◆ glfwPollEvents()

void glfwPollEvents ( void  )

This function processes only those events that are already in the event queue and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Reentrancy
This function must not be called from a callback.
Thread safety
This function must only be called from the main thread.
See also
Event processing
glfwWaitEvents
glfwWaitEventsTimeout
Since
Added in version 1.0.

◆ glfwWaitEvents()

void glfwWaitEvents ( void  )

This function puts the calling thread to sleep until at least one event is available in the event queue. Once one or more events are available, it behaves exactly like glfwPollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Reentrancy
This function must not be called from a callback.
Thread safety
This function must only be called from the main thread.
See also
Event processing
glfwPollEvents
glfwWaitEventsTimeout
Since
Added in version 2.5.

◆ glfwWaitEventsTimeout()

void glfwWaitEventsTimeout ( double  timeout)

This function puts the calling thread to sleep until at least one event is available in the event queue, or until the specified timeout is reached. If one or more events are available, it behaves exactly like glfwPollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

The timeout value must be a positive finite number.

Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Parameters
[in]timeoutThe maximum amount of time, in seconds, to wait.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.
Reentrancy
This function must not be called from a callback.
Thread safety
This function must only be called from the main thread.
See also
Event processing
glfwPollEvents
glfwWaitEvents
Since
Added in version 3.2.

◆ glfwPostEmptyEvent()

void glfwPostEmptyEvent ( void  )

This function posts an empty event from the current thread to the event queue, causing glfwWaitEvents or glfwWaitEventsTimeout to return.

Errors
Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.
Thread safety
This function may be called from any thread.
See also
Event processing
glfwWaitEvents
glfwWaitEventsTimeout
Since
Added in version 3.1.

◆ glfwSwapBuffers()

void glfwSwapBuffers ( GLFWwindow window)

This function swaps the front and back buffers of the specified window when rendering with OpenGL or OpenGL ES. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.

The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate a GLFW_NO_WINDOW_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see vkQueuePresentKHR instead.

Parameters
[in]windowThe window whose buffers to swap.
Errors
Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_WINDOW_CONTEXT and GLFW_PLATFORM_ERROR.
Remarks
EGL: The context of the specified window must be current on the calling thread.
Thread safety
This function may be called from any thread.
See also
Buffer swapping
glfwSwapInterval
Since
Added in version 1.0. GLFW 3: Added window handle parameter.
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1152
================================================ FILE: thirdparty/glfw/docs/html/index.html ================================================ GLFW: Main Page

Introduction

GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.

Release notes for version 3.3 list new features, caveats and deprecations.

Getting started is a guide for users new to GLFW. It takes you through how to write a small but complete program.

There are guides for each section of the API:

Once you have written a program, see Compiling GLFW and Building applications.

The reference documentation provides more detailed information about specific functions.

Moving from GLFW 2 to 3 explains what has changed and how to update existing code to use the new API.

There is a section on Guarantees and limitations for pointer lifetimes, reentrancy, thread safety, event order and backward and forward compatibility.

The FAQ answers many common questions about the design, implementation and use of GLFW.

Finally, Standards conformance explains what APIs, standards and protocols GLFW uses and what happens when they are not present on a given machine.

This documentation was generated with Doxygen. The sources for it are available in both the source distribution and GitHub repository.

================================================ FILE: thirdparty/glfw/docs/html/input_8dox.html ================================================ GLFW: input.dox File Reference
input.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/input_guide.html ================================================ GLFW: Input guide
Input guide

This guide introduces the input related functions of GLFW. For details on a specific function in this category, see the Input reference. There are also guides for the other areas of GLFW.

GLFW provides many kinds of input. While some can only be polled, like time, or only received via callbacks, like scrolling, many provide both callbacks and polling. Callbacks are more work to use than polling but is less CPU intensive and guarantees that you do not miss state changes.

All input callbacks receive a window handle. By using the window user pointer, you can access non-global structures or objects from your callbacks.

To get a better feel for how the various events callbacks behave, run the events test program. It register every callback supported by GLFW and prints out all arguments provided for every event, along with time and sequence information.

Event processing

GLFW needs to poll the window system for events both to provide input to the application and to prove to the window system that the application hasn't locked up. Event processing is normally done each frame after buffer swapping. Even when you have no windows, event polling needs to be done in order to receive monitor and joystick connection events.

There are three functions for processing pending events. glfwPollEvents, processes only those events that have already been received and then returns immediately.

This is the best choice when rendering continuously, like most games do.

If you only need to update the contents of the window when you receive new input, glfwWaitEvents is a better choice.

It puts the thread to sleep until at least one event has been received and then processes all received events. This saves a great deal of CPU cycles and is useful for, for example, editing tools.

If you want to wait for events but have UI elements or other tasks that need periodic updates, glfwWaitEventsTimeout lets you specify a timeout.

It puts the thread to sleep until at least one event has been received, or until the specified number of seconds have elapsed. It then processes any received events.

If the main thread is sleeping in glfwWaitEvents, you can wake it from another thread by posting an empty event to the event queue with glfwPostEmptyEvent.

Do not assume that callbacks will only be called in response to the above functions. While it is necessary to process events in one or more of the ways above, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

For example, on Windows the system function that glfwSetWindowSize is implemented with will send window size events directly to the event callback that every window has and that GLFW implements for its windows. If you have set a window size callback GLFW will call it in turn with the new size before everything returns back out of the glfwSetWindowSize call.

Keyboard input

GLFW divides keyboard input into two categories; key events and character events. Key events relate to actual physical keyboard keys, whereas character events relate to the Unicode code points generated by pressing some of them.

Keys and characters do not map 1:1. A single key press may produce several characters, and a single character may require several keys to produce. This may not be the case on your machine, but your users are likely not all using the same keyboard layout, input method or even operating system as you.

Key input

If you wish to be notified when a physical key is pressed or released or when it repeats, set a key callback.

glfwSetKeyCallback(window, key_callback);

The callback function receives the keyboard key, platform-specific scancode, key action and modifier bits.

void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_E && action == GLFW_PRESS)
activate_airship();
}

The action is one of GLFW_PRESS, GLFW_REPEAT or GLFW_RELEASE. The key will be GLFW_KEY_UNKNOWN if GLFW lacks a key token for it, for example E-mail and Play keys.

The scancode is unique for every key, regardless of whether it has a key token. Scancodes are platform-specific but consistent over time, so keys will have different scancodes depending on the platform but they are safe to save to disk. You can query the scancode for any named key on the current platform with glfwGetKeyScancode.

const int scancode = glfwGetKeyScancode(GLFW_KEY_X);
set_key_mapping(scancode, swap_weapons);

The last reported state for every named key is also saved in per-window state arrays that can be polled with glfwGetKey.

int state = glfwGetKey(window, GLFW_KEY_E);
if (state == GLFW_PRESS)
{
activate_airship();
}

The returned state is one of GLFW_PRESS or GLFW_RELEASE.

This function only returns cached key event state. It does not poll the system for the current physical state of the key.

Whenever you poll state, you risk missing the state change you are looking for. If a pressed key is released again before you poll its state, you will have missed the key press. The recommended solution for this is to use a key callback, but there is also the GLFW_STICKY_KEYS input mode.

When sticky keys mode is enabled, the pollable state of a key will remain GLFW_PRESS until the state of that key is polled with glfwGetKey. Once it has been polled, if a key release event had been processed in the meantime, the state will reset to GLFW_RELEASE, otherwise it will remain GLFW_PRESS.

If you wish to know what the state of the Caps Lock and Num Lock keys was when input events were generated, set the GLFW_LOCK_KEY_MODS input mode.

When this input mode is enabled, any callback that receives modifier bits will have the GLFW_MOD_CAPS_LOCK bit set if Caps Lock was on when the event occurred and the GLFW_MOD_NUM_LOCK bit set if Num Lock was on.

The GLFW_KEY_LAST constant holds the highest value of any named key.

Text input

GLFW supports text input in the form of a stream of Unicode code points, as produced by the operating system text input system. Unlike key input, text input obeys keyboard layouts and modifier keys and supports composing characters using dead keys. Once received, you can encode the code points into UTF-8 or any other encoding you prefer.

Because an unsigned int is 32 bits long on all platforms supported by GLFW, you can treat the code point argument as native endian UTF-32.

If you wish to offer regular text input, set a character callback.

glfwSetCharCallback(window, character_callback);

The callback function receives Unicode code points for key events that would have led to regular text input and generally behaves as a standard text field on that platform.

void character_callback(GLFWwindow* window, unsigned int codepoint)
{
}

Key names

If you wish to refer to keys by name, you can query the keyboard layout dependent name of printable keys with glfwGetKeyName.

const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0);
show_tutorial_hint("Press %s to move forward", key_name);

This function can handle both keys and scancodes. If the specified key is GLFW_KEY_UNKNOWN then the scancode is used, otherwise it is ignored. This matches the behavior of the key callback, meaning the callback arguments can always be passed unmodified to this function.

Mouse input

Mouse input comes in many forms, including mouse motion, button presses and scrolling offsets. The cursor appearance can also be changed, either to a custom image or a standard cursor shape from the system theme.

Cursor position

If you wish to be notified when the cursor moves over the window, set a cursor position callback.

glfwSetCursorPosCallback(window, cursor_position_callback);

The callback functions receives the cursor position, measured in screen coordinates but relative to the top-left corner of the window content area. On platforms that provide it, the full sub-pixel cursor position is passed on.

static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
{
}

The cursor position is also saved per-window and can be polled with glfwGetCursorPos.

double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos);

Cursor mode

The GLFW_CURSOR input mode provides several cursor modes for special forms of mouse motion input. By default, the cursor mode is GLFW_CURSOR_NORMAL, meaning the regular arrow cursor (or another cursor set with glfwSetCursor) is used and cursor motion is not limited.

If you wish to implement mouse motion based camera controls or other input schemes that require unlimited mouse movement, set the cursor mode to GLFW_CURSOR_DISABLED.

This will hide the cursor and lock it to the specified window. GLFW will then take care of all the details of cursor re-centering and offset calculation and providing the application with a virtual cursor position. This virtual position is provided normally via both the cursor position callback and through polling.

Note
You should not implement your own version of this functionality using other features of GLFW. It is not supported and will not work as robustly as GLFW_CURSOR_DISABLED.

If you only wish the cursor to become hidden when it is over a window but still want it to behave normally, set the cursor mode to GLFW_CURSOR_HIDDEN.

This mode puts no limit on the motion of the cursor.

To exit out of either of these special modes, restore the GLFW_CURSOR_NORMAL cursor mode.

Raw mouse motion

When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can be enabled if available.

Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse motion is only provided when the cursor is disabled.

Call glfwRawMouseMotionSupported to check if the current machine provides raw motion and set the GLFW_RAW_MOUSE_MOTION input mode to enable it. It is disabled by default.

If supported, raw mouse motion can be enabled or disabled per-window and at any time but it will only be provided when the cursor is disabled.

Cursor objects

GLFW supports creating both custom and system theme cursor images, encapsulated as GLFWcursor objects. They are created with glfwCreateCursor or glfwCreateStandardCursor and destroyed with glfwDestroyCursor, or glfwTerminate, if any remain.

Custom cursor creation

A custom cursor is created with glfwCreateCursor, which returns a handle to the created cursor object. For example, this creates a 16x16 white square cursor with the hot-spot in the upper-left corner:

unsigned char pixels[16 * 16 * 4];
memset(pixels, 0xff, sizeof(pixels));
GLFWimage image;
image.width = 16;
image.height = 16;
image.pixels = pixels;
GLFWcursor* cursor = glfwCreateCursor(&image, 0, 0);

If cursor creation fails, NULL will be returned, so it is necessary to check the return value.

The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. The pixels are arranged canonically as sequential rows, starting from the top-left corner.

Standard cursor creation

A cursor with a standard shape from the current system cursor theme can be can be created with glfwCreateStandardCursor.

These cursor objects behave in the exact same way as those created with glfwCreateCursor except that the system cursor theme provides the actual image.

Cursor destruction

When a cursor is no longer needed, destroy it with glfwDestroyCursor.

Cursor destruction always succeeds. If the cursor is current for any window, that window will revert to the default cursor. This does not affect the cursor mode. All remaining cursors are destroyed when glfwTerminate is called.

Cursor setting

A cursor can be set as current for a window with glfwSetCursor.

glfwSetCursor(window, cursor);

Once set, the cursor image will be used as long as the system cursor is over the content area of the window and the cursor mode is set to GLFW_CURSOR_NORMAL.

A single cursor may be set for any number of windows.

To revert to the default cursor, set the cursor of that window to NULL.

glfwSetCursor(window, NULL);

When a cursor is destroyed, any window that has it set will revert to the default cursor. This does not affect the cursor mode.

Cursor enter/leave events

If you wish to be notified when the cursor enters or leaves the content area of a window, set a cursor enter/leave callback.

glfwSetCursorEnterCallback(window, cursor_enter_callback);

The callback function receives the new classification of the cursor.

void cursor_enter_callback(GLFWwindow* window, int entered)
{
if (entered)
{
// The cursor entered the content area of the window
}
else
{
// The cursor left the content area of the window
}
}

You can query whether the cursor is currently inside the content area of the window with the GLFW_HOVERED window attribute.

{
highlight_interface();
}

Mouse button input

If you wish to be notified when a mouse button is pressed or released, set a mouse button callback.

glfwSetMouseButtonCallback(window, mouse_button_callback);

The callback function receives the mouse button, button action and modifier bits.

void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{
if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS)
popup_menu();
}

The action is one of GLFW_PRESS or GLFW_RELEASE.

Mouse button states for named buttons are also saved in per-window state arrays that can be polled with glfwGetMouseButton.

if (state == GLFW_PRESS)
{
upgrade_cow();
}

The returned state is one of GLFW_PRESS or GLFW_RELEASE.

This function only returns cached mouse button event state. It does not poll the system for the current state of the mouse button.

Whenever you poll state, you risk missing the state change you are looking for. If a pressed mouse button is released again before you poll its state, you will have missed the button press. The recommended solution for this is to use a mouse button callback, but there is also the GLFW_STICKY_MOUSE_BUTTONS input mode.

When sticky mouse buttons mode is enabled, the pollable state of a mouse button will remain GLFW_PRESS until the state of that button is polled with glfwGetMouseButton. Once it has been polled, if a mouse button release event had been processed in the meantime, the state will reset to GLFW_RELEASE, otherwise it will remain GLFW_PRESS.

The GLFW_MOUSE_BUTTON_LAST constant holds the highest value of any named button.

Scroll input

If you wish to be notified when the user scrolls, whether with a mouse wheel or touchpad gesture, set a scroll callback.

glfwSetScrollCallback(window, scroll_callback);

The callback function receives two-dimensional scroll offsets.

void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
{
}

A normal mouse wheel, being vertical, provides offsets along the Y-axis.

Joystick input

The joystick functions expose connected joysticks and controllers, with both referred to as joysticks. It supports up to sixteen joysticks, ranging from GLFW_JOYSTICK_1, GLFW_JOYSTICK_2 up to and including GLFW_JOYSTICK_16 or GLFW_JOYSTICK_LAST. You can test whether a joystick is present with glfwJoystickPresent.

Each joystick has zero or more axes, zero or more buttons, zero or more hats, a human-readable name, a user pointer and an SDL compatible GUID.

When GLFW is initialized, detected joysticks are added to the beginning of the array. Once a joystick is detected, it keeps its assigned ID until it is disconnected or the library is terminated, so as joysticks are connected and disconnected, there may appear gaps in the IDs.

Joystick axis, button and hat state is updated when polled and does not require a window to be created or events to be processed. However, if you want joystick connection and disconnection events reliably delivered to the joystick callback then you must process events.

To see all the properties of all connected joysticks in real-time, run the joysticks test program.

Joystick axis states

The positions of all axes of a joystick are returned by glfwGetJoystickAxes. See the reference documentation for the lifetime of the returned array.

int count;
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_5, &count);

Each element in the returned array is a value between -1.0 and 1.0.

Joystick button states

The states of all buttons of a joystick are returned by glfwGetJoystickButtons. See the reference documentation for the lifetime of the returned array.

int count;
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_3, &count);

Each element in the returned array is either GLFW_PRESS or GLFW_RELEASE.

For backward compatibility with earlier versions that did not have glfwGetJoystickHats, the button array by default also includes all hats. See the reference documentation for glfwGetJoystickButtons for details.

Joystick hat states

The states of all hats are returned by glfwGetJoystickHats. See the reference documentation for the lifetime of the returned array.

int count;
const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count);

Each element in the returned array is one of the following:

Name Value
GLFW_HAT_CENTERED 0
GLFW_HAT_UP 1
GLFW_HAT_RIGHT 2
GLFW_HAT_DOWN 4
GLFW_HAT_LEFT 8
GLFW_HAT_RIGHT_UP GLFW_HAT_RIGHT | GLFW_HAT_UP
GLFW_HAT_RIGHT_DOWN GLFW_HAT_RIGHT | GLFW_HAT_DOWN
GLFW_HAT_LEFT_UP GLFW_HAT_LEFT | GLFW_HAT_UP
GLFW_HAT_LEFT_DOWN GLFW_HAT_LEFT | GLFW_HAT_DOWN

The diagonal directions are bitwise combinations of the primary (up, right, down and left) directions and you can test for these individually by ANDing it with the corresponding direction.

if (hats[2] & GLFW_HAT_RIGHT)
{
// State of hat 2 could be right-up, right or right-down
}

For backward compatibility with earlier versions that did not have glfwGetJoystickHats, all hats are by default also included in the button array. See the reference documentation for glfwGetJoystickButtons for details.

Joystick name

The human-readable, UTF-8 encoded name of a joystick is returned by glfwGetJoystickName. See the reference documentation for the lifetime of the returned string.

Joystick names are not guaranteed to be unique. Two joysticks of the same model and make may have the same name. Only the joystick token is guaranteed to be unique, and only until that joystick is disconnected.

Joystick user pointer

Each joystick has a user pointer that can be set with glfwSetJoystickUserPointer and queried with glfwGetJoystickUserPointer. This can be used for any purpose you need and will not be modified by GLFW. The value will be kept until the joystick is disconnected or until the library is terminated.

The initial value of the pointer is NULL.

Joystick configuration changes

If you wish to be notified when a joystick is connected or disconnected, set a joystick callback.

glfwSetJoystickCallback(joystick_callback);

The callback function receives the ID of the joystick that has been connected and disconnected and the event that occurred.

void joystick_callback(int jid, int event)
{
if (event == GLFW_CONNECTED)
{
// The joystick was connected
}
else if (event == GLFW_DISCONNECTED)
{
// The joystick was disconnected
}
}

For joystick connection and disconnection events to be delivered on all platforms, you need to call one of the event processing functions. Joystick disconnection may also be detected and the callback called by joystick functions. The function will then return whatever it returns for a disconnected joystick.

Only glfwGetJoystickName and glfwGetJoystickUserPointer will return useful values for a disconnected joystick and only before the monitor callback returns.

Gamepad input

The joystick functions provide unlabeled axes, buttons and hats, with no indication of where they are located on the device. Their order may also vary between platforms even with the same device.

To solve this problem the SDL community crowdsourced the SDL_GameControllerDB project, a database of mappings from many different devices to an Xbox-like gamepad.

GLFW supports this mapping format and contains a copy of the mappings available at the time of release. See Gamepad mappings for how to update this at runtime. Mappings will be assigned to joysticks automatically any time a joystick is connected or the mappings are updated.

You can check whether a joystick is both present and has a gamepad mapping with glfwJoystickIsGamepad.

{
// Use as gamepad
}

If you are only interested in gamepad input you can use this function instead of glfwJoystickPresent.

You can query the human-readable name provided by the gamepad mapping with glfwGetGamepadName. This may or may not be the same as the joystick name.

const char* name = glfwGetGamepadName(GLFW_JOYSTICK_7);

To retrieve the gamepad state of a joystick, call glfwGetGamepadState.

{
{
input_jump();
}
}

The GLFWgamepadstate struct has two arrays; one for button states and one for axis states. The values for each button and axis are the same as for the glfwGetJoystickButtons and glfwGetJoystickAxes functions, i.e. GLFW_PRESS or GLFW_RELEASE for buttons and -1.0 to 1.0 inclusive for axes.

The sizes of the arrays and the positions within each array are fixed.

The button indices are GLFW_GAMEPAD_BUTTON_A, GLFW_GAMEPAD_BUTTON_B, GLFW_GAMEPAD_BUTTON_X, GLFW_GAMEPAD_BUTTON_Y, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER, GLFW_GAMEPAD_BUTTON_BACK, GLFW_GAMEPAD_BUTTON_START, GLFW_GAMEPAD_BUTTON_GUIDE, GLFW_GAMEPAD_BUTTON_LEFT_THUMB, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB, GLFW_GAMEPAD_BUTTON_DPAD_UP, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT, GLFW_GAMEPAD_BUTTON_DPAD_DOWN and GLFW_GAMEPAD_BUTTON_DPAD_LEFT.

For those who prefer, there are also the GLFW_GAMEPAD_BUTTON_CROSS, GLFW_GAMEPAD_BUTTON_CIRCLE, GLFW_GAMEPAD_BUTTON_SQUARE and GLFW_GAMEPAD_BUTTON_TRIANGLE aliases for the A, B, X and Y button indices.

The axis indices are GLFW_GAMEPAD_AXIS_LEFT_X, GLFW_GAMEPAD_AXIS_LEFT_Y, GLFW_GAMEPAD_AXIS_RIGHT_X, GLFW_GAMEPAD_AXIS_RIGHT_Y, GLFW_GAMEPAD_AXIS_LEFT_TRIGGER and GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER.

The GLFW_GAMEPAD_BUTTON_LAST and GLFW_GAMEPAD_AXIS_LAST constants equal the largest available index for each array.

Gamepad mappings

GLFW contains a copy of the mappings available in SDL_GameControllerDB at the time of release. Newer ones can be added at runtime with glfwUpdateGamepadMappings.

const char* mappings = load_file_contents("game/data/gamecontrollerdb.txt");

This function supports everything from single lines up to and including the unmodified contents of the whole gamecontrollerdb.txt file.

Below is a description of the mapping format. Please keep in mind that this description is not authoritative. The format is defined by the SDL and SDL_GameControllerDB projects and their documentation and code takes precedence.

Each mapping is a single line of comma-separated values describing the GUID, name and layout of the gamepad. Lines that do not begin with a hexadecimal digit are ignored.

The first value is always the gamepad GUID, a 32 character long hexadecimal string that typically identifies its make, model, revision and the type of connection to the computer. When this information is not available, the GUID is generated using the gamepad name. GLFW uses the SDL 2.0.5+ GUID format but can convert from the older formats.

The second value is always the human-readable name of the gamepad.

All subsequent values are in the form <field>:<value> and describe the layout of the mapping. These fields may not all be present and may occur in any order.

The button fields are a, b, c, d, back, start, guide, dpup, dpright, dpdown, dpleft, leftshoulder, rightshoulder, leftstick and rightstick.

The axis fields are leftx, lefty, rightx, righty, lefttrigger and righttrigger.

The value of an axis or button field can be a joystick button, a joystick axis, a hat bitmask or empty. Joystick buttons are specified as bN, for example b2 for the third button. Joystick axes are specified as aN, for example a7 for the eighth button. Joystick hat bit masks are specified as hN.N, for example h0.8 for left on the first hat. More than one bit may be set in the mask.

Before an axis there may be a + or - range modifier, for example +a3 for the positive half of the fourth axis. This restricts input to only the positive or negative halves of the joystick axis. After an axis or half-axis there may be the ~ inversion modifier, for example a2~ or -a7~. This negates the values of the gamepad axis.

The hat bit mask match the hat states in the joystick functions.

There is also the special platform field that specifies which platform the mapping is valid for. Possible values are Windows, Mac OS X and Linux.

Below is an example of what a gamepad mapping might look like. It is the one built into GLFW for Xbox controllers accessed via the XInput API on Windows. This example has been broken into several lines to fit on the page, but real gamepad mappings must be a single line.

78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,
b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,
rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,
righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
Note
GLFW does not yet support the output range and modifiers + and - that were recently added to SDL. The input modifiers +, - and ~ are supported and described above.

Time input

GLFW provides high-resolution time input, in seconds, with glfwGetTime.

double seconds = glfwGetTime();

It returns the number of seconds since the library was initialized with glfwInit. The platform-specific time sources used typically have micro- or nanosecond resolution.

You can modify the base time with glfwSetTime.

This sets the time to the specified time, in seconds, and it continues to count from there.

You can also access the raw timer used to implement the functions above, with glfwGetTimerValue.

uint64_t value = glfwGetTimerValue();

This value is in 1 / frequency seconds. The frequency of the raw timer varies depending on the operating system and hardware. You can query the frequency, in Hz, with glfwGetTimerFrequency.

uint64_t frequency = glfwGetTimerFrequency();

Clipboard input and output

If the system clipboard contains a UTF-8 encoded string or if it can be converted to one, you can retrieve it with glfwGetClipboardString. See the reference documentation for the lifetime of the returned string.

const char* text = glfwGetClipboardString(NULL);
if (text)
{
insert_text(text);
}

If the clipboard is empty or if its contents could not be converted, NULL is returned.

The contents of the system clipboard can be set to a UTF-8 encoded string with glfwSetClipboardString.

glfwSetClipboardString(NULL, "A string with words in it");

Path drop input

If you wish to receive the paths of files and/or directories dropped on a window, set a file drop callback.

glfwSetDropCallback(window, drop_callback);

The callback function receives an array of paths encoded as UTF-8.

void drop_callback(GLFWwindow* window, int count, const char** paths)
{
int i;
for (i = 0; i < count; i++)
handle_dropped_file(paths[i]);
}

The path array and its strings are only valid until the file drop callback returns, as they may have been generated specifically for that event. You need to make a deep copy of the array if you want to keep the paths.

#define GLFW_JOYSTICK_7
Definition: glfw3.h:566
int glfwGetGamepadState(int jid, GLFWgamepadstate *state)
Retrieves the state of the specified joystick remapped as a gamepad.
#define GLFW_CURSOR_DISABLED
Definition: glfw3.h:1024
#define GLFW_CURSOR_NORMAL
Definition: glfw3.h:1022
#define GLFW_CURSOR
Definition: glfw3.h:1016
#define GLFW_CURSOR_HIDDEN
Definition: glfw3.h:1023
#define GLFW_STICKY_KEYS
Definition: glfw3.h:1017
#define GLFW_JOYSTICK_5
Definition: glfw3.h:564
double glfwGetTime(void)
Returns the GLFW time.
int glfwUpdateGamepadMappings(const char *string)
Adds the specified SDL_GameControllerDB gamepad mappings.
const char * glfwGetJoystickName(int jid)
Returns the name of the specified joystick.
int glfwGetMouseButton(GLFWwindow *window, int button)
Returns the last reported state of a mouse button for the specified window.
int glfwGetKeyScancode(int key)
Returns the platform-specific scancode of the specified key.
GLFWcursor * glfwCreateCursor(const GLFWimage *image, int xhot, int yhot)
Creates a custom cursor.
#define GLFW_PRESS
The key or mouse button was pressed.
Definition: glfw3.h:306
const char * glfwGetKeyName(int key, int scancode)
Returns the layout-specific name of the specified printable key.
int height
Definition: glfw3.h:1694
void glfwSetInputMode(GLFWwindow *window, int mode, int value)
Sets an input option for the specified window.
#define GLFW_HOVERED
Mouse cursor hover window attribute.
Definition: glfw3.h:823
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1152
#define GLFW_KEY_W
Definition: glfw3.h:402
#define GLFW_KEY_E
Definition: glfw3.h:384
GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow *window, GLFWmousebuttonfun callback)
Sets the mouse button callback.
const unsigned char * glfwGetJoystickHats(int jid, int *count)
Returns the state of all hats of the specified joystick.
const char * glfwGetGamepadName(int jid)
Returns the human-readable gamepad name for the specified joystick.
#define GLFW_JOYSTICK_1
Definition: glfw3.h:560
void glfwSetTime(double time)
Sets the GLFW time.
void glfwGetCursorPos(GLFWwindow *window, double *xpos, double *ypos)
Retrieves the position of the cursor relative to the content area of the window.
int glfwJoystickIsGamepad(int jid)
Returns whether the specified joystick has a gamepad mapping.
void glfwPollEvents(void)
Processes all pending events.
void glfwWaitEvents(void)
Waits until events are queued and processes them.
void glfwDestroyCursor(GLFWcursor *cursor)
Destroys a cursor.
const unsigned char * glfwGetJoystickButtons(int jid, int *count)
Returns the state of all buttons of the specified joystick.
#define GLFW_STICKY_MOUSE_BUTTONS
Definition: glfw3.h:1018
GLFWcharfun glfwSetCharCallback(GLFWwindow *window, GLFWcharfun callback)
Sets the Unicode character callback.
const char * glfwGetClipboardString(GLFWwindow *window)
Returns the contents of the clipboard as a string.
GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow *window, GLFWcursorenterfun callback)
Sets the cursor enter/leave callback.
void glfwSetCursor(GLFWwindow *window, GLFWcursor *cursor)
Sets the cursor for the window.
int glfwRawMouseMotionSupported(void)
Returns whether raw mouse motion is supported.
unsigned char * pixels
Definition: glfw3.h:1697
#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
Definition: glfw3.h:621
#define GLFW_JOYSTICK_4
Definition: glfw3.h:563
#define GLFW_TRUE
One.
Definition: glfw3.h:280
int glfwJoystickPresent(int jid)
Returns whether the specified joystick is present.
unsigned char buttons[15]
Definition: glfw3.h:1716
#define GLFW_DISCONNECTED
Definition: glfw3.h:1075
#define GLFW_GAMEPAD_BUTTON_A
Definition: glfw3.h:586
uint64_t glfwGetTimerValue(void)
Returns the current value of the raw timer.
GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow *window, GLFWcursorposfun callback)
Sets the cursor position callback.
uint64_t glfwGetTimerFrequency(void)
Returns the frequency, in Hz, of the raw timer.
#define GLFW_MOUSE_BUTTON_LEFT
Definition: glfw3.h:548
int width
Definition: glfw3.h:1691
void glfwWaitEventsTimeout(double timeout)
Waits with timeout until events are queued and processes them.
GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback)
Sets the joystick configuration callback.
Gamepad input state.
Definition: glfw3.h:1711
#define GLFW_JOYSTICK_3
Definition: glfw3.h:562
struct GLFWcursor GLFWcursor
Opaque cursor object.
Definition: glfw3.h:1164
#define GLFW_RAW_MOUSE_MOTION
Definition: glfw3.h:1020
GLFWcursor * glfwCreateStandardCursor(int shape)
Creates a cursor with a standard shape.
float axes[6]
Definition: glfw3.h:1720
Image data.
Definition: glfw3.h:1687
#define GLFW_HRESIZE_CURSOR
The horizontal resize arrow shape.
Definition: glfw3.h:1066
#define GLFW_CONNECTED
Definition: glfw3.h:1074
GLFWdropfun glfwSetDropCallback(GLFWwindow *window, GLFWdropfun callback)
Sets the path drop callback.
GLFWkeyfun glfwSetKeyCallback(GLFWwindow *window, GLFWkeyfun callback)
Sets the key callback.
#define GLFW_HAT_RIGHT
Definition: glfw3.h:325
#define GLFW_JOYSTICK_2
Definition: glfw3.h:561
#define GLFW_MOUSE_BUTTON_RIGHT
Definition: glfw3.h:549
void glfwPostEmptyEvent(void)
Posts an empty event to the event queue.
int glfwGetWindowAttrib(GLFWwindow *window, int attrib)
Returns an attribute of the specified window.
GLFWscrollfun glfwSetScrollCallback(GLFWwindow *window, GLFWscrollfun callback)
Sets the scroll callback.
int glfwGetKey(GLFWwindow *window, int key)
Returns the last reported state of a keyboard key for the specified window.
const float * glfwGetJoystickAxes(int jid, int *count)
Returns the values of all axes of the specified joystick.
void glfwSetClipboardString(GLFWwindow *window, const char *string)
Sets the clipboard to the specified string.
#define GLFW_KEY_X
Definition: glfw3.h:403
#define GLFW_LOCK_KEY_MODS
Definition: glfw3.h:1019
================================================ FILE: thirdparty/glfw/docs/html/internal_8dox.html ================================================ GLFW: internal.dox File Reference
internal.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/internals_guide.html ================================================ GLFW: Internal structure
Internal structure

There are several interfaces inside GLFW. Each interface has its own area of responsibility and its own naming conventions.

Public interface

The most well-known is the public interface, described in the glfw3.h header file. This is implemented in source files shared by all platforms and these files contain no platform-specific code. This code usually ends up calling the platform and internal interfaces to do the actual work.

The public interface uses the OpenGL naming conventions except with GLFW and glfw instead of GL and gl. For struct members, where OpenGL sets no precedent, it use headless camel case.

Examples: glfwCreateWindow, GLFWwindow, GLFW_RED_BITS

Native interface

The native interface is a small set of publicly available but platform-specific functions, described in the glfw3native.h header file and used to gain access to the underlying window, context and (on some platforms) display handles used by the platform interface.

The function names of the native interface are similar to those of the public interface, but embeds the name of the interface that the returned handle is from.

Examples: glfwGetX11Window, glfwGetWGLContext

Internal interface

The internal interface consists of utility functions used by all other interfaces. It is shared code implemented in the same shared source files as the public and event interfaces. The internal interface is described in the internal.h header file.

The internal interface is in charge of GLFW's global data, which it stores in a _GLFWlibrary struct named _glfw.

The internal interface uses the same style as the public interface, except all global names have a leading underscore.

Examples: _glfwIsValidContextConfig, _GLFWwindow, _glfw.monitorCount

Platform interface

The platform interface implements all platform-specific operations as a service to the public interface. This includes event processing. The platform interface is never directly called by application code and never directly calls application-provided callbacks. It is also prohibited from modifying the platform-independent part of the internal structs. Instead, it calls the event interface when events interesting to GLFW are received.

The platform interface mirrors those parts of the public interface that needs to perform platform-specific operations on some or all platforms. The are also named the same except that the glfw function prefix is replaced by _glfwPlatform.

Examples: _glfwPlatformCreateWindow

The platform interface also defines structs that contain platform-specific global and per-object state. Their names mirror those of the internal interface, except that an interface-specific suffix is added.

Examples: _GLFWwindowX11, _GLFWcontextWGL

These structs are incorporated as members into the internal interface structs using special macros that name them after the specific interface used. This prevents shared code from accidentally using these members.

Examples: window->win32.handle, _glfw.x11.display

Event interface

The event interface is implemented in the same shared source files as the public interface and is responsible for delivering the events it receives to the application, either via callbacks, via window state changes or both.

The function names of the event interface use a _glfwInput prefix and the ObjectEvent pattern.

Examples: _glfwInputWindowFocus, _glfwInputCursorPos

Static functions

Static functions may be used by any interface and have no prefixes or suffixes. These use headless camel case.

Examples: isValidElementForJoystick

Configuration macros

GLFW uses a number of configuration macros to select at compile time which interfaces and code paths to use. They are defined in the glfw_config.h header file, which is generated from the glfw_config.h.in file by CMake.

Configuration macros the same style as tokens in the public interface, except with a leading underscore.

Examples: _GLFW_WIN32, _GLFW_BUILD_DLL

================================================ FILE: thirdparty/glfw/docs/html/intro_8dox.html ================================================ GLFW: intro.dox File Reference
intro.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/intro_guide.html ================================================ GLFW: Introduction to the API
Introduction to the API

This guide introduces the basic concepts of GLFW and describes initialization, error handling and API guarantees and limitations. For a broad but shallow tutorial, see Getting started instead. For details on a specific function in this category, see the Initialization, version and error reference.

There are also guides for the other areas of GLFW.

Initialization and termination

Before most GLFW functions may be called, the library must be initialized. This initialization checks what features are available on the machine, enumerates monitors and joysticks, initializes the timer and performs any required platform-specific initialization.

Only the following functions may be called before the library has been successfully initialized, and only from the main thread.

Calling any other function before successful initialization will cause a GLFW_NOT_INITIALIZED error.

Initializing GLFW

The library is initialized with glfwInit, which returns GLFW_FALSE if an error occurred.

if (!glfwInit())
{
// Handle initialization failure
}

If any part of initialization fails, any parts that succeeded are terminated as if glfwTerminate had been called. The library only needs to be initialized once and additional calls to an already initialized library will return GLFW_TRUE immediately.

Once the library has been successfully initialized, it should be terminated before the application exits. Modern systems are very good at freeing resources allocated by programs that exit, but GLFW sometimes has to change global system settings and these might not be restored without termination.

Initialization hints

Initialization hints are set before glfwInit and affect how the library behaves until termination. Hints are set with glfwInitHint.

The values you set hints to are never reset by GLFW, but they only take effect during initialization. Once GLFW has been initialized, any values you set will be ignored until the library is terminated and initialized again.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Shared init hints

GLFW_JOYSTICK_HAT_BUTTONS specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not have glfwGetJoystickHats. Set this with glfwInitHint.

macOS specific init hints

GLFW_COCOA_CHDIR_RESOURCES specifies whether to set the current directory to the application to the Contents/Resources subdirectory of the application's bundle, if present. Set this with glfwInitHint.

GLFW_COCOA_MENUBAR specifies whether to create a basic menu bar, either from a nib or manually, when the first window is created, which is when AppKit is initialized. Set this with glfwInitHint.

Supported and default values

Initialization hint Default value Supported values
GLFW_JOYSTICK_HAT_BUTTONS GLFW_TRUE GLFW_TRUE or GLFW_FALSE
GLFW_COCOA_CHDIR_RESOURCES GLFW_TRUE GLFW_TRUE or GLFW_FALSE
GLFW_COCOA_MENUBAR GLFW_TRUE GLFW_TRUE or GLFW_FALSE

Terminating GLFW

Before your application exits, you should terminate the GLFW library if it has been initialized. This is done with glfwTerminate.

This will destroy any remaining window, monitor and cursor objects, restore any modified gamma ramps, re-enable the screensaver if it had been disabled and free any other resources allocated by GLFW.

Once the library is terminated, it is as if it had never been initialized and you will need to initialize it again before being able to use GLFW. If the library was not initialized or had already been terminated, it return immediately.

Error handling

Some GLFW functions have return values that indicate an error, but this is often not very helpful when trying to figure out what happened or why it occurred. Other functions have no return value reserved for errors, so error notification needs a separate channel. Finally, far from all GLFW functions have return values.

The last error code for the calling thread can be queried at any time with glfwGetError.

int code = glfwGetError(NULL);
if (code != GLFW_NO_ERROR)
handle_error(code);

If no error has occurred since the last call, GLFW_NO_ERROR (zero) is returned. The error is cleared before the function returns.

The error code indicates the general category of the error. Some error codes, such as GLFW_NOT_INITIALIZED has only a single meaning, whereas others like GLFW_PLATFORM_ERROR are used for many different errors.

GLFW often has more information about an error than its general category. You can retrieve a UTF-8 encoded human-readable description along with the error code. If no error has occurred since the last call, the description is set to NULL.

const char* description;
int code = glfwGetError(&description);
if (description)
display_error_message(code, description);

The retrieved description string is only valid until the next error occurs. This means you must make a copy of it if you want to keep it.

You can also set an error callback, which will be called each time an error occurs. It is set with glfwSetErrorCallback.

glfwSetErrorCallback(error_callback);

The error callback receives the same error code and human-readable description returned by glfwGetError.

void error_callback(int code, const char* description)
{
display_error_message(code, description);
}

The error callback is called after the error is stored, so calling glfwGetError from within the error callback returns the same values as the callback argument.

The description string passed to the callback is only valid until the error callback returns. This means you must make a copy of it if you want to keep it.

Reported errors are never fatal. As long as GLFW was successfully initialized, it will remain initialized and in a safe state until terminated regardless of how many errors occur. If an error occurs during initialization that causes glfwInit to fail, any part of the library that was initialized will be safely terminated.

Do not rely on a currently invalid call to generate a specific error, as in the future that same call may generate a different error or become valid.

Coordinate systems

GLFW has two primary coordinate systems: the virtual screen and the window content area or content area. Both use the same unit: virtual screen coordinates, or just screen coordinates, which don't necessarily correspond to pixels.

Both the virtual screen and the content area coordinate systems have the X-axis pointing to the right and the Y-axis pointing down.

Window and monitor positions are specified as the position of the upper-left corners of their content areas relative to the virtual screen, while cursor positions are specified relative to a window's content area.

Because the origin of the window's content area coordinate system is also the point from which the window position is specified, you can translate content area coordinates to the virtual screen by adding the window position. The window frame, when present, extends out from the content area but does not affect the window position.

Almost all positions and sizes in GLFW are measured in screen coordinates relative to one of the two origins above. This includes cursor positions, window positions and sizes, window frame sizes, monitor positions and video mode resolutions.

Two exceptions are the monitor physical size, which is measured in millimetres, and framebuffer size, which is measured in pixels.

Pixels and screen coordinates may map 1:1 on your machine, but they won't on every other machine, for example on a Mac with a Retina display. The ratio between screen coordinates and pixels may also change at run-time depending on which monitor the window is currently considered to be on.

Guarantees and limitations

This section describes the conditions under which GLFW can be expected to function, barring bugs in the operating system or drivers. Use of GLFW outside of these limits may work on some platforms, or on some machines, or some of the time, or on some versions of GLFW, but it may break at any time and this will not be considered a bug.

Pointer lifetimes

GLFW will never free any pointer you provide to it and you must never free any pointer it provides to you.

Many GLFW functions return pointers to dynamically allocated structures, strings or arrays, and some callbacks are provided with strings or arrays. These are always managed by GLFW and should never be freed by the application. The lifetime of these pointers is documented for each GLFW function and callback. If you need to keep this data, you must copy it before its lifetime expires.

Many GLFW functions accept pointers to structures or strings allocated by the application. These are never freed by GLFW and are always the responsibility of the application. If GLFW needs to keep the data in these structures or strings, it is copied before the function returns.

Pointer lifetimes are guaranteed not to be shortened in future minor or patch releases.

Reentrancy

GLFW event processing and object destruction are not reentrant. This means that the following functions must not be called from any callback function:

These functions may be made reentrant in future minor or patch releases, but functions not on this list will not be made non-reentrant.

Thread safety

Most GLFW functions must only be called from the main thread (the thread that calls main), but some may be called from any thread once the library has been initialized. Before initialization the whole library is thread-unsafe.

The reference documentation for every GLFW function states whether it is limited to the main thread.

Initialization, termination, event processing and the creation and destruction of windows, cursors and OpenGL and OpenGL ES contexts are all restricted to the main thread due to limitations of one or several platforms.

Because event processing must be performed on the main thread, all callbacks except for the error callback will only be called on that thread. The error callback may be called on any thread, as any GLFW function may generate errors.

The error code and description may be queried from any thread.

Empty events may be posted from any thread.

The window user pointer and close flag may be read and written from any thread, but this is not synchronized by GLFW.

These functions for working with OpenGL and OpenGL ES contexts may be called from any thread, but the window object is not synchronized by GLFW.

The raw timer functions may be called from any thread.

The regular timer may be used from any thread, but reading and writing the timer offset is not synchronized by GLFW.

Library version information may be queried from any thread.

All Vulkan related functions may be called from any thread.

GLFW uses synchronization objects internally only to manage the per-thread context and error states. Additional synchronization is left to the application.

Functions that may currently be called from any thread will always remain so, but functions that are currently limited to the main thread may be updated to allow calls from any thread in future releases.

Version compatibility

GLFW uses Semantic Versioning. This guarantees source and binary backward compatibility with earlier minor versions of the API. This means that you can drop in a newer version of the library and existing programs will continue to compile and existing binaries will continue to run.

Once a function or constant has been added, the signature of that function or value of that constant will remain unchanged until the next major version of GLFW. No compatibility of any kind is guaranteed between major versions.

Undocumented behavior, i.e. behavior that is not described in the documentation, may change at any time until it is documented.

If the reference documentation and the implementation differ, the reference documentation will almost always take precedence and the implementation will be fixed in the next release. The reference documentation will also take precedence over anything stated in a guide.

Event order

The order of arrival of related events is not guaranteed to be consistent across platforms. The exception is synthetic key and mouse button release events, which are always delivered after the window defocus event.

Version management

GLFW provides mechanisms for identifying what version of GLFW your application was compiled against as well as what version it is currently running against. If you are loading GLFW dynamically (not just linking dynamically), you can use this to verify that the library binary is compatible with your application.

Compile-time version

The compile-time version of GLFW is provided by the GLFW header with the GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR and GLFW_VERSION_REVISION macros.

printf("Compiled against GLFW %i.%i.%i\n",

Run-time version

The run-time version can be retrieved with glfwGetVersion, a function that may be called regardless of whether GLFW is initialized.

int major, minor, revision;
glfwGetVersion(&major, &minor, &revision);
printf("Running against GLFW %i.%i.%i\n", major, minor, revision);

Version string

GLFW 3 also provides a compile-time generated version string that describes the version, platform, compiler and any platform-specific compile-time options. This is primarily intended for submitting bug reports, to allow developers to see which code paths are enabled in a binary.

The version string is returned by glfwGetVersionString, a function that may be called regardless of whether GLFW is initialized.

Do not use the version string to parse the GLFW library version. The glfwGetVersion function already provides the version of the running library binary.

The format of the string is as follows:

  • The version of GLFW
  • The name of the window system API
  • The name of the context creation API
  • Any additional options or APIs

For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL back ends, the version string may look something like this:

3.0.0 Win32 WGL MinGW
int glfwGetError(const char **description)
Returns and clears the last error for the calling thread.
void glfwTerminate(void)
Terminates the GLFW library.
void glfwInitHint(int hint, int value)
Sets the specified init hint to the desired value.
#define GLFW_FALSE
Zero.
Definition: glfw3.h:289
#define GLFW_VERSION_MINOR
The minor version number of the GLFW library.
Definition: glfw3.h:262
#define GLFW_VERSION_REVISION
The revision number of the GLFW library.
Definition: glfw3.h:269
#define GLFW_JOYSTICK_HAT_BUTTONS
Joystick hat buttons init hint.
Definition: glfw3.h:1083
int glfwInit(void)
Initializes the GLFW library.
#define GLFW_VERSION_MAJOR
The major version number of the GLFW library.
Definition: glfw3.h:255
GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback)
Sets the error callback.
void glfwGetVersion(int *major, int *minor, int *rev)
Retrieves the version of the GLFW library.
#define GLFW_NO_ERROR
No error has occurred.
Definition: glfw3.h:638
================================================ FILE: thirdparty/glfw/docs/html/jquery.js ================================================ /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element },_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler * Licensed under MIT * @author Ariel Flesler * @version 2.1.2 */ ;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 * http://www.smartmenus.org/ * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); ================================================ FILE: thirdparty/glfw/docs/html/main_8dox.html ================================================ GLFW: main.dox File Reference
main.dox File Reference
================================================ FILE: thirdparty/glfw/docs/html/menu.js ================================================ /* @licstart The following is the entire license notice for the JavaScript code in this file. Copyright (C) 1997-2017 by Dimitri van Heesch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @licend The above is the entire license notice for the JavaScript code in this file */ function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { function makeTree(data,relPath) { var result=''; if ('children' in data) { result+=''; } return result; } $('#main-nav').append(makeTree(menudata,relPath)); $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); if (searchEnabled) { if (serverSide) { $('#main-menu').append('
  • '); } else { $('#main-menu').append('
  • '); } } $('#main-menu').smartmenus(); } /* @license-end */ ================================================ FILE: thirdparty/glfw/docs/html/menudata.js ================================================ /* @licstart The following is the entire license notice for the JavaScript code in this file. Copyright (C) 1997-2019 by Dimitri van Heesch This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @licend The above is the entire license notice for the JavaScript code in this file */ var menudata={children:[ {text:"Introduction",url:"index.html"}, {text:"Tutorial",url:"quick_guide.html"}, {text:"Guides",url:"pages.html"}, {text:"Reference",url:"modules.html"}, {text:"Files",url:"files.html"}]} ================================================ FILE: thirdparty/glfw/docs/html/modules.html ================================================ GLFW: Reference
    Reference
    Here is a list of all modules:
    [detail level 12]
     Context referenceFunctions and types related to OpenGL and OpenGL ES contexts
     Initialization, version and error referenceFunctions and types related to initialization and error handling
     Error codesError codes
     Input referenceFunctions and types related to input handling
     Gamepad axesGamepad axes
     Gamepad buttonsGamepad buttons
     Joystick hat statesJoystick hat states
     JoysticksJoystick IDs
     Keyboard keysKeyboard key IDs
     Modifier key flagsModifier key flags
     Mouse buttonsMouse button IDs
     Standard cursor shapesStandard system cursor shapes
     Monitor referenceFunctions and types related to monitors
     Native accessFunctions related to accessing native handles
     Vulkan referenceFunctions and types related to Vulkan
     Window referenceFunctions and types related to windows
    ================================================ FILE: thirdparty/glfw/docs/html/monitor_8dox.html ================================================ GLFW: monitor.dox File Reference
    monitor.dox File Reference
    ================================================ FILE: thirdparty/glfw/docs/html/monitor_guide.html ================================================ GLFW: Monitor guide
    Monitor guide

    This guide introduces the monitor related functions of GLFW. For details on a specific function in this category, see the Monitor reference. There are also guides for the other areas of GLFW.

    Monitor objects

    A monitor object represents a currently connected monitor and is represented as a pointer to the opaque type GLFWmonitor. Monitor objects cannot be created or destroyed by the application and retain their addresses until the monitors they represent are disconnected or until the library is terminated.

    Each monitor has a current video mode, a list of supported video modes, a virtual position, a human-readable name, an estimated physical size and a gamma ramp. One of the monitors is the primary monitor.

    The virtual position of a monitor is in screen coordinates and, together with the current video mode, describes the viewports that the connected monitors provide into the virtual desktop that spans them.

    To see how GLFW views your monitor setup and its available video modes, run the monitors test program.

    Retrieving monitors

    The primary monitor is returned by glfwGetPrimaryMonitor. It is the user's preferred monitor and is usually the one with global UI elements like task bar or menu bar.

    You can retrieve all currently connected monitors with glfwGetMonitors. See the reference documentation for the lifetime of the returned array.

    int count;
    GLFWmonitor** monitors = glfwGetMonitors(&count);

    The primary monitor is always the first monitor in the returned array, but other monitors may be moved to a different index when a monitor is connected or disconnected.

    Monitor configuration changes

    If you wish to be notified when a monitor is connected or disconnected, set a monitor callback.

    glfwSetMonitorCallback(monitor_callback);

    The callback function receives the handle for the monitor that has been connected or disconnected and the event that occurred.

    void monitor_callback(GLFWmonitor* monitor, int event)
    {
    if (event == GLFW_CONNECTED)
    {
    // The monitor was connected
    }
    else if (event == GLFW_DISCONNECTED)
    {
    // The monitor was disconnected
    }
    }

    If a monitor is disconnected, all windows that are full screen on it will be switched to windowed mode before the callback is called. Only glfwGetMonitorName and glfwGetMonitorUserPointer will return useful values for a disconnected monitor and only before the monitor callback returns.

    Monitor properties

    Each monitor has a current video mode, a list of supported video modes, a virtual position, a content scale, a human-readable name, a user pointer, an estimated physical size and a gamma ramp.

    Video modes

    GLFW generally does a good job selecting a suitable video mode when you create a full screen window, change its video mode or make a windowed one full screen, but it is sometimes useful to know exactly which video modes are supported.

    Video modes are represented as GLFWvidmode structures. You can get an array of the video modes supported by a monitor with glfwGetVideoModes. See the reference documentation for the lifetime of the returned array.

    int count;
    GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);

    To get the current video mode of a monitor call glfwGetVideoMode. See the reference documentation for the lifetime of the returned pointer.

    const GLFWvidmode* mode = glfwGetVideoMode(monitor);

    The resolution of a video mode is specified in screen coordinates, not pixels.

    Physical size

    The physical size of a monitor in millimetres, or an estimation of it, can be retrieved with glfwGetMonitorPhysicalSize. This has no relation to its current resolution, i.e. the width and height of its current video mode.

    int width_mm, height_mm;
    glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm);

    While this can be used to calculate the raw DPI of a monitor, this is often not useful. Instead use the monitor content scale and window content scale to scale your content.

    Content scale

    The content scale for a monitor can be retrieved with glfwGetMonitorContentScale.

    float xscale, yscale;
    glfwGetMonitorContentScale(monitor, &xscale, &yscale);

    The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

    The content scale may depend on both the monitor resolution and pixel density and on user settings. It may be very different from the raw DPI calculated from the physical size and current resolution.

    Virtual position

    The position of the monitor on the virtual desktop, in screen coordinates, can be retrieved with glfwGetMonitorPos.

    int xpos, ypos;
    glfwGetMonitorPos(monitor, &xpos, &ypos);

    Work area

    The area of a monitor not occupied by global task bars or menu bars is the work area. This is specified in screen coordinates and can be retrieved with glfwGetMonitorWorkarea.

    int xpos, ypos, width, height;
    glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height);

    Human-readable name

    The human-readable, UTF-8 encoded name of a monitor is returned by glfwGetMonitorName. See the reference documentation for the lifetime of the returned string.

    const char* name = glfwGetMonitorName(monitor);

    Monitor names are not guaranteed to be unique. Two monitors of the same model and make may have the same name. Only the monitor handle is guaranteed to be unique, and only until that monitor is disconnected.

    User pointer

    Each monitor has a user pointer that can be set with glfwSetMonitorUserPointer and queried with glfwGetMonitorUserPointer. This can be used for any purpose you need and will not be modified by GLFW. The value will be kept until the monitor is disconnected or until the library is terminated.

    The initial value of the pointer is NULL.

    Gamma ramp

    The gamma ramp of a monitor can be set with glfwSetGammaRamp, which accepts a monitor handle and a pointer to a GLFWgammaramp structure.

    unsigned short red[256], green[256], blue[256];
    ramp.size = 256;
    ramp.red = red;
    ramp.green = green;
    ramp.blue = blue;
    for (i = 0; i < ramp.size; i++)
    {
    // Fill out gamma ramp arrays as desired
    }
    glfwSetGammaRamp(monitor, &ramp);

    The gamma ramp data is copied before the function returns, so there is no need to keep it around once the ramp has been set.

    It is recommended that your gamma ramp have the same size as the current gamma ramp for that monitor.

    The current gamma ramp for a monitor is returned by glfwGetGammaRamp. See the reference documentation for the lifetime of the returned structure.

    const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);

    If you wish to set a regular gamma ramp, you can have GLFW calculate it for you from the desired exponent with glfwSetGamma, which in turn calls glfwSetGammaRamp with the resulting ramp.

    glfwSetGamma(monitor, 1.0);

    To experiment with gamma correction via the glfwSetGamma function, run the gamma test program.

    Note
    The software controlled gamma ramp is applied in addition to the hardware gamma correction, which today is usually an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior.
    void glfwGetMonitorContentScale(GLFWmonitor *monitor, float *xscale, float *yscale)
    Retrieves the content scale for the specified monitor.
    GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback)
    Sets the monitor configuration callback.
    Gamma ramp.
    Definition: glfw3.h:1658
    void glfwGetMonitorWorkarea(GLFWmonitor *monitor, int *xpos, int *ypos, int *width, int *height)
    Retrieves the work area of the monitor.
    void glfwSetGammaRamp(GLFWmonitor *monitor, const GLFWgammaramp *ramp)
    Sets the current gamma ramp for the specified monitor.
    const char * glfwGetMonitorName(GLFWmonitor *monitor)
    Returns the name of the specified monitor.
    GLFWmonitor * glfwGetPrimaryMonitor(void)
    Returns the primary monitor.
    GLFWmonitor ** glfwGetMonitors(int *count)
    Returns the currently connected monitors.
    const GLFWvidmode * glfwGetVideoModes(GLFWmonitor *monitor, int *count)
    Returns the available video modes for the specified monitor.
    unsigned short * green
    Definition: glfw3.h:1665
    #define GLFW_DISCONNECTED
    Definition: glfw3.h:1075
    void glfwGetMonitorPos(GLFWmonitor *monitor, int *xpos, int *ypos)
    Returns the position of the monitor's viewport on the virtual screen.
    unsigned int size
    Definition: glfw3.h:1671
    unsigned short * red
    Definition: glfw3.h:1662
    void glfwGetMonitorPhysicalSize(GLFWmonitor *monitor, int *widthMM, int *heightMM)
    Returns the physical size of the monitor.
    const GLFWgammaramp * glfwGetGammaRamp(GLFWmonitor *monitor)
    Returns the current gamma ramp for the specified monitor.
    #define GLFW_CONNECTED
    Definition: glfw3.h:1074
    unsigned short * blue
    Definition: glfw3.h:1668
    Video mode type.
    Definition: glfw3.h:1624
    void glfwSetGamma(GLFWmonitor *monitor, float gamma)
    Generates a gamma ramp and sets it for the specified monitor.
    const GLFWvidmode * glfwGetVideoMode(GLFWmonitor *monitor)
    Returns the current mode of the specified monitor.
    struct GLFWmonitor GLFWmonitor
    Opaque monitor object.
    Definition: glfw3.h:1140
    ================================================ FILE: thirdparty/glfw/docs/html/moving_8dox.html ================================================ GLFW: moving.dox File Reference
    moving.dox File Reference
    ================================================ FILE: thirdparty/glfw/docs/html/moving_guide.html ================================================ GLFW: Moving from GLFW 2 to 3
    Moving from GLFW 2 to 3

    This is a transition guide for moving from GLFW 2 to 3. It describes what has changed or been removed, but does not include new features unless they are required when moving an existing code base onto the new API. For example, the new multi-monitor functions are required to create full screen windows with GLFW 3.

    Changed and removed features

    Renamed library and header file

    The GLFW 3 header is named glfw3.h and moved to the GLFW directory, to avoid collisions with the headers of other major versions. Similarly, the GLFW 3 library is named glfw3, except when it's installed as a shared library on Unix-like systems, where it uses the soname libglfw.so.3.

    Old syntax
    #include <GL/glfw.h>
    New syntax
    #include <GLFW/glfw3.h>

    Removal of threading functions

    The threading functions have been removed, including the per-thread sleep function. They were fairly primitive, under-used, poorly integrated and took time away from the focus of GLFW (i.e. context, input and window). There are better threading libraries available and native threading support is available in both C++11 and C11, both of which are gaining traction.

    If you wish to use the C++11 or C11 facilities but your compiler doesn't yet support them, see the TinyThread++ and TinyCThread projects created by the original author of GLFW. These libraries implement a usable subset of the threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use TinyCThread.

    However, GLFW 3 has better support for use from multiple threads than GLFW 2 had. Contexts can be made current on any thread, although only a single thread at a time, and the documentation explicitly states which functions may be used from any thread and which must only be used from the main thread.

    Removed functions
    glfwSleep, glfwCreateThread, glfwDestroyThread, glfwWaitThread, glfwGetThreadID, glfwCreateMutex, glfwDestroyMutex, glfwLockMutex, glfwUnlockMutex, glfwCreateCond, glfwDestroyCond, glfwWaitCond, glfwSignalCond, glfwBroadcastCond and glfwGetNumberOfProcessors.
    Removed types
    GLFWthreadfun

    Removal of image and texture loading

    The image and texture loading functions have been removed. They only supported the Targa image format, making them mostly useful for beginner level examples. To become of sufficiently high quality to warrant keeping them in GLFW 3, they would need not only to support other formats, but also modern extensions to OpenGL texturing. This would either add a number of external dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions of these libraries.

    As there already are libraries doing this, it is unnecessary both to duplicate the work and to tie the duplicate to GLFW. The resulting library would also be platform-independent, as both OpenGL and stdio are available wherever GLFW is.

    Removed functions
    glfwReadImage, glfwReadMemoryImage, glfwFreeImage, glfwLoadTexture2D, glfwLoadMemoryTexture2D and glfwLoadTextureImage2D.

    Removal of GLFWCALL macro

    The GLFWCALL macro, which made callback functions use __stdcall on Windows, has been removed. GLFW is written in C, not Pascal. Removing this macro means there's one less thing for application programmers to remember, i.e. the requirement to mark all callback functions with GLFWCALL. It also simplifies the creation of DLLs and DLL link libraries, as there's no need to explicitly disable @n entry point suffixes.

    Old syntax
    void GLFWCALL callback_function(...);
    New syntax
    void callback_function(...);

    Window handle parameters

    Because GLFW 3 supports multiple windows, window handle parameters have been added to all window-related GLFW functions and callbacks. The handle of a newly created window is returned by glfwCreateWindow (formerly glfwOpenWindow). Window handles are pointers to the opaque type GLFWwindow.

    Old syntax
    glfwSetWindowTitle("New Window Title");
    New syntax
    glfwSetWindowTitle(window, "New Window Title");

    Explicit monitor selection

    GLFW 3 provides support for multiple monitors. To request a full screen mode window, instead of passing GLFW_FULLSCREEN you specify which monitor you wish the window to use. The glfwGetPrimaryMonitor function returns the monitor that GLFW 2 would have selected, but there are many other monitor functions. Monitor handles are pointers to the opaque type GLFWmonitor.

    Old basic full screen
    glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_FULLSCREEN);
    New basic full screen
    window = glfwCreateWindow(640, 480, "My Window", glfwGetPrimaryMonitor(), NULL);
    Note
    The framebuffer bit depth parameters of glfwOpenWindow have been turned into window hints, but as they have been given sane defaults you rarely need to set these hints.

    Removal of automatic event polling

    GLFW 3 does not automatically poll for events in glfwSwapBuffers, meaning you need to call glfwPollEvents or glfwWaitEvents yourself. Unlike buffer swap, which acts on a single window, the event processing functions act on all windows at once.

    Old basic main loop
    while (...)
    {
    // Process input
    // Render output
    }
    New basic main loop
    while (...)
    {
    // Process input
    // Render output
    glfwSwapBuffers(window);
    }

    Explicit context management

    Each GLFW 3 window has its own OpenGL context and only you, the application programmer, can know which context should be current on which thread at any given time. Therefore, GLFW 3 leaves that decision to you.

    This means that you need to call glfwMakeContextCurrent after creating a window before you can call any OpenGL functions.

    Separation of window and framebuffer sizes

    Window positions and sizes now use screen coordinates, which may not be the same as pixels on machines with high-DPI monitors. This is important as OpenGL uses pixels, not screen coordinates. For example, the rectangle specified with glViewport needs to use pixels. Therefore, framebuffer size functions have been added. You can retrieve the size of the framebuffer of a window with glfwGetFramebufferSize function. A framebuffer size callback has also been added, which can be set with glfwSetFramebufferSizeCallback.

    Old basic viewport setup
    glfwGetWindowSize(&width, &height);
    glViewport(0, 0, width, height);
    New basic viewport setup
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);

    Window closing changes

    The GLFW_OPENED window parameter has been removed. As long as the window has not been destroyed, whether through glfwDestroyWindow or glfwTerminate, the window is "open".

    A user attempting to close a window is now just an event like any other. Unlike GLFW 2, windows and contexts created with GLFW 3 will never be destroyed unless you choose them to be. Each window now has a close flag that is set to GLFW_TRUE when the user attempts to close that window. By default, nothing else happens and the window stays visible. It is then up to you to either destroy the window, take some other action or ignore the request.

    You can query the close flag at any time with glfwWindowShouldClose and set it at any time with glfwSetWindowShouldClose.

    Old basic main loop
    while (glfwGetWindowParam(GLFW_OPENED))
    {
    ...
    }
    New basic main loop
    while (!glfwWindowShouldClose(window))
    {
    ...
    }

    The close callback no longer returns a value. Instead, it is called after the close flag has been set so it can override its value, if it chooses to, before event processing completes. You may however not call glfwDestroyWindow from the close callback (or any other window related callback).

    Old syntax
    int GLFWCALL window_close_callback(void);
    New syntax
    void window_close_callback(GLFWwindow* window);
    Note
    GLFW never clears the close flag to GLFW_FALSE, meaning you can use it for other reasons to close the window as well, for example the user choosing Quit from an in-game menu.

    Persistent window hints

    The glfwOpenWindowHint function has been renamed to glfwWindowHint.

    Window hints are no longer reset to their default values on window creation, but instead retain their values until modified by glfwWindowHint or glfwDefaultWindowHints, or until the library is terminated and re-initialized.

    Video mode enumeration

    Video mode enumeration is now per-monitor. The glfwGetVideoModes function now returns all available modes for a specific monitor instead of requiring you to guess how large an array you need. The glfwGetDesktopMode function, which had poorly defined behavior, has been replaced by glfwGetVideoMode, which returns the current mode of a monitor.

    Removal of character actions

    The action parameter of the character callback has been removed. This was an artefact of the origin of GLFW, i.e. being developed in English by a Swede. However, many keyboard layouts require more than one key to produce characters with diacritical marks. Even the Swedish keyboard layout requires this for uncommon cases like ü.

    Old syntax
    void GLFWCALL character_callback(int character, int action);
    New syntax
    void character_callback(GLFWwindow* window, int character);

    Cursor position changes

    The glfwGetMousePos function has been renamed to glfwGetCursorPos, glfwSetMousePos to glfwSetCursorPos and glfwSetMousePosCallback to glfwSetCursorPosCallback.

    The cursor position is now double instead of int, both for the direct functions and for the callback. Some platforms can provide sub-pixel cursor movement and this data is now passed on to the application where available. On platforms where this is not provided, the decimal part is zero.

    GLFW 3 only allows you to position the cursor within a window using glfwSetCursorPos (formerly glfwSetMousePos) when that window is active. Unless the window is active, the function fails silently.

    Wheel position replaced by scroll offsets

    The glfwGetMouseWheel function has been removed. Scrolling is the input of offsets and has no absolute position. The mouse wheel callback has been replaced by a scroll callback that receives two-dimensional floating point scroll offsets. This allows you to receive precise scroll data from for example modern touchpads.

    Old syntax
    void GLFWCALL mouse_wheel_callback(int position);
    New syntax
    void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
    Removed functions
    glfwGetMouseWheel

    Key repeat action

    The GLFW_KEY_REPEAT enable has been removed and key repeat is always enabled for both keys and characters. A new key action, GLFW_REPEAT, has been added to allow the key callback to distinguish an initial key press from a repeat. Note that glfwGetKey still returns only GLFW_PRESS or GLFW_RELEASE.

    Physical key input

    GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to the values generated by the current keyboard layout. The tokens are named according to the values they would have using the standard US layout, but this is only a convenience, as most programmers are assumed to know that layout. This means that (for example) GLFW_KEY_LEFT_BRACKET is always a single key and is the same key in the same place regardless of what keyboard layouts the users of your program has.

    The key input facility was never meant for text input, although using it that way worked slightly better in GLFW 2. If you were using it to input text, you should be using the character callback instead, on both GLFW 2 and 3. This will give you the characters being input, as opposed to the keys being pressed.

    GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of having to remember whether to check for ‘'a’or'A', you now check for GLFW_KEY_A`.

    Joystick function changes

    The glfwGetJoystickPos function has been renamed to glfwGetJoystickAxes.

    The glfwGetJoystickParam function and the GLFW_PRESENT, GLFW_AXES and GLFW_BUTTONS tokens have been replaced by the glfwJoystickPresent function as well as axis and button counts returned by the glfwGetJoystickAxes and glfwGetJoystickButtons functions.

    Win32 MBCS support

    The Win32 port of GLFW 3 will not compile in MBCS mode. However, because the use of the Unicode version of the Win32 API doesn't affect the process as a whole, but only those windows created using it, it's perfectly possible to call MBCS functions from other parts of the same application. Therefore, even if an application using GLFW has MBCS mode code, there's no need for GLFW itself to support it.

    Support for versions of Windows older than XP

    All explicit support for version of Windows older than XP has been removed. There is no code that actively prevents GLFW 3 from running on these earlier versions, but it uses Win32 functions that those versions lack.

    Windows XP was released in 2001, and by now (January 2015) it has not only replaced almost all earlier versions of Windows, but is itself rapidly being replaced by Windows 7 and 8. The MSDN library doesn't even provide documentation for version older than Windows 2000, making it difficult to maintain compatibility with these versions even if it was deemed worth the effort.

    The Win32 API has also not stood still, and GLFW 3 uses many functions only present on Windows XP or later. Even supporting an OS as new as XP (new from the perspective of GLFW 2, which still supports Windows 95) requires runtime checking for a number of functions that are present only on modern version of Windows.

    Capture of system-wide hotkeys

    The ability to disable and capture system-wide hotkeys like Alt+Tab has been removed. Modern applications, whether they're games, scientific visualisations or something else, are nowadays expected to be good desktop citizens and allow these hotkeys to function even when running in full screen mode.

    Automatic termination

    GLFW 3 does not register glfwTerminate with atexit at initialization, because exit calls registered functions from the calling thread and while it is permitted to call exit from any thread, glfwTerminate must only be called from the main thread.

    To release all resources allocated by GLFW, you should call glfwTerminate yourself, from the main thread, before the program terminates. Note that this destroys all windows not already destroyed with glfwDestroyWindow, invalidating any window handles you may still have.

    GLU header inclusion

    GLFW 3 does not by default include the GLU header and GLU itself has been deprecated by Khronos. New projects should not use GLU, but if you need it for legacy code that has been moved to GLFW 3, you can request that the GLFW header includes it by defining GLFW_INCLUDE_GLU before the inclusion of the GLFW header.

    Old syntax
    #include <GL/glfw.h>
    New syntax
    #define GLFW_INCLUDE_GLU
    #include <GLFW/glfw3.h>

    There are many libraries that offer replacements for the functionality offered by GLU. For the matrix helper functions, see math libraries like GLM (for C++), linmath.h (for C) and others. For the tessellation functions, see for example libtess2.

    Name change tables

    Renamed functions

    GLFW 2 GLFW 3 Notes
    glfwOpenWindow glfwCreateWindow All channel bit depths are now hints
    glfwCloseWindow glfwDestroyWindow
    glfwOpenWindowHint glfwWindowHint Now accepts all GLFW_*_BITS tokens
    glfwEnable glfwSetInputMode
    glfwDisable glfwSetInputMode
    glfwGetMousePos glfwGetCursorPos
    glfwSetMousePos glfwSetCursorPos
    glfwSetMousePosCallback glfwSetCursorPosCallback
    glfwSetMouseWheelCallback glfwSetScrollCallback Accepts two-dimensional scroll offsets as doubles
    glfwGetJoystickPos glfwGetJoystickAxes
    glfwGetWindowParam glfwGetWindowAttrib
    glfwGetGLVersion glfwGetWindowAttrib Use GLFW_CONTEXT_VERSION_MAJOR, GLFW_CONTEXT_VERSION_MINOR and GLFW_CONTEXT_REVISION
    glfwGetDesktopMode glfwGetVideoMode Returns the current mode of a monitor
    glfwGetJoystickParam glfwJoystickPresent The axis and button counts are provided by glfwGetJoystickAxes and glfwGetJoystickButtons

    Renamed types

    GLFW 2 GLFW 3 Notes
    GLFWmousewheelfun GLFWscrollfun
    GLFWmouseposfun GLFWcursorposfun

    Renamed tokens

    GLFW 2 GLFW 3 Notes
    GLFW_OPENGL_VERSION_MAJOR GLFW_CONTEXT_VERSION_MAJOR Renamed as it applies to OpenGL ES as well
    GLFW_OPENGL_VERSION_MINOR GLFW_CONTEXT_VERSION_MINOR Renamed as it applies to OpenGL ES as well
    GLFW_FSAA_SAMPLES GLFW_SAMPLES Renamed to match the OpenGL API
    GLFW_ACTIVE GLFW_FOCUSED Renamed to match the window focus callback
    GLFW_WINDOW_NO_RESIZE GLFW_RESIZABLE The default has been inverted
    GLFW_MOUSE_CURSOR GLFW_CURSOR Used with glfwSetInputMode
    GLFW_KEY_ESC GLFW_KEY_ESCAPE
    GLFW_KEY_DEL GLFW_KEY_DELETE
    GLFW_KEY_PAGEUP GLFW_KEY_PAGE_UP
    GLFW_KEY_PAGEDOWN GLFW_KEY_PAGE_DOWN
    GLFW_KEY_KP_NUM_LOCK GLFW_KEY_NUM_LOCK
    GLFW_KEY_LCTRL GLFW_KEY_LEFT_CONTROL
    GLFW_KEY_LSHIFT GLFW_KEY_LEFT_SHIFT
    GLFW_KEY_LALT GLFW_KEY_LEFT_ALT
    GLFW_KEY_LSUPER GLFW_KEY_LEFT_SUPER
    GLFW_KEY_RCTRL GLFW_KEY_RIGHT_CONTROL
    GLFW_KEY_RSHIFT GLFW_KEY_RIGHT_SHIFT
    GLFW_KEY_RALT GLFW_KEY_RIGHT_ALT
    GLFW_KEY_RSUPER GLFW_KEY_RIGHT_SUPER
    The header of the GLFW 3 API.
    void glfwSetWindowTitle(GLFWwindow *window, const char *title)
    Sets the title of the specified window.
    struct GLFWwindow GLFWwindow
    Opaque window object.
    Definition: glfw3.h:1152
    void glfwSwapBuffers(GLFWwindow *window)
    Swaps the front and back buffers of the specified window.
    int glfwWindowShouldClose(GLFWwindow *window)
    Checks the close flag of the specified window.
    void glfwPollEvents(void)
    Processes all pending events.
    GLFWmonitor * glfwGetPrimaryMonitor(void)
    Returns the primary monitor.
    GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
    Creates a window and its associated context.
    void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
    Retrieves the size of the content area of the specified window.
    void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
    Retrieves the size of the framebuffer of the specified window.
    ================================================ FILE: thirdparty/glfw/docs/html/news.html ================================================ GLFW: Release notes
    Release notes

    Table of Contents

    Release notes for version 3.3

    These are the release notes for version 3.3. For a more detailed view including all fixed bugs see the version history.

    Please review the caveats, deprecations and removals if your project was written against an earlier version of GLFW 3.

    New features in version 3.3

    Gamepad input via SDL_GameControllerDB

    GLFW can now remap game controllers to a standard Xbox-like layout using a built-in copy of SDL_GameControllerDB. Call glfwJoystickIsGamepad to check if a joystick has a mapping, glfwGetGamepadState to retrieve its input state, glfwUpdateGamepadMappings to add newer mappings and glfwGetGamepadName and glfwGetJoystickGUID for mapping related information.

    For more information see Gamepad input.

    Support for Vulkan on macOS via MoltenVK

    GLFW now supports MoltenVK, a Vulkan implementation on top of the Metal API, and its VK_MVK_macos_surface window surface creation extension. MoltenVK is included in the macOS Vulkan SDK.

    For more information see Vulkan guide.

    Content scale queries for DPI-aware rendering

    GLFW now provides content scales for windows and monitors, i.e. the ratio between their current DPI and the platform's default DPI, with glfwGetWindowContentScale and glfwGetMonitorContentScale.

    Changes of the content scale of a window can be received with the window content scale callback, set with glfwSetWindowContentScaleCallback.

    The GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a window by the content scale of the monitor it is placed, on platforms like Windows where this is necessary. This takes effect both on creation and when the window is moved between monitors. It is related to but different from GLFW_COCOA_RETINA_FRAMEBUFFER.

    For more information see Window content scale.

    Support for updating window attributes

    GLFW now supports changing the GLFW_DECORATED, GLFW_RESIZABLE, GLFW_FLOATING, GLFW_AUTO_ICONIFY and GLFW_FOCUS_ON_SHOW attributes for existing windows with glfwSetWindowAttrib.

    For more information see Window attributes.

    Support for raw mouse motion

    GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled cursor mode with the GLFW_RAW_MOUSE_MOTION input mode. Raw mouse motion input is not yet implemented on macOS. Call glfwRawMouseMotionSupported to check if GLFW can provide raw mouse motion on the current system.

    For more information see Raw mouse motion.

    Joystick hats

    GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with glfwGetJoystickHats. For compatibility, hats are also exposed as buttons. This can be disabled with the GLFW_JOYSTICK_HAT_BUTTONS initialization hint.

    For more information see Joystick hat states.

    Error query

    GLFW now supports querying the last error code for the calling thread and its human-readable description with glfwGetError. This can be used instead of or together with the error callback.

    For more information see Error handling.

    Support for initialization hints

    GLFW now supports setting library initialization hints with glfwInitHint. These must be set before initialization to take effect. Some of these hints are platform specific but are safe to set on any platform.

    For more information see Initialization hints.

    User attention request

    GLFW now supports requesting user attention with glfwRequestWindowAttention. Where possible this calls attention to the specified window. On platforms like macOS it calls attention to the whole application.

    For more information see Window attention request.

    Window maximization callback

    GLFW now supports notifying the application that the window has been maximized glfwSetWindowMaximizeCallback. This is called both when the window was maximized by the user and when it was done with glfwMaximizeWindow.

    For more information see Window maximization.

    Query for the monitor work area

    GLFW now supports querying the work area of a monitor, i.e. the area not occupied by task bars or global menu bars, with glfwGetMonitorWorkarea. On platforms that lack this concept, the whole area of the monitor is returned.

    For more information see Work area.

    Transparent windows and framebuffers

    GLFW now supports the creation of windows with transparent framebuffers on systems with desktop compositing enabled with the GLFW_TRANSPARENT_FRAMEBUFFER window hint and attribute. This hint must be set before window creation and leaves any window decorations opaque.

    GLFW now also supports whole window transparency with glfwGetWindowOpacity and glfwSetWindowOpacity. This value controls the opacity of the whole window including decorations and unlike framebuffer transparency can be changed at any time after window creation.

    For more information see Window transparency.

    Query for the scancode of a key

    GLFW now supports querying the platform dependent scancode of any physical key with glfwGetKeyScancode.

    For more information see Key input.

    Cursor centering window hint

    GLFW now supports controlling whether the cursor is centered over newly created full screen windows with the GLFW_CENTER_CURSOR window hint. It is enabled by default.

    Mouse cursor hover window attribute

    GLFW now supports polling whether the cursor is hovering over the window content area with the GLFW_HOVERED window attribute. This attribute corresponds to the cursor enter/leave event.

    Window hint and attribute for input focus on show

    GLFW now has the GLFW_FOCUS_ON_SHOW window hint and attribute for controlling whether a window gets input focus when shown. It is enabled by default. It applies both when creating an visible window with glfwCreateWindow and when showing it with glfwShowWindow.

    This is a workaround for GLFW 3.0 lacking glfwFocusWindow and will be corrected in the next major version.

    For more information see Window visibility.

    Monitor and joystick user pointers

    GLFW now supports setting and querying user pointers for connected monitors and joysticks with glfwSetMonitorUserPointer, glfwGetMonitorUserPointer, glfwSetJoystickUserPointer and glfwGetJoystickUserPointer.

    For more information see User pointer and Joystick user pointer.

    macOS menu bar from nib file

    GLFW will now load a MainMenu.nib file if found in the Contents/Resources directory of the application bundle, as a way to replace the GLFW menu bar without recompiling GLFW. This behavior can be disabled with the GLFW_COCOA_MENUBAR initialization hint.

    Support for more context creation extensions

    The context hint GLFW_SRGB_CAPABLE now supports OpenGL ES via WGL_EXT_colorspace, the context hint GLFW_CONTEXT_NO_ERROR now supports WGL_ARB_create_context_no_error and GLX_ARB_create_context_no_error, the context hint GLFW_CONTEXT_RELEASE_BEHAVIOR now supports EGL_KHR_context_flush_control and glfwGetProcAddress now supports EGL_KHR_get_all_proc_addresses.

    OSMesa off-screen context creation support

    GLFW now supports creating off-screen OpenGL contexts using OSMesa by setting GLFW_CONTEXT_CREATION_API to GLFW_OSMESA_CONTEXT_API. Native access function have been added to retrieve the OSMesa color and depth buffers.

    There is also a new null backend that uses OSMesa as its native context creation API, intended for automated testing. This backend does not provide input.

    Caveats for version 3.3

    Layout of joysticks have changed

    The way joystick elements are arranged have changed to match SDL2 in order to support SDL_GameControllerDB mappings. The layout of joysticks may change again if required for compatibility with SDL2. If you need a known and stable layout for game controllers, see if you can switch to Gamepad input.

    Existing code that depends on a specific joystick layout will likely have to be updated.

    No window required to wait for events

    The glfwWaitEvents and glfwWaitEventsTimeout functions no longer need a window to be created to wait for events. Before version 3.3 these functions would return immediately if there were no user-created windows. On platforms where only windows can receive events, an internal helper window is used.

    Existing code that depends on the earlier behavior will likely have to be updated.

    Gamma ramp size of 256 may be rejected

    The documentation for versions before 3.3 stated that a gamma ramp size of 256 would always be accepted. This was never the case on X11 and could lead to artifacts on macOS. The glfwSetGamma function has been updated to always generate a ramp of the correct size.

    Existing code that hardcodes a size of 256 should be updated to use the size of the current ramp of a monitor when setting a new ramp for that monitor.

    Windows XInput deadzone removed

    GLFW no longer applies any deadzone to the input state received from the XInput API. This was never done for any other platform joystick API so this change makes the behavior more consistent but you will need to apply your own deadzone if desired.

    X11 clipboard transfer limits

    GLFW now supports reading clipboard text via the INCR method, which removes the limit on how much text can be read with glfwGetClipboardString. However, writing via this method is not yet supported, so you may not be able to write a very large string with glfwSetClipboardString even if you read it from the clipboard earlier.

    The exact size limit for writing to the clipboard is negotiated with each receiving application but is at least several tens of kilobytes. Note that only the read limit has changed. Any string that could be written before still can be.

    X11 extension libraries are loaded dynamically

    GLFW now loads all X11 extension libraries at initialization. The only X11 library you need to link against is libX11. The header files for the extension libraries are still required for compilation.

    Existing projects and makefiles that link GLFW directly against the extension libraries should still build correctly but will add these libraries as load-time dependencies.

    CMake 3.0 or later is required

    The minimum CMake version has been raised from 2.8.12 to 3.0. This is only a requirement of the GLFW CMake files. The GLFW source files do not depend on CMake.

    Deprecations in version 3.3

    Character with modifiers callback

    The character with modifiers callback set with glfwSetCharModsCallback has been deprecated and should if possible not be used.

    Existing code should still work but further bug fixes will likely not be made. The callback will be removed in the next major version.

    Window parameter to clipboard functions

    The window parameter of the clipboard functions glfwGetClipboardString and glfwSetClipboardString has been deprecated and is no longer used on any platform. On platforms where the clipboard must be owned by a specific window, an internal helper window is used.

    Existing code should still work unless it depends on a specific window owning the clipboard. New code may pass NULL as the window argument. The parameter will be removed in a future release.

    Removals in 3.3

    macOS specific CMake options and macros

    The GLFW_USE_RETINA, GLFW_USE_CHDIR and GLFW_USE_MENUBAR CMake options and the _GLFW_USE_RETINA, _GLFW_USE_CHDIR and _GLFW_USE_MENUBAR compile-time macros have been removed.

    These options and macros are replaced by the window hint GLFW_COCOA_RETINA_FRAMEBUFFER and the init hints GLFW_COCOA_CHDIR_RESOURCES and GLFW_COCOA_MENUBAR.

    Existing projects and makefiles that set these options or define these macros during compilation of GLFW will still build but it will have no effect and the default behaviors will be used.

    LunarG Vulkan SDK dependency

    The GLFW test programs that previously depended on the LunarG Vulkan SDK now instead uses a Vulkan loader generated by glad2. This means the GLFW CMake files no longer look for the Vulkan SDK.

    Existing CMake projects that depended on the Vulkan SDK cache variables from GLFW will need to call find_package(Vulkan) themselves. CMake 3.7 and later already comes with a Vulkan find module similar to the one GLFW previously included.

    CMake option LIB_SUFFIX

    The LIB_SUFFIX CMake option has been removed. GLFW now uses the GNUInstallDirs CMake package to handle platform specific details like the library directory suffix and the LIB_SUFFIX CMake option has been removed.

    Existing projects and makefiles that set the LIB_SUFFIX option will use the suffix chosen by the GNUInstallDirs package and the option will be ignored.

    Mir support

    The experimental Mir support has been completely removed as the Mir project has implemented support for the Wayland protocol and is recommending that applications use that instead.

    Existing projects and makefiles that select Mir when compiling GLFW will fail. Use Wayland or X11 instead.

    New symbols in version 3.3

    New functions in version 3.3

    New types in version 3.3

    New constants in version 3.3

    Release notes for 3.2

    These are the release notes for version 3.2. For a more detailed view including all fixed bugs see the version history.

    New features in version 3.2

    Support for Vulkan

    GLFW now supports basic integration with Vulkan with glfwVulkanSupported, glfwGetRequiredInstanceExtensions, glfwGetInstanceProcAddress, glfwGetPhysicalDevicePresentationSupport and glfwCreateWindowSurface. Vulkan header inclusion can be selected with GLFW_INCLUDE_VULKAN.

    Window mode switching

    GLFW now supports switching between windowed and full screen modes and updating the monitor and desired resolution and refresh rate of full screen windows with glfwSetWindowMonitor.

    Window maxmimization support

    GLFW now supports window maximization with glfwMaximizeWindow and the GLFW_MAXIMIZED window hint and attribute.

    Window input focus control

    GLFW now supports giving windows input focus with glfwFocusWindow.

    Window size limit support

    GLFW now supports setting both absolute and relative window size limits with glfwSetWindowSizeLimits and glfwSetWindowAspectRatio.

    Localized key names

    GLFW now supports querying the localized name of printable keys with glfwGetKeyName, either by key token or by scancode.

    Wait for events with timeout

    GLFW now supports waiting for events for a set amount of time with glfwWaitEventsTimeout.

    Window icon support

    GLFW now supports setting the icon of windows with glfwSetWindowIcon.

    Raw timer access

    GLFW now supports raw timer values with glfwGetTimerValue and glfwGetTimerFrequency.

    Joystick connection callback

    GLFW now supports notifying when a joystick has been connected or disconnected with glfwSetJoystickCallback.

    Context-less windows

    GLFW now supports creating windows without a OpenGL or OpenGL ES context by setting the GLFW_CLIENT_API hint to GLFW_NO_API.

    Run-time context creation API selection

    GLFW now supports selecting and querying the context creation API at run-time with the GLFW_CONTEXT_CREATION_API hint and attribute.

    Error-free context creation

    GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do not emit errors with the GLFW_CONTEXT_NO_ERROR hint, provided the machine supports the GL_KHR_no_error extension.

    CMake config-file package support

    GLFW now supports being used as a config-file package from other projects for easy linking with the library and its dependencies.

    Release notes for 3.1

    These are the release notes for version 3.1. For a more detailed view including all fixed bugs see the version history.

    New features in version 3.1

    Custom mouse cursor images

    GLFW now supports creating and setting both custom cursor images and standard cursor shapes. They are created with glfwCreateCursor or glfwCreateStandardCursor, set with glfwSetCursor and destroyed with glfwDestroyCursor.

    See also
    Cursor objects

    Path drop event

    GLFW now provides a callback for receiving the paths of files and directories dropped onto GLFW windows. The callback is set with glfwSetDropCallback.

    See also
    Path drop input

    Main thread wake-up

    GLFW now provides the glfwPostEmptyEvent function for posting an empty event from another thread to the main thread event queue, causing glfwWaitEvents to return.

    See also
    Event processing

    Window frame size query

    GLFW now supports querying the size, on each side, of the frame around the content area of a window, with glfwGetWindowFrameSize.

    See also
    Window size

    Simultaneous multi-monitor rendering

    GLFW now supports disabling auto-iconification of full screen windows with the GLFW_AUTO_ICONIFY window hint. This is intended for people building multi-monitor installations, where you need windows to stay in full screen despite losing input focus.

    Floating windows

    GLFW now supports floating windows, also called topmost or always on top, for easier debugging with the GLFW_FLOATING window hint and attribute.

    Initially unfocused windows

    GLFW now supports preventing a windowed mode window from gaining input focus on creation, with the GLFW_FOCUSED window hint.

    Direct access for window attributes and cursor position

    GLFW now queries the window input focus, visibility and iconification attributes and the cursor position directly instead of returning cached data.

    Character with modifiers callback

    GLFW now provides a callback for character events with modifier key bits. The callback is set with glfwSetCharModsCallback. Unlike the regular character callback, this will report character events that will not result in a character being input, for example if the Control key is held down.

    See also
    Text input

    Single buffered framebuffers

    GLFW now supports the creation of single buffered windows, with the GLFW_DOUBLEBUFFER hint.

    Macro for including extension header

    GLFW now includes the extension header appropriate for the chosen OpenGL or OpenGL ES header when GLFW_INCLUDE_GLEXT is defined. GLFW does not provide these headers. They must be provided by your development environment or your OpenGL or OpenGL ES SDK.

    Context release behaviors

    GLFW now supports controlling and querying whether the pipeline is flushed when a context is made non-current, with the GLFW_CONTEXT_RELEASE_BEHAVIOR hint and attribute, provided the machine supports the GL_KHR_context_flush_control extension.

    (Experimental) Wayland support

    GLFW now has an experimental Wayland display protocol backend that can be selected on Linux with a CMake option.

    (Experimental) Mir support

    GLFW now has an experimental Mir display server backend that can be selected on Linux with a CMake option.

    Release notes for 3.0

    These are the release notes for version 3.0. For a more detailed view including all fixed bugs see the version history.

    New features in version 3.0

    CMake build system

    GLFW now uses the CMake build system instead of the various makefiles and project files used by earlier versions. CMake is available for all platforms supported by GLFW, is present in most package systems and can generate makefiles and/or project files for most popular development environments.

    For more information on how to use CMake, see the CMake manual.

    Multi-window support

    GLFW now supports the creation of multiple windows, each with their own OpenGL or OpenGL ES context, and all window functions now take a window handle. Event callbacks are now per-window and are provided with the handle of the window that received the event. The glfwMakeContextCurrent function has been added to select which context is current on a given thread.

    Multi-monitor support

    GLFW now explicitly supports multiple monitors. They can be enumerated with glfwGetMonitors, queried with glfwGetVideoModes, glfwGetMonitorPos, glfwGetMonitorName and glfwGetMonitorPhysicalSize, and specified at window creation to make the newly created window full screen on that specific monitor.

    Unicode support

    All string arguments to GLFW functions and all strings returned by GLFW now use the UTF-8 encoding. This includes the window title, error string, clipboard text, monitor and joystick names as well as the extension function arguments (as ASCII is a subset of UTF-8).

    Clipboard text I/O

    GLFW now supports reading and writing plain text to and from the system clipboard, with the glfwGetClipboardString and glfwSetClipboardString functions.

    Gamma ramp support

    GLFW now supports setting and reading back the gamma ramp of monitors, with the glfwGetGammaRamp and glfwSetGammaRamp functions. There is also glfwSetGamma, which generates a ramp from a gamma value and then sets it.

    OpenGL ES support

    GLFW now supports the creation of OpenGL ES contexts, by setting the GLFW_CLIENT_API hint to GLFW_OPENGL_ES_API, where creation of such contexts are supported. Note that GLFW does not implement OpenGL ES, so your driver must provide support in a way usable by GLFW. Modern Nvidia and Intel drivers support creation of OpenGL ES context using the GLX and WGL APIs, while AMD provides an EGL implementation instead.

    (Experimental) EGL support

    GLFW now has an experimental EGL context creation back end that can be selected through CMake options.

    High-DPI support

    GLFW now supports high-DPI monitors on both Windows and macOS, giving windows full resolution framebuffers where other UI elements are scaled up. To achieve this, glfwGetFramebufferSize and glfwSetFramebufferSizeCallback have been added. These work with pixels, while the rest of the GLFW API works with screen coordinates. This is important as OpenGL uses pixels, not screen coordinates.

    Error callback

    GLFW now has an error callback, which can provide your application with much more detailed diagnostics than was previously possible. The callback is passed an error code and a description string.

    Per-window user pointer

    Each window now has a user-defined pointer, retrieved with glfwGetWindowUserPointer and set with glfwSetWindowUserPointer, to make it easier to integrate GLFW into C++ code.

    Window iconification callback

    Each window now has a callback for iconification and restoration events, which is set with glfwSetWindowIconifyCallback.

    Window position callback

    Each window now has a callback for position events, which is set with glfwSetWindowPosCallback.

    Window position query

    The position of a window can now be retrieved using glfwGetWindowPos.

    Window focus callback

    Each windows now has a callback for focus events, which is set with glfwSetWindowFocusCallback.

    Cursor enter/leave callback

    Each window now has a callback for when the mouse cursor enters or leaves its content area, which is set with glfwSetCursorEnterCallback.

    Initial window title

    The title of a window is now specified at creation time, as one of the arguments to glfwCreateWindow.

    Hidden windows

    Windows can now be hidden with glfwHideWindow, shown using glfwShowWindow and created initially hidden with the GLFW_VISIBLE window hint and attribute. This allows for off-screen rendering in a way compatible with most drivers, as well as moving a window to a specific position before showing it.

    Undecorated windows

    Windowed mode windows can now be created without decorations, e.g. things like a frame, a title bar, with the GLFW_DECORATED window hint and attribute. This allows for the creation of things like splash screens.

    Modifier key bit masks

    Modifier key bit mask parameters have been added to the mouse button and key callbacks.

    Platform-specific scancodes

    A scancode parameter has been added to the key callback. Keys that don't have a key token still get passed on with the key parameter set to GLFW_KEY_UNKNOWN. These scancodes will vary between machines and are intended to be used for key bindings.

    Joystick names

    The name of a joystick can now be retrieved using glfwGetJoystickName.

    Doxygen documentation

    You are reading it.

    ================================================ FILE: thirdparty/glfw/docs/html/news_8dox.html ================================================ GLFW: news.dox File Reference
    news.dox File Reference
    ================================================ FILE: thirdparty/glfw/docs/html/pages.html ================================================ GLFW: Guides
    Guides
    ================================================ FILE: thirdparty/glfw/docs/html/quick_8dox.html ================================================ GLFW: quick.dox File Reference
    quick.dox File Reference
    ================================================ FILE: thirdparty/glfw/docs/html/quick_guide.html ================================================ GLFW: Getting started
    Getting started

    This guide takes you through writing a simple application using GLFW 3. The application will create a window and OpenGL context, render a rotating triangle and exit when the user closes the window or presses Escape. This guide will introduce a few of the most commonly used functions, but there are many more.

    This guide assumes no experience with earlier versions of GLFW. If you have used GLFW 2 in the past, read Moving from GLFW 2 to 3, as some functions behave differently in GLFW 3.

    Step by step

    Including the GLFW header

    In the source files of your application where you use OpenGL or GLFW, you need to include the GLFW 3 header file.

    #include <GLFW/glfw3.h>

    This defines all the constants, types and function prototypes of the GLFW API. It also includes the OpenGL header from your development environment and defines all the constants and types necessary for it to work on your platform without including any platform-specific headers.

    In other words:

    • Do not include the OpenGL header yourself, as GLFW does this for you in a platform-independent way
    • Do not include windows.h or other platform-specific headers unless you plan on using those APIs yourself
    • If you do need to include such headers, include them before the GLFW header and it will detect this

    On some platforms supported by GLFW the OpenGL header and link library only expose older versions of OpenGL. The most extreme case is Windows, which only exposes OpenGL 1.2. The easiest way to work around this is to use an extension loader library.

    If you are using such a library then you should include its header before the GLFW header. This lets it replace the OpenGL header included by GLFW without conflicts. This example uses glad2, but the same rule applies to all such libraries.

    #include <glad/gl.h>
    #include <GLFW/glfw3.h>

    Initializing and terminating GLFW

    Before you can use most GLFW functions, the library must be initialized. On successful initialization, GLFW_TRUE is returned. If an error occurred, GLFW_FALSE is returned.

    if (!glfwInit())
    {
    // Initialization failed
    }

    Note that GLFW_TRUE and GLFW_FALSE are and will always be one and zero.

    When you are done using GLFW, typically just before the application exits, you need to terminate GLFW.

    This destroys any remaining windows and releases any other resources allocated by GLFW. After this call, you must initialize GLFW again before using any GLFW functions that require it.

    Setting an error callback

    Most events are reported through callbacks, whether it's a key being pressed, a GLFW window being moved, or an error occurring. Callbacks are C functions (or C++ static methods) that are called by GLFW with arguments describing the event.

    In case a GLFW function fails, an error is reported to the GLFW error callback. You can receive these reports with an error callback. This function must have the signature below but may do anything permitted in other callbacks.

    void error_callback(int error, const char* description)
    {
    fprintf(stderr, "Error: %s\n", description);
    }

    Callback functions must be set, so GLFW knows to call them. The function to set the error callback is one of the few GLFW functions that may be called before initialization, which lets you be notified of errors both during and after initialization.

    glfwSetErrorCallback(error_callback);

    Creating a window and context

    The window and its OpenGL context are created with a single call to glfwCreateWindow, which returns a handle to the created combined window and context object

    GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
    if (!window)
    {
    // Window or OpenGL context creation failed
    }

    This creates a 640 by 480 windowed mode window with an OpenGL context. If window or OpenGL context creation fails, NULL will be returned. You should always check the return value. While window creation rarely fails, context creation depends on properly installed drivers and may fail even on machines with the necessary hardware.

    By default, the OpenGL context GLFW creates may have any version. You can require a minimum OpenGL version by setting the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints before creation. If the required minimum version is not supported on the machine, context (and window) creation fails.

    GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
    if (!window)
    {
    // Window or context creation failed
    }

    The window handle is passed to all window related functions and is provided to along to all window related callbacks, so they can tell which window received the event.

    When a window and context is no longer needed, destroy it.

    Once this function is called, no more events will be delivered for that window and its handle becomes invalid.

    Making the OpenGL context current

    Before you can use the OpenGL API, you must have a current OpenGL context.

    The context will remain current until you make another context current or until the window owning the current context is destroyed.

    If you are using an extension loader library to access modern OpenGL then this is when to initialize it, as the loader needs a current context to load from. This example uses glad, but the same rule applies to all such libraries.

    gladLoadGL(glfwGetProcAddress);

    Checking the window close flag

    Each window has a flag indicating whether the window should be closed.

    When the user attempts to close the window, either by pressing the close widget in the title bar or using a key combination like Alt+F4, this flag is set to 1. Note that the window isn't actually closed, so you are expected to monitor this flag and either destroy the window or give some kind of feedback to the user.

    while (!glfwWindowShouldClose(window))
    {
    // Keep running
    }

    You can be notified when the user is attempting to close the window by setting a close callback with glfwSetWindowCloseCallback. The callback will be called immediately after the close flag has been set.

    You can also set it yourself with glfwSetWindowShouldClose. This can be useful if you want to interpret other kinds of input as closing the window, like for example pressing the Escape key.

    Receiving input events

    Each window has a large number of callbacks that can be set to receive all the various kinds of events. To receive key press and release events, create a key callback function.

    static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
    {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
    }

    The key callback, like other window related callbacks, are set per-window.

    glfwSetKeyCallback(window, key_callback);

    In order for event callbacks to be called when events occur, you need to process events as described below.

    Rendering with OpenGL

    Once you have a current OpenGL context, you can use OpenGL normally. In this tutorial, a multi-colored rotating triangle will be rendered. The framebuffer size needs to be retrieved for glViewport.

    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);

    You can also set a framebuffer size callback using glfwSetFramebufferSizeCallback and be notified when the size changes.

    Actual rendering with OpenGL is outside the scope of this tutorial, but there are many excellent tutorial sites that teach modern OpenGL. Some of them use GLFW to create the context and window while others use GLUT or SDL, but remember that OpenGL itself always works the same.

    Reading the timer

    To create smooth animation, a time source is needed. GLFW provides a timer that returns the number of seconds since initialization. The time source used is the most accurate on each platform and generally has micro- or nanosecond resolution.

    double time = glfwGetTime();

    Swapping buffers

    GLFW windows by default use double buffering. That means that each window has two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.

    When the entire frame has been rendered, the buffers need to be swapped with one another, so the back buffer becomes the front buffer and vice versa.

    The swap interval indicates how many frames to wait until swapping the buffers, commonly known as vsync. By default, the swap interval is zero, meaning buffer swapping will occur immediately. On fast machines, many of those frames will never be seen, as the screen is still only updated typically 60-75 times per second, so this wastes a lot of CPU and GPU cycles.

    Also, because the buffers will be swapped in the middle the screen update, leading to screen tearing.

    For these reasons, applications will typically want to set the swap interval to one. It can be set to higher values, but this is usually not recommended, because of the input latency it leads to.

    This function acts on the current context and will fail unless a context is current.

    Processing events

    GLFW needs to communicate regularly with the window system both in order to receive events and to show that the application hasn't locked up. Event processing must be done regularly while you have visible windows and is normally done each frame after buffer swapping.

    There are two methods for processing pending events; polling and waiting. This example will use event polling, which processes only those events that have already been received and then returns immediately.

    This is the best choice when rendering continually, like most games do. If instead you only need to update your rendering once you have received new input, glfwWaitEvents is a better choice. It waits until at least one event has been received, putting the thread to sleep in the meantime, and then processes all received events. This saves a great deal of CPU cycles and is useful for, for example, many kinds of editing tools.

    Putting it together

    Now that you know how to initialize GLFW, create a window and poll for keyboard input, it's possible to create a simple program.

    This program creates a 640 by 480 windowed mode window and starts a loop that clears the screen, renders a triangle and processes events until the user either presses Escape or closes the window.

    #include <glad/gl.h>
    #define GLFW_INCLUDE_NONE
    #include <GLFW/glfw3.h>
    #include "linmath.h"
    #include <stdlib.h>
    #include <stdio.h>
    static const struct
    {
    float x, y;
    float r, g, b;
    } vertices[3] =
    {
    { -0.6f, -0.4f, 1.f, 0.f, 0.f },
    { 0.6f, -0.4f, 0.f, 1.f, 0.f },
    { 0.f, 0.6f, 0.f, 0.f, 1.f }
    };
    static const char* vertex_shader_text =
    "#version 110\n"
    "uniform mat4 MVP;\n"
    "attribute vec3 vCol;\n"
    "attribute vec2 vPos;\n"
    "varying vec3 color;\n"
    "void main()\n"
    "{\n"
    " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
    " color = vCol;\n"
    "}\n";
    static const char* fragment_shader_text =
    "#version 110\n"
    "varying vec3 color;\n"
    "void main()\n"
    "{\n"
    " gl_FragColor = vec4(color, 1.0);\n"
    "}\n";
    static void error_callback(int error, const char* description)
    {
    fprintf(stderr, "Error: %s\n", description);
    }
    static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
    {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
    }
    int main(void)
    {
    GLFWwindow* window;
    GLuint vertex_buffer, vertex_shader, fragment_shader, program;
    GLint mvp_location, vpos_location, vcol_location;
    glfwSetErrorCallback(error_callback);
    if (!glfwInit())
    exit(EXIT_FAILURE);
    window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
    if (!window)
    {
    exit(EXIT_FAILURE);
    }
    glfwSetKeyCallback(window, key_callback);
    gladLoadGL(glfwGetProcAddress);
    // NOTE: OpenGL error checks have been omitted for brevity
    glGenBuffers(1, &vertex_buffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
    vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);
    glCompileShader(vertex_shader);
    fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);
    glCompileShader(fragment_shader);
    program = glCreateProgram();
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    glLinkProgram(program);
    mvp_location = glGetUniformLocation(program, "MVP");
    vpos_location = glGetAttribLocation(program, "vPos");
    vcol_location = glGetAttribLocation(program, "vCol");
    glEnableVertexAttribArray(vpos_location);
    glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
    sizeof(vertices[0]), (void*) 0);
    glEnableVertexAttribArray(vcol_location);
    glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
    sizeof(vertices[0]), (void*) (sizeof(float) * 2));
    while (!glfwWindowShouldClose(window))
    {
    float ratio;
    int width, height;
    mat4x4 m, p, mvp;
    glfwGetFramebufferSize(window, &width, &height);
    ratio = width / (float) height;
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    mat4x4_identity(m);
    mat4x4_rotate_Z(m, m, (float) glfwGetTime());
    mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    mat4x4_mul(mvp, p, m);
    glUseProgram(program);
    glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
    glDrawArrays(GL_TRIANGLES, 0, 3);
    glfwSwapBuffers(window);
    }
    exit(EXIT_SUCCESS);
    }

    The program above can be found in the source package as examples/simple.c and is compiled along with all other examples when you build GLFW. If you built GLFW from the source package then you already have this as simple.exe on Windows, simple on Linux or simple.app on macOS.

    This tutorial used only a few of the many functions GLFW provides. There are guides for each of the areas covered by GLFW. Each guide will introduce all the functions for that category.

    You can access reference documentation for any GLFW function by clicking it and the reference for each function links to related functions and guide sections.

    The tutorial ends here. Once you have written a program that uses GLFW, you will need to compile and link it. How to do that depends on the development environment you are using and is best explained by the documentation for that environment. To learn about the details that are specific to GLFW, see Building applications.

    double glfwGetTime(void)
    Returns the GLFW time.
    #define GLFW_PRESS
    The key or mouse button was pressed.
    Definition: glfw3.h:306
    The header of the GLFW 3 API.
    #define GLFW_CONTEXT_VERSION_MINOR
    Context client API minor version hint and attribute.
    Definition: glfw3.h:929
    struct GLFWwindow GLFWwindow
    Opaque window object.
    Definition: glfw3.h:1152
    void glfwTerminate(void)
    Terminates the GLFW library.
    void glfwSwapBuffers(GLFWwindow *window)
    Swaps the front and back buffers of the specified window.
    void glfwMakeContextCurrent(GLFWwindow *window)
    Makes the context of the specified window current for the calling thread.
    void glfwSwapInterval(int interval)
    Sets the swap interval for the current context.
    int glfwWindowShouldClose(GLFWwindow *window)
    Checks the close flag of the specified window.
    void glfwPollEvents(void)
    Processes all pending events.
    #define GLFW_TRUE
    One.
    Definition: glfw3.h:280
    #define GLFW_CONTEXT_VERSION_MAJOR
    Context client API major version hint and attribute.
    Definition: glfw3.h:923
    GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
    Creates a window and its associated context.
    void glfwSetWindowShouldClose(GLFWwindow *window, int value)
    Sets the close flag of the specified window.
    #define GLFW_KEY_ESCAPE
    Definition: glfw3.h:414
    int glfwInit(void)
    Initializes the GLFW library.
    GLFWglproc glfwGetProcAddress(const char *procname)
    Returns the address of the specified function for the current context.
    GLFWkeyfun glfwSetKeyCallback(GLFWwindow *window, GLFWkeyfun callback)
    Sets the key callback.
    GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback)
    Sets the error callback.
    void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
    Retrieves the size of the framebuffer of the specified window.
    void glfwWindowHint(int hint, int value)
    Sets the specified window hint to the desired value.
    void glfwDestroyWindow(GLFWwindow *window)
    Destroys the specified window and its context.
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_0.js ================================================ var searchData= [ ['axes_0',['axes',['../structGLFWgamepadstate.html#a8b2c8939b1d31458de5359998375c189',1,'GLFWgamepadstate']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_1.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_1.js ================================================ var searchData= [ ['blue_1',['blue',['../structGLFWgammaramp.html#acf0c836d0efe29c392fe8d1a1042744b',1,'GLFWgammaramp']]], ['bluebits_2',['blueBits',['../structGLFWvidmode.html#af310977f58d2e3b188175b6e3d314047',1,'GLFWvidmode']]], ['bug_20list_3',['Bug List',['../bug.html',1,'']]], ['build_2edox_4',['build.dox',['../build_8dox.html',1,'']]], ['building_20applications_5',['Building applications',['../build_guide.html',1,'']]], ['buttons_6',['buttons',['../structGLFWgamepadstate.html#a27e9896b51c65df15fba2c7139bfdb9a',1,'GLFWgamepadstate']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_10.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_10.js ================================================ var searchData= [ ['vulkan_20reference_520',['Vulkan reference',['../group__vulkan.html',1,'']]], ['vulkan_2edox_521',['vulkan.dox',['../vulkan_8dox.html',1,'']]], ['vulkan_20guide_522',['Vulkan guide',['../vulkan_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_11.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_11.js ================================================ var searchData= [ ['width_523',['width',['../structGLFWvidmode.html#a698dcb200562051a7249cb6ae154c71d',1,'GLFWvidmode::width()'],['../structGLFWimage.html#af6a71cc999fe6d3aea31dd7e9687d835',1,'GLFWimage::width()']]], ['window_20reference_524',['Window reference',['../group__window.html',1,'']]], ['window_2edox_525',['window.dox',['../window_8dox.html',1,'']]], ['window_20guide_526',['Window guide',['../window_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_2.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_2.js ================================================ var searchData= [ ['compat_2edox_7',['compat.dox',['../compat_8dox.html',1,'']]], ['compile_2edox_8',['compile.dox',['../compile_8dox.html',1,'']]], ['compiling_20glfw_9',['Compiling GLFW',['../compile_guide.html',1,'']]], ['context_20reference_10',['Context reference',['../group__context.html',1,'']]], ['context_2edox_11',['context.dox',['../context_8dox.html',1,'']]], ['context_20guide_12',['Context guide',['../context_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_3.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_3.js ================================================ var searchData= [ ['deprecated_20list_13',['Deprecated List',['../deprecated.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_4.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_4.js ================================================ var searchData= [ ['error_20codes_14',['Error codes',['../group__errors.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_5.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_5.js ================================================ var searchData= [ ['gamepad_20axes_15',['Gamepad axes',['../group__gamepad__axes.html',1,'']]], ['gamepad_20buttons_16',['Gamepad buttons',['../group__gamepad__buttons.html',1,'']]], ['glapientry_17',['GLAPIENTRY',['../glfw3_8h.html#aa97755eb47e4bf2727ad45d610e18206',1,'glfw3.h']]], ['glfw3_2eh_18',['glfw3.h',['../glfw3_8h.html',1,'']]], ['glfw3native_2eh_19',['glfw3native.h',['../glfw3native_8h.html',1,'']]], ['glfw_5faccum_5falpha_5fbits_20',['GLFW_ACCUM_ALPHA_BITS',['../group__window.html#gae829b55591c18169a40ab4067a041b1f',1,'glfw3.h']]], ['glfw_5faccum_5fblue_5fbits_21',['GLFW_ACCUM_BLUE_BITS',['../group__window.html#ga22bbe9104a8ce1f8b88fb4f186aa36ce',1,'glfw3.h']]], ['glfw_5faccum_5fgreen_5fbits_22',['GLFW_ACCUM_GREEN_BITS',['../group__window.html#ga65713cee1326f8e9d806fdf93187b471',1,'glfw3.h']]], ['glfw_5faccum_5fred_5fbits_23',['GLFW_ACCUM_RED_BITS',['../group__window.html#gaead34a9a683b2bc20eecf30ba738bfc6',1,'glfw3.h']]], ['glfw_5falpha_5fbits_24',['GLFW_ALPHA_BITS',['../group__window.html#gafed79a3f468997877da86c449bd43e8c',1,'glfw3.h']]], ['glfw_5fany_5frelease_5fbehavior_25',['GLFW_ANY_RELEASE_BEHAVIOR',['../glfw3_8h.html#a6b47d806f285efe9bfd7aeec667297ee',1,'glfw3.h']]], ['glfw_5fapi_5funavailable_26',['GLFW_API_UNAVAILABLE',['../group__errors.html#ga56882b290db23261cc6c053c40c2d08e',1,'glfw3.h']]], ['glfw_5fapientry_5fdefined_27',['GLFW_APIENTRY_DEFINED',['../glfw3_8h.html#a8a8538c5500308b4211844f2fb26c7b9',1,'glfw3.h']]], ['glfw_5farrow_5fcursor_28',['GLFW_ARROW_CURSOR',['../group__shapes.html#ga8ab0e717245b85506cb0eaefdea39d0a',1,'glfw3.h']]], ['glfw_5fauto_5ficonify_29',['GLFW_AUTO_ICONIFY',['../group__window.html#ga9d9874fc928200136a6dcdad726aa252',1,'glfw3.h']]], ['glfw_5faux_5fbuffers_30',['GLFW_AUX_BUFFERS',['../group__window.html#gab05108c5029443b371112b031d1fa174',1,'glfw3.h']]], ['glfw_5fblue_5fbits_31',['GLFW_BLUE_BITS',['../group__window.html#gab292ea403db6d514537b515311bf9ae3',1,'glfw3.h']]], ['glfw_5fcenter_5fcursor_32',['GLFW_CENTER_CURSOR',['../group__window.html#ga5ac0847c0aa0b3619f2855707b8a7a77',1,'glfw3.h']]], ['glfw_5fclient_5fapi_33',['GLFW_CLIENT_API',['../group__window.html#ga649309cf72a3d3de5b1348ca7936c95b',1,'glfw3.h']]], ['glfw_5fcocoa_5fchdir_5fresources_34',['GLFW_COCOA_CHDIR_RESOURCES',['../group__init.html#gab937983147a3158d45f88fad7129d9f2',1,'glfw3.h']]], ['glfw_5fcocoa_5fframe_5fname_35',['GLFW_COCOA_FRAME_NAME',['../group__window.html#ga70fa0fbc745de6aa824df79a580e84b5',1,'glfw3.h']]], ['glfw_5fcocoa_5fgraphics_5fswitching_36',['GLFW_COCOA_GRAPHICS_SWITCHING',['../group__window.html#ga53c84ed2ddd94e15bbd44b1f6f7feafc',1,'glfw3.h']]], ['glfw_5fcocoa_5fmenubar_37',['GLFW_COCOA_MENUBAR',['../group__init.html#ga71e0b4ce2f2696a84a9b8c5e12dc70cf',1,'glfw3.h']]], ['glfw_5fcocoa_5fretina_5fframebuffer_38',['GLFW_COCOA_RETINA_FRAMEBUFFER',['../group__window.html#gab6ef2d02eb55800d249ccf1af253c35e',1,'glfw3.h']]], ['glfw_5fconnected_39',['GLFW_CONNECTED',['../glfw3_8h.html#abe11513fd1ffbee5bb9b173f06028b9e',1,'glfw3.h']]], ['glfw_5fcontext_5fcreation_5fapi_40',['GLFW_CONTEXT_CREATION_API',['../group__window.html#ga5154cebfcd831c1cc63a4d5ac9bb4486',1,'glfw3.h']]], ['glfw_5fcontext_5fno_5ferror_41',['GLFW_CONTEXT_NO_ERROR',['../group__window.html#ga5a52fdfd46d8249c211f923675728082',1,'glfw3.h']]], ['glfw_5fcontext_5frelease_5fbehavior_42',['GLFW_CONTEXT_RELEASE_BEHAVIOR',['../group__window.html#ga72b648a8378fe3310c7c7bbecc0f7be6',1,'glfw3.h']]], ['glfw_5fcontext_5frevision_43',['GLFW_CONTEXT_REVISION',['../group__window.html#gafb9475071aa77c6fb05ca5a5c8678a08',1,'glfw3.h']]], ['glfw_5fcontext_5frobustness_44',['GLFW_CONTEXT_ROBUSTNESS',['../group__window.html#gade3593916b4c507900aa2d6844810e00',1,'glfw3.h']]], ['glfw_5fcontext_5fversion_5fmajor_45',['GLFW_CONTEXT_VERSION_MAJOR',['../group__window.html#gafe5e4922de1f9932d7e9849bb053b0c0',1,'glfw3.h']]], ['glfw_5fcontext_5fversion_5fminor_46',['GLFW_CONTEXT_VERSION_MINOR',['../group__window.html#ga31aca791e4b538c4e4a771eb95cc2d07',1,'glfw3.h']]], ['glfw_5fcrosshair_5fcursor_47',['GLFW_CROSSHAIR_CURSOR',['../group__shapes.html#ga8af88c0ea05ab9e8f9ac1530e8873c22',1,'glfw3.h']]], ['glfw_5fcursor_48',['GLFW_CURSOR',['../glfw3_8h.html#aade31da5b884a84a7625c6b059b9132c',1,'glfw3.h']]], ['glfw_5fcursor_5fdisabled_49',['GLFW_CURSOR_DISABLED',['../glfw3_8h.html#a2315b99a329ce53e6a13a9d46fd5ca88',1,'glfw3.h']]], ['glfw_5fcursor_5fhidden_50',['GLFW_CURSOR_HIDDEN',['../glfw3_8h.html#ac4d5cb9d78de8573349c58763d53bf11',1,'glfw3.h']]], ['glfw_5fcursor_5fnormal_51',['GLFW_CURSOR_NORMAL',['../glfw3_8h.html#ae04dd25c8577e19fa8c97368561f6c68',1,'glfw3.h']]], ['glfw_5fdecorated_52',['GLFW_DECORATED',['../group__window.html#ga21b854d36314c94d65aed84405b2f25e',1,'glfw3.h']]], ['glfw_5fdepth_5fbits_53',['GLFW_DEPTH_BITS',['../group__window.html#ga318a55eac1fee57dfe593b6d38149d07',1,'glfw3.h']]], ['glfw_5fdisconnected_54',['GLFW_DISCONNECTED',['../glfw3_8h.html#aab64b25921ef21d89252d6f0a71bfc32',1,'glfw3.h']]], ['glfw_5fdont_5fcare_55',['GLFW_DONT_CARE',['../glfw3_8h.html#a7a2edf2c18446833d27d07f1b7f3d571',1,'glfw3.h']]], ['glfw_5fdoublebuffer_56',['GLFW_DOUBLEBUFFER',['../group__window.html#ga714a5d569e8a274ea58fdfa020955339',1,'glfw3.h']]], ['glfw_5fegl_5fcontext_5fapi_57',['GLFW_EGL_CONTEXT_API',['../glfw3_8h.html#a03cf65c9ab01fc8b872ba58842c531c9',1,'glfw3.h']]], ['glfw_5ffalse_58',['GLFW_FALSE',['../group__init.html#gac877fe3b627d21ef3a0a23e0a73ba8c5',1,'glfw3.h']]], ['glfw_5ffloating_59',['GLFW_FLOATING',['../group__window.html#ga7fb0be51407783b41adbf5bec0b09d80',1,'glfw3.h']]], ['glfw_5ffocus_5fon_5fshow_60',['GLFW_FOCUS_ON_SHOW',['../group__window.html#gafa94b1da34bfd6488c0d709761504dfc',1,'glfw3.h']]], ['glfw_5ffocused_61',['GLFW_FOCUSED',['../group__window.html#ga54ddb14825a1541a56e22afb5f832a9e',1,'glfw3.h']]], ['glfw_5fformat_5funavailable_62',['GLFW_FORMAT_UNAVAILABLE',['../group__errors.html#ga196e125ef261d94184e2b55c05762f14',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5flast_63',['GLFW_GAMEPAD_AXIS_LAST',['../group__gamepad__axes.html#ga0818fd9433e1359692b7443293e5ac86',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5fleft_5ftrigger_64',['GLFW_GAMEPAD_AXIS_LEFT_TRIGGER',['../group__gamepad__axes.html#ga6d79561dd8907c37354426242901b86e',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5fleft_5fx_65',['GLFW_GAMEPAD_AXIS_LEFT_X',['../group__gamepad__axes.html#ga544e396d092036a7d80c1e5f233f7a38',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5fleft_5fy_66',['GLFW_GAMEPAD_AXIS_LEFT_Y',['../group__gamepad__axes.html#ga64dcf2c6e9be50b7c556ff7671996dd5',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5fright_5ftrigger_67',['GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER',['../group__gamepad__axes.html#ga121a7d5d20589a423cd1634dd6ee6eab',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5fright_5fx_68',['GLFW_GAMEPAD_AXIS_RIGHT_X',['../group__gamepad__axes.html#gabd6785106cd3c5a044a6e49a395ee2fc',1,'glfw3.h']]], ['glfw_5fgamepad_5faxis_5fright_5fy_69',['GLFW_GAMEPAD_AXIS_RIGHT_Y',['../group__gamepad__axes.html#ga1cc20566d44d521b7183681a8e88e2e4',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fa_70',['GLFW_GAMEPAD_BUTTON_A',['../group__gamepad__buttons.html#gae055a12fbf4b48b5954c8e1cd129b810',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fb_71',['GLFW_GAMEPAD_BUTTON_B',['../group__gamepad__buttons.html#ga2228a6512fd5950cdb51ba07846546fa',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fback_72',['GLFW_GAMEPAD_BUTTON_BACK',['../group__gamepad__buttons.html#gabc7c0264ce778835b516a472b47f6caf',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fcircle_73',['GLFW_GAMEPAD_BUTTON_CIRCLE',['../group__gamepad__buttons.html#gaaef094b3dacbf15f272b274516839b82',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fcross_74',['GLFW_GAMEPAD_BUTTON_CROSS',['../group__gamepad__buttons.html#gaf08d0df26527c9305253422bd98ed63a',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fdpad_5fdown_75',['GLFW_GAMEPAD_BUTTON_DPAD_DOWN',['../group__gamepad__buttons.html#ga8f2b731b97d80f90f11967a83207665c',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fdpad_5fleft_76',['GLFW_GAMEPAD_BUTTON_DPAD_LEFT',['../group__gamepad__buttons.html#gaf0697e0e8607b2ebe1c93b0c6befe301',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fdpad_5fright_77',['GLFW_GAMEPAD_BUTTON_DPAD_RIGHT',['../group__gamepad__buttons.html#gae2a780d2a8c79e0b77c0b7b601ca57c6',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fdpad_5fup_78',['GLFW_GAMEPAD_BUTTON_DPAD_UP',['../group__gamepad__buttons.html#ga4f1ed6f974a47bc8930d4874a283476a',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fguide_79',['GLFW_GAMEPAD_BUTTON_GUIDE',['../group__gamepad__buttons.html#ga7fa48c32e5b2f5db2f080aa0b8b573dc',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5flast_80',['GLFW_GAMEPAD_BUTTON_LAST',['../group__gamepad__buttons.html#ga5cc98882f4f81dacf761639a567f61eb',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fleft_5fbumper_81',['GLFW_GAMEPAD_BUTTON_LEFT_BUMPER',['../group__gamepad__buttons.html#ga17d67b4f39a39d6b813bd1567a3507c3',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fleft_5fthumb_82',['GLFW_GAMEPAD_BUTTON_LEFT_THUMB',['../group__gamepad__buttons.html#ga3e089787327454f7bfca7364d6ca206a',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fright_5fbumper_83',['GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER',['../group__gamepad__buttons.html#gadfbc9ea9bf3aae896b79fa49fdc85c7f',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fright_5fthumb_84',['GLFW_GAMEPAD_BUTTON_RIGHT_THUMB',['../group__gamepad__buttons.html#ga1c003f52b5aebb45272475b48953b21a',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fsquare_85',['GLFW_GAMEPAD_BUTTON_SQUARE',['../group__gamepad__buttons.html#gafc7821e87d77d41ed2cd3e1f726ec35f',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fstart_86',['GLFW_GAMEPAD_BUTTON_START',['../group__gamepad__buttons.html#ga04606949dd9139434b8a1bedf4ac1021',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5ftriangle_87',['GLFW_GAMEPAD_BUTTON_TRIANGLE',['../group__gamepad__buttons.html#ga3a7ef6bcb768a08cd3bf142f7f09f802',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fx_88',['GLFW_GAMEPAD_BUTTON_X',['../group__gamepad__buttons.html#ga52cc94785cf3fe9a12e246539259887c',1,'glfw3.h']]], ['glfw_5fgamepad_5fbutton_5fy_89',['GLFW_GAMEPAD_BUTTON_Y',['../group__gamepad__buttons.html#gafc931248bda494b530cbe057f386a5ed',1,'glfw3.h']]], ['glfw_5fgreen_5fbits_90',['GLFW_GREEN_BITS',['../group__window.html#gafba3b72638c914e5fb8a237dd4c50d4d',1,'glfw3.h']]], ['glfw_5fhand_5fcursor_91',['GLFW_HAND_CURSOR',['../group__shapes.html#ga1db35e20849e0837c82e3dc1fd797263',1,'glfw3.h']]], ['glfw_5fhat_5fcentered_92',['GLFW_HAT_CENTERED',['../group__hat__state.html#gae2c0bcb7aec609e4736437554f6638fd',1,'glfw3.h']]], ['glfw_5fhat_5fdown_93',['GLFW_HAT_DOWN',['../group__hat__state.html#gad60d1fd0dc85c18f2642cbae96d3deff',1,'glfw3.h']]], ['glfw_5fhat_5fleft_94',['GLFW_HAT_LEFT',['../group__hat__state.html#gac775f4b3154fdf5db93eb432ba546dff',1,'glfw3.h']]], ['glfw_5fhat_5fleft_5fdown_95',['GLFW_HAT_LEFT_DOWN',['../group__hat__state.html#ga76c02baf1ea345fcbe3e8ff176a73e19',1,'glfw3.h']]], ['glfw_5fhat_5fleft_5fup_96',['GLFW_HAT_LEFT_UP',['../group__hat__state.html#ga638f0e20dc5de90de21a33564e8ce129',1,'glfw3.h']]], ['glfw_5fhat_5fright_97',['GLFW_HAT_RIGHT',['../group__hat__state.html#ga252586e3bbde75f4b0e07ad3124867f5',1,'glfw3.h']]], ['glfw_5fhat_5fright_5fdown_98',['GLFW_HAT_RIGHT_DOWN',['../group__hat__state.html#gad7f0e4f52fd68d734863aaeadab3a3f5',1,'glfw3.h']]], ['glfw_5fhat_5fright_5fup_99',['GLFW_HAT_RIGHT_UP',['../group__hat__state.html#ga94aea0ae241a8b902883536c592ee693',1,'glfw3.h']]], ['glfw_5fhat_5fup_100',['GLFW_HAT_UP',['../group__hat__state.html#ga8c9720c76cd1b912738159ed74c85b36',1,'glfw3.h']]], ['glfw_5fhovered_101',['GLFW_HOVERED',['../group__window.html#ga8665c71c6fa3d22425c6a0e8a3f89d8a',1,'glfw3.h']]], ['glfw_5fhresize_5fcursor_102',['GLFW_HRESIZE_CURSOR',['../group__shapes.html#gabb3eb0109f11bb808fc34659177ca962',1,'glfw3.h']]], ['glfw_5fibeam_5fcursor_103',['GLFW_IBEAM_CURSOR',['../group__shapes.html#ga36185f4375eaada1b04e431244774c86',1,'glfw3.h']]], ['glfw_5ficonified_104',['GLFW_ICONIFIED',['../group__window.html#ga39d44b7c056e55e581355a92d240b58a',1,'glfw3.h']]], ['glfw_5finvalid_5fenum_105',['GLFW_INVALID_ENUM',['../group__errors.html#ga76f6bb9c4eea73db675f096b404593ce',1,'glfw3.h']]], ['glfw_5finvalid_5fvalue_106',['GLFW_INVALID_VALUE',['../group__errors.html#gaaf2ef9aa8202c2b82ac2d921e554c687',1,'glfw3.h']]], ['glfw_5fjoystick_5f1_107',['GLFW_JOYSTICK_1',['../group__joysticks.html#ga34a0443d059e9f22272cd4669073f73d',1,'glfw3.h']]], ['glfw_5fjoystick_5f10_108',['GLFW_JOYSTICK_10',['../group__joysticks.html#gaef55389ee605d6dfc31aef6fe98c54ec',1,'glfw3.h']]], ['glfw_5fjoystick_5f11_109',['GLFW_JOYSTICK_11',['../group__joysticks.html#gae7d26e3df447c2c14a569fcc18516af4',1,'glfw3.h']]], ['glfw_5fjoystick_5f12_110',['GLFW_JOYSTICK_12',['../group__joysticks.html#gab91bbf5b7ca6be8d3ac5c4d89ff48ac7',1,'glfw3.h']]], ['glfw_5fjoystick_5f13_111',['GLFW_JOYSTICK_13',['../group__joysticks.html#ga5c84fb4e49bf661d7d7c78eb4018c508',1,'glfw3.h']]], ['glfw_5fjoystick_5f14_112',['GLFW_JOYSTICK_14',['../group__joysticks.html#ga89540873278ae5a42b3e70d64164dc74',1,'glfw3.h']]], ['glfw_5fjoystick_5f15_113',['GLFW_JOYSTICK_15',['../group__joysticks.html#ga7b02ab70daf7a78bcc942d5d4cc1dcf9',1,'glfw3.h']]], ['glfw_5fjoystick_5f16_114',['GLFW_JOYSTICK_16',['../group__joysticks.html#ga453edeeabf350827646b6857df4f80ce',1,'glfw3.h']]], ['glfw_5fjoystick_5f2_115',['GLFW_JOYSTICK_2',['../group__joysticks.html#ga6eab65ec88e65e0850ef8413504cb50c',1,'glfw3.h']]], ['glfw_5fjoystick_5f3_116',['GLFW_JOYSTICK_3',['../group__joysticks.html#gae6f3eedfeb42424c2f5e3161efb0b654',1,'glfw3.h']]], ['glfw_5fjoystick_5f4_117',['GLFW_JOYSTICK_4',['../group__joysticks.html#ga97ddbcad02b7f48d74fad4ddb08fff59',1,'glfw3.h']]], ['glfw_5fjoystick_5f5_118',['GLFW_JOYSTICK_5',['../group__joysticks.html#gae43281bc66d3fa5089fb50c3e7a28695',1,'glfw3.h']]], ['glfw_5fjoystick_5f6_119',['GLFW_JOYSTICK_6',['../group__joysticks.html#ga74771620aa53bd68a487186dea66fd77',1,'glfw3.h']]], ['glfw_5fjoystick_5f7_120',['GLFW_JOYSTICK_7',['../group__joysticks.html#ga20a9f4f3aaefed9ea5e66072fc588b87',1,'glfw3.h']]], ['glfw_5fjoystick_5f8_121',['GLFW_JOYSTICK_8',['../group__joysticks.html#ga21a934c940bcf25db0e4c8fe9b364bdb',1,'glfw3.h']]], ['glfw_5fjoystick_5f9_122',['GLFW_JOYSTICK_9',['../group__joysticks.html#ga87689d47df0ba6f9f5fcbbcaf7b3cecf',1,'glfw3.h']]], ['glfw_5fjoystick_5fhat_5fbuttons_123',['GLFW_JOYSTICK_HAT_BUTTONS',['../group__init.html#gab9c0534709fda03ec8959201da3a9a18',1,'glfw3.h']]], ['glfw_5fjoystick_5flast_124',['GLFW_JOYSTICK_LAST',['../group__joysticks.html#ga9ca13ebf24c331dd98df17d84a4b72c9',1,'glfw3.h']]], ['glfw_5fkey_5f0_125',['GLFW_KEY_0',['../group__keys.html#ga50391730e9d7112ad4fd42d0bd1597c1',1,'glfw3.h']]], ['glfw_5fkey_5f1_126',['GLFW_KEY_1',['../group__keys.html#ga05e4cae9ddb8d40cf6d82c8f11f2502f',1,'glfw3.h']]], ['glfw_5fkey_5f2_127',['GLFW_KEY_2',['../group__keys.html#gadc8e66b3a4c4b5c39ad1305cf852863c',1,'glfw3.h']]], ['glfw_5fkey_5f3_128',['GLFW_KEY_3',['../group__keys.html#ga812f0273fe1a981e1fa002ae73e92271',1,'glfw3.h']]], ['glfw_5fkey_5f4_129',['GLFW_KEY_4',['../group__keys.html#ga9e14b6975a9cc8f66cdd5cb3d3861356',1,'glfw3.h']]], ['glfw_5fkey_5f5_130',['GLFW_KEY_5',['../group__keys.html#ga4d74ddaa5d4c609993b4d4a15736c924',1,'glfw3.h']]], ['glfw_5fkey_5f6_131',['GLFW_KEY_6',['../group__keys.html#ga9ea4ab80c313a227b14d0a7c6f810b5d',1,'glfw3.h']]], ['glfw_5fkey_5f7_132',['GLFW_KEY_7',['../group__keys.html#gab79b1cfae7bd630cfc4604c1f263c666',1,'glfw3.h']]], ['glfw_5fkey_5f8_133',['GLFW_KEY_8',['../group__keys.html#gadeaa109a0f9f5afc94fe4a108e686f6f',1,'glfw3.h']]], ['glfw_5fkey_5f9_134',['GLFW_KEY_9',['../group__keys.html#ga2924cb5349ebbf97c8987f3521c44f39',1,'glfw3.h']]], ['glfw_5fkey_5fa_135',['GLFW_KEY_A',['../group__keys.html#ga03e842608e1ea323370889d33b8f70ff',1,'glfw3.h']]], ['glfw_5fkey_5fapostrophe_136',['GLFW_KEY_APOSTROPHE',['../group__keys.html#ga6059b0b048ba6980b6107fffbd3b4b24',1,'glfw3.h']]], ['glfw_5fkey_5fb_137',['GLFW_KEY_B',['../group__keys.html#ga8e3fb647ff3aca9e8dbf14fe66332941',1,'glfw3.h']]], ['glfw_5fkey_5fbackslash_138',['GLFW_KEY_BACKSLASH',['../group__keys.html#gab8155ea99d1ab27ff56f24f8dc73f8d1',1,'glfw3.h']]], ['glfw_5fkey_5fbackspace_139',['GLFW_KEY_BACKSPACE',['../group__keys.html#ga6c0df1fe2f156bbd5a98c66d76ff3635',1,'glfw3.h']]], ['glfw_5fkey_5fc_140',['GLFW_KEY_C',['../group__keys.html#ga00ccf3475d9ee2e679480d540d554669',1,'glfw3.h']]], ['glfw_5fkey_5fcaps_5flock_141',['GLFW_KEY_CAPS_LOCK',['../group__keys.html#ga92c1d2c9d63485f3d70f94f688d48672',1,'glfw3.h']]], ['glfw_5fkey_5fcomma_142',['GLFW_KEY_COMMA',['../group__keys.html#gab3d5d72e59d3055f494627b0a524926c',1,'glfw3.h']]], ['glfw_5fkey_5fd_143',['GLFW_KEY_D',['../group__keys.html#ga011f7cdc9a654da984a2506479606933',1,'glfw3.h']]], ['glfw_5fkey_5fdelete_144',['GLFW_KEY_DELETE',['../group__keys.html#gadb111e4df74b8a715f2c05dad58d2682',1,'glfw3.h']]], ['glfw_5fkey_5fdown_145',['GLFW_KEY_DOWN',['../group__keys.html#gae2e3958c71595607416aa7bf082be2f9',1,'glfw3.h']]], ['glfw_5fkey_5fe_146',['GLFW_KEY_E',['../group__keys.html#gabf48fcc3afbe69349df432b470c96ef2',1,'glfw3.h']]], ['glfw_5fkey_5fend_147',['GLFW_KEY_END',['../group__keys.html#ga86587ea1df19a65978d3e3b8439bedd9',1,'glfw3.h']]], ['glfw_5fkey_5fenter_148',['GLFW_KEY_ENTER',['../group__keys.html#ga9555a92ecbecdbc1f3435219c571d667',1,'glfw3.h']]], ['glfw_5fkey_5fequal_149',['GLFW_KEY_EQUAL',['../group__keys.html#gae1a2de47240d6664423c204bdd91bd17',1,'glfw3.h']]], ['glfw_5fkey_5fescape_150',['GLFW_KEY_ESCAPE',['../group__keys.html#gaac6596c350b635c245113b81c2123b93',1,'glfw3.h']]], ['glfw_5fkey_5ff_151',['GLFW_KEY_F',['../group__keys.html#ga5df402e02aca08444240058fd9b42a55',1,'glfw3.h']]], ['glfw_5fkey_5ff1_152',['GLFW_KEY_F1',['../group__keys.html#gafb8d66c573acf22e364049477dcbea30',1,'glfw3.h']]], ['glfw_5fkey_5ff10_153',['GLFW_KEY_F10',['../group__keys.html#ga718d11d2f7d57471a2f6a894235995b1',1,'glfw3.h']]], ['glfw_5fkey_5ff11_154',['GLFW_KEY_F11',['../group__keys.html#ga0bc04b11627e7d69339151e7306b2832',1,'glfw3.h']]], ['glfw_5fkey_5ff12_155',['GLFW_KEY_F12',['../group__keys.html#gaf5908fa9b0a906ae03fc2c61ac7aa3e2',1,'glfw3.h']]], ['glfw_5fkey_5ff13_156',['GLFW_KEY_F13',['../group__keys.html#gad637f4308655e1001bd6ad942bc0fd4b',1,'glfw3.h']]], ['glfw_5fkey_5ff14_157',['GLFW_KEY_F14',['../group__keys.html#gaf14c66cff3396e5bd46e803c035e6c1f',1,'glfw3.h']]], ['glfw_5fkey_5ff15_158',['GLFW_KEY_F15',['../group__keys.html#ga7f70970db6e8be1794da8516a6d14058',1,'glfw3.h']]], ['glfw_5fkey_5ff16_159',['GLFW_KEY_F16',['../group__keys.html#gaa582dbb1d2ba2050aa1dca0838095b27',1,'glfw3.h']]], ['glfw_5fkey_5ff17_160',['GLFW_KEY_F17',['../group__keys.html#ga972ce5c365e2394b36104b0e3125c748',1,'glfw3.h']]], ['glfw_5fkey_5ff18_161',['GLFW_KEY_F18',['../group__keys.html#gaebf6391058d5566601e357edc5ea737c',1,'glfw3.h']]], ['glfw_5fkey_5ff19_162',['GLFW_KEY_F19',['../group__keys.html#gaec011d9ba044058cb54529da710e9791',1,'glfw3.h']]], ['glfw_5fkey_5ff2_163',['GLFW_KEY_F2',['../group__keys.html#ga0900750aff94889b940f5e428c07daee',1,'glfw3.h']]], ['glfw_5fkey_5ff20_164',['GLFW_KEY_F20',['../group__keys.html#ga82b9c721ada04cd5ca8de767da38022f',1,'glfw3.h']]], ['glfw_5fkey_5ff21_165',['GLFW_KEY_F21',['../group__keys.html#ga356afb14d3440ff2bb378f74f7ebc60f',1,'glfw3.h']]], ['glfw_5fkey_5ff22_166',['GLFW_KEY_F22',['../group__keys.html#ga90960bd2a155f2b09675324d3dff1565',1,'glfw3.h']]], ['glfw_5fkey_5ff23_167',['GLFW_KEY_F23',['../group__keys.html#ga43c21099aac10952d1be909a8ddee4d5',1,'glfw3.h']]], ['glfw_5fkey_5ff24_168',['GLFW_KEY_F24',['../group__keys.html#ga8150374677b5bed3043408732152dea2',1,'glfw3.h']]], ['glfw_5fkey_5ff25_169',['GLFW_KEY_F25',['../group__keys.html#gaa4bbd93ed73bb4c6ae7d83df880b7199',1,'glfw3.h']]], ['glfw_5fkey_5ff3_170',['GLFW_KEY_F3',['../group__keys.html#gaed7cd729c0147a551bb8b7bb36c17015',1,'glfw3.h']]], ['glfw_5fkey_5ff4_171',['GLFW_KEY_F4',['../group__keys.html#ga9b61ebd0c63b44b7332fda2c9763eaa6',1,'glfw3.h']]], ['glfw_5fkey_5ff5_172',['GLFW_KEY_F5',['../group__keys.html#gaf258dda9947daa428377938ed577c8c2',1,'glfw3.h']]], ['glfw_5fkey_5ff6_173',['GLFW_KEY_F6',['../group__keys.html#ga6dc2d3f87b9d51ffbbbe2ef0299d8e1d',1,'glfw3.h']]], ['glfw_5fkey_5ff7_174',['GLFW_KEY_F7',['../group__keys.html#gacca6ef8a2162c52a0ac1d881e8d9c38a',1,'glfw3.h']]], ['glfw_5fkey_5ff8_175',['GLFW_KEY_F8',['../group__keys.html#gac9d39390336ae14e4a93e295de43c7e8',1,'glfw3.h']]], ['glfw_5fkey_5ff9_176',['GLFW_KEY_F9',['../group__keys.html#gae40de0de1c9f21cd26c9afa3d7050851',1,'glfw3.h']]], ['glfw_5fkey_5fg_177',['GLFW_KEY_G',['../group__keys.html#gae74ecddf7cc96104ab23989b1cdab536',1,'glfw3.h']]], ['glfw_5fkey_5fgrave_5faccent_178',['GLFW_KEY_GRAVE_ACCENT',['../group__keys.html#ga7a3701fb4e2a0b136ff4b568c3c8d668',1,'glfw3.h']]], ['glfw_5fkey_5fh_179',['GLFW_KEY_H',['../group__keys.html#gad4cc98fc8f35f015d9e2fb94bf136076',1,'glfw3.h']]], ['glfw_5fkey_5fhome_180',['GLFW_KEY_HOME',['../group__keys.html#ga41452c7287195d481e43207318c126a7',1,'glfw3.h']]], ['glfw_5fkey_5fi_181',['GLFW_KEY_I',['../group__keys.html#ga274655c8bfe39742684ca393cf8ed093',1,'glfw3.h']]], ['glfw_5fkey_5finsert_182',['GLFW_KEY_INSERT',['../group__keys.html#ga373ac7365435d6b0eb1068f470e34f47',1,'glfw3.h']]], ['glfw_5fkey_5fj_183',['GLFW_KEY_J',['../group__keys.html#ga65ff2aedb129a3149ad9cb3e4159a75f',1,'glfw3.h']]], ['glfw_5fkey_5fk_184',['GLFW_KEY_K',['../group__keys.html#ga4ae8debadf6d2a691badae0b53ea3ba0',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f0_185',['GLFW_KEY_KP_0',['../group__keys.html#ga10515dafc55b71e7683f5b4fedd1c70d',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f1_186',['GLFW_KEY_KP_1',['../group__keys.html#gaf3a29a334402c5eaf0b3439edf5587c3',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f2_187',['GLFW_KEY_KP_2',['../group__keys.html#gaf82d5a802ab8213c72653d7480c16f13',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f3_188',['GLFW_KEY_KP_3',['../group__keys.html#ga7e25ff30d56cd512828c1d4ae8d54ef2',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f4_189',['GLFW_KEY_KP_4',['../group__keys.html#gada7ec86778b85e0b4de0beea72234aea',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f5_190',['GLFW_KEY_KP_5',['../group__keys.html#ga9a5be274434866c51738cafbb6d26b45',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f6_191',['GLFW_KEY_KP_6',['../group__keys.html#gafc141b0f8450519084c01092a3157faa',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f7_192',['GLFW_KEY_KP_7',['../group__keys.html#ga8882f411f05d04ec77a9563974bbfa53',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f8_193',['GLFW_KEY_KP_8',['../group__keys.html#gab2ea2e6a12f89d315045af520ac78cec',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5f9_194',['GLFW_KEY_KP_9',['../group__keys.html#gafb21426b630ed4fcc084868699ba74c1',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fadd_195',['GLFW_KEY_KP_ADD',['../group__keys.html#gad09c7c98acc79e89aa6a0a91275becac',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fdecimal_196',['GLFW_KEY_KP_DECIMAL',['../group__keys.html#ga4e231d968796331a9ea0dbfb98d4005b',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fdivide_197',['GLFW_KEY_KP_DIVIDE',['../group__keys.html#gabca1733780a273d549129ad0f250d1e5',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fenter_198',['GLFW_KEY_KP_ENTER',['../group__keys.html#ga4f728f8738f2986bd63eedd3d412e8cf',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fequal_199',['GLFW_KEY_KP_EQUAL',['../group__keys.html#gaebdc76d4a808191e6d21b7e4ad2acd97',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fmultiply_200',['GLFW_KEY_KP_MULTIPLY',['../group__keys.html#ga9ada267eb0e78ed2ada8701dd24a56ef',1,'glfw3.h']]], ['glfw_5fkey_5fkp_5fsubtract_201',['GLFW_KEY_KP_SUBTRACT',['../group__keys.html#gaa3dbd60782ff93d6082a124bce1fa236',1,'glfw3.h']]], ['glfw_5fkey_5fl_202',['GLFW_KEY_L',['../group__keys.html#gaaa8b54a13f6b1eed85ac86f82d550db2',1,'glfw3.h']]], ['glfw_5fkey_5flast_203',['GLFW_KEY_LAST',['../group__keys.html#ga442cbaef7bfb9a4ba13594dd7fbf2789',1,'glfw3.h']]], ['glfw_5fkey_5fleft_204',['GLFW_KEY_LEFT',['../group__keys.html#gae12a010d33c309a67ab9460c51eb2462',1,'glfw3.h']]], ['glfw_5fkey_5fleft_5falt_205',['GLFW_KEY_LEFT_ALT',['../group__keys.html#ga7f27dabf63a7789daa31e1c96790219b',1,'glfw3.h']]], ['glfw_5fkey_5fleft_5fbracket_206',['GLFW_KEY_LEFT_BRACKET',['../group__keys.html#gad1c8d9adac53925276ecb1d592511d8a',1,'glfw3.h']]], ['glfw_5fkey_5fleft_5fcontrol_207',['GLFW_KEY_LEFT_CONTROL',['../group__keys.html#ga9f97b743e81460ac4b2deddecd10a464',1,'glfw3.h']]], ['glfw_5fkey_5fleft_5fshift_208',['GLFW_KEY_LEFT_SHIFT',['../group__keys.html#ga8a530a28a65c44ab5d00b759b756d3f6',1,'glfw3.h']]], ['glfw_5fkey_5fleft_5fsuper_209',['GLFW_KEY_LEFT_SUPER',['../group__keys.html#gafb1207c91997fc295afd1835fbc5641a',1,'glfw3.h']]], ['glfw_5fkey_5fm_210',['GLFW_KEY_M',['../group__keys.html#ga4d7f0260c82e4ea3d6ebc7a21d6e3716',1,'glfw3.h']]], ['glfw_5fkey_5fmenu_211',['GLFW_KEY_MENU',['../group__keys.html#ga9845be48a745fc232045c9ec174d8820',1,'glfw3.h']]], ['glfw_5fkey_5fminus_212',['GLFW_KEY_MINUS',['../group__keys.html#gac556b360f7f6fca4b70ba0aecf313fd4',1,'glfw3.h']]], ['glfw_5fkey_5fn_213',['GLFW_KEY_N',['../group__keys.html#gae00856dfeb5d13aafebf59d44de5cdda',1,'glfw3.h']]], ['glfw_5fkey_5fnum_5flock_214',['GLFW_KEY_NUM_LOCK',['../group__keys.html#ga3946edc362aeff213b2be6304296cf43',1,'glfw3.h']]], ['glfw_5fkey_5fo_215',['GLFW_KEY_O',['../group__keys.html#gaecbbb79130df419d58dd7f09a169efe9',1,'glfw3.h']]], ['glfw_5fkey_5fp_216',['GLFW_KEY_P',['../group__keys.html#ga8fc15819c1094fb2afa01d84546b33e1',1,'glfw3.h']]], ['glfw_5fkey_5fpage_5fdown_217',['GLFW_KEY_PAGE_DOWN',['../group__keys.html#gaee0a8fa442001cc2147812f84b59041c',1,'glfw3.h']]], ['glfw_5fkey_5fpage_5fup_218',['GLFW_KEY_PAGE_UP',['../group__keys.html#ga3ab731f9622f0db280178a5f3cc6d586',1,'glfw3.h']]], ['glfw_5fkey_5fpause_219',['GLFW_KEY_PAUSE',['../group__keys.html#ga8116b9692d87382afb5849b6d8907f18',1,'glfw3.h']]], ['glfw_5fkey_5fperiod_220',['GLFW_KEY_PERIOD',['../group__keys.html#ga37e296b650eab419fc474ff69033d927',1,'glfw3.h']]], ['glfw_5fkey_5fprint_5fscreen_221',['GLFW_KEY_PRINT_SCREEN',['../group__keys.html#gaf964c2e65e97d0cf785a5636ee8df642',1,'glfw3.h']]], ['glfw_5fkey_5fq_222',['GLFW_KEY_Q',['../group__keys.html#gafdd01e38b120d67cf51e348bb47f3964',1,'glfw3.h']]], ['glfw_5fkey_5fr_223',['GLFW_KEY_R',['../group__keys.html#ga4ce6c70a0c98c50b3fe4ab9a728d4d36',1,'glfw3.h']]], ['glfw_5fkey_5fright_224',['GLFW_KEY_RIGHT',['../group__keys.html#ga06ba07662e8c291a4a84535379ffc7ac',1,'glfw3.h']]], ['glfw_5fkey_5fright_5falt_225',['GLFW_KEY_RIGHT_ALT',['../group__keys.html#ga687b38009131cfdd07a8d05fff8fa446',1,'glfw3.h']]], ['glfw_5fkey_5fright_5fbracket_226',['GLFW_KEY_RIGHT_BRACKET',['../group__keys.html#ga86ef225fd6a66404caae71044cdd58d8',1,'glfw3.h']]], ['glfw_5fkey_5fright_5fcontrol_227',['GLFW_KEY_RIGHT_CONTROL',['../group__keys.html#gad1ca2094b2694e7251d0ab1fd34f8519',1,'glfw3.h']]], ['glfw_5fkey_5fright_5fshift_228',['GLFW_KEY_RIGHT_SHIFT',['../group__keys.html#gaffca36b99c9dce1a19cb9befbadce691',1,'glfw3.h']]], ['glfw_5fkey_5fright_5fsuper_229',['GLFW_KEY_RIGHT_SUPER',['../group__keys.html#gad4547a3e8e247594acb60423fe6502db',1,'glfw3.h']]], ['glfw_5fkey_5fs_230',['GLFW_KEY_S',['../group__keys.html#ga1570e2ccaab036ea82bed66fc1dab2a9',1,'glfw3.h']]], ['glfw_5fkey_5fscroll_5flock_231',['GLFW_KEY_SCROLL_LOCK',['../group__keys.html#gaf622b63b9537f7084c2ab649b8365630',1,'glfw3.h']]], ['glfw_5fkey_5fsemicolon_232',['GLFW_KEY_SEMICOLON',['../group__keys.html#ga84233de9ee5bb3e8788a5aa07d80af7d',1,'glfw3.h']]], ['glfw_5fkey_5fslash_233',['GLFW_KEY_SLASH',['../group__keys.html#gadf3d753b2d479148d711de34b83fd0db',1,'glfw3.h']]], ['glfw_5fkey_5fspace_234',['GLFW_KEY_SPACE',['../group__keys.html#gaddb2c23772b97fd7e26e8ee66f1ad014',1,'glfw3.h']]], ['glfw_5fkey_5ft_235',['GLFW_KEY_T',['../group__keys.html#ga90e0560422ec7a30e7f3f375bc9f37f9',1,'glfw3.h']]], ['glfw_5fkey_5ftab_236',['GLFW_KEY_TAB',['../group__keys.html#ga6908a4bda9950a3e2b73f794bbe985df',1,'glfw3.h']]], ['glfw_5fkey_5fu_237',['GLFW_KEY_U',['../group__keys.html#gacad52f3bf7d378fc0ffa72a76769256d',1,'glfw3.h']]], ['glfw_5fkey_5funknown_238',['GLFW_KEY_UNKNOWN',['../group__keys.html#ga99aacc875b6b27a072552631e13775c7',1,'glfw3.h']]], ['glfw_5fkey_5fup_239',['GLFW_KEY_UP',['../group__keys.html#ga2f3342b194020d3544c67e3506b6f144',1,'glfw3.h']]], ['glfw_5fkey_5fv_240',['GLFW_KEY_V',['../group__keys.html#ga22c7763899ecf7788862e5f90eacce6b',1,'glfw3.h']]], ['glfw_5fkey_5fw_241',['GLFW_KEY_W',['../group__keys.html#gaa06a712e6202661fc03da5bdb7b6e545',1,'glfw3.h']]], ['glfw_5fkey_5fworld_5f1_242',['GLFW_KEY_WORLD_1',['../group__keys.html#gadc78dad3dab76bcd4b5c20114052577a',1,'glfw3.h']]], ['glfw_5fkey_5fworld_5f2_243',['GLFW_KEY_WORLD_2',['../group__keys.html#ga20494bfebf0bb4fc9503afca18ab2c5e',1,'glfw3.h']]], ['glfw_5fkey_5fx_244',['GLFW_KEY_X',['../group__keys.html#gac1c42c0bf4192cea713c55598b06b744',1,'glfw3.h']]], ['glfw_5fkey_5fy_245',['GLFW_KEY_Y',['../group__keys.html#gafd9f115a549effdf8e372a787c360313',1,'glfw3.h']]], ['glfw_5fkey_5fz_246',['GLFW_KEY_Z',['../group__keys.html#gac489e208c26afda8d4938ed88718760a',1,'glfw3.h']]], ['glfw_5flock_5fkey_5fmods_247',['GLFW_LOCK_KEY_MODS',['../glfw3_8h.html#a07b84de0b52143e1958f88a7d9105947',1,'glfw3.h']]], ['glfw_5flose_5fcontext_5fon_5freset_248',['GLFW_LOSE_CONTEXT_ON_RESET',['../glfw3_8h.html#aec1132f245143fc915b2f0995228564c',1,'glfw3.h']]], ['glfw_5fmaximized_249',['GLFW_MAXIMIZED',['../group__window.html#gad8ccb396253ad0b72c6d4c917eb38a03',1,'glfw3.h']]], ['glfw_5fmod_5falt_250',['GLFW_MOD_ALT',['../group__mods.html#gad2acd5633463c29e07008687ea73c0f4',1,'glfw3.h']]], ['glfw_5fmod_5fcaps_5flock_251',['GLFW_MOD_CAPS_LOCK',['../group__mods.html#gaefeef8fcf825a6e43e241b337897200f',1,'glfw3.h']]], ['glfw_5fmod_5fcontrol_252',['GLFW_MOD_CONTROL',['../group__mods.html#ga6ed94871c3208eefd85713fa929d45aa',1,'glfw3.h']]], ['glfw_5fmod_5fnum_5flock_253',['GLFW_MOD_NUM_LOCK',['../group__mods.html#ga64e020b8a42af8376e944baf61feecbe',1,'glfw3.h']]], ['glfw_5fmod_5fshift_254',['GLFW_MOD_SHIFT',['../group__mods.html#ga14994d3196c290aaa347248e51740274',1,'glfw3.h']]], ['glfw_5fmod_5fsuper_255',['GLFW_MOD_SUPER',['../group__mods.html#ga6b64ba10ea0227cf6f42efd0a220aba1',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f1_256',['GLFW_MOUSE_BUTTON_1',['../group__buttons.html#ga181a6e875251fd8671654eff00f9112e',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f2_257',['GLFW_MOUSE_BUTTON_2',['../group__buttons.html#ga604b39b92c88ce9bd332e97fc3f4156c',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f3_258',['GLFW_MOUSE_BUTTON_3',['../group__buttons.html#ga0130d505563d0236a6f85545f19e1721',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f4_259',['GLFW_MOUSE_BUTTON_4',['../group__buttons.html#ga53f4097bb01d5521c7d9513418c91ca9',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f5_260',['GLFW_MOUSE_BUTTON_5',['../group__buttons.html#gaf08c4ddecb051d3d9667db1d5e417c9c',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f6_261',['GLFW_MOUSE_BUTTON_6',['../group__buttons.html#gae8513e06aab8aa393b595f22c6d8257a',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f7_262',['GLFW_MOUSE_BUTTON_7',['../group__buttons.html#ga8b02a1ab55dde45b3a3883d54ffd7dc7',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5f8_263',['GLFW_MOUSE_BUTTON_8',['../group__buttons.html#ga35d5c4263e0dc0d0a4731ca6c562f32c',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5flast_264',['GLFW_MOUSE_BUTTON_LAST',['../group__buttons.html#gab1fd86a4518a9141ec7bcde2e15a2fdf',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5fleft_265',['GLFW_MOUSE_BUTTON_LEFT',['../group__buttons.html#gaf37100431dcd5082d48f95ee8bc8cd56',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5fmiddle_266',['GLFW_MOUSE_BUTTON_MIDDLE',['../group__buttons.html#ga34a4d2a701434f763fd93a2ff842b95a',1,'glfw3.h']]], ['glfw_5fmouse_5fbutton_5fright_267',['GLFW_MOUSE_BUTTON_RIGHT',['../group__buttons.html#ga3e2f2cf3c4942df73cc094247d275e74',1,'glfw3.h']]], ['glfw_5fnative_5fcontext_5fapi_268',['GLFW_NATIVE_CONTEXT_API',['../glfw3_8h.html#a0494c9bfd3f584ab41e6dbeeaa0e6a19',1,'glfw3.h']]], ['glfw_5fno_5fapi_269',['GLFW_NO_API',['../glfw3_8h.html#a8f6dcdc968d214ff14779564f1389264',1,'glfw3.h']]], ['glfw_5fno_5fcurrent_5fcontext_270',['GLFW_NO_CURRENT_CONTEXT',['../group__errors.html#gaa8290386e9528ccb9e42a3a4e16fc0d0',1,'glfw3.h']]], ['glfw_5fno_5ferror_271',['GLFW_NO_ERROR',['../group__errors.html#gafa30deee5db4d69c4c93d116ed87dbf4',1,'glfw3.h']]], ['glfw_5fno_5freset_5fnotification_272',['GLFW_NO_RESET_NOTIFICATION',['../glfw3_8h.html#aee84a679230d205005e22487ff678a85',1,'glfw3.h']]], ['glfw_5fno_5frobustness_273',['GLFW_NO_ROBUSTNESS',['../glfw3_8h.html#a8b306cb27f5bb0d6d67c7356a0e0fc34',1,'glfw3.h']]], ['glfw_5fno_5fwindow_5fcontext_274',['GLFW_NO_WINDOW_CONTEXT',['../group__errors.html#gacff24d2757da752ae4c80bf452356487',1,'glfw3.h']]], ['glfw_5fnot_5finitialized_275',['GLFW_NOT_INITIALIZED',['../group__errors.html#ga2374ee02c177f12e1fa76ff3ed15e14a',1,'glfw3.h']]], ['glfw_5fopengl_5fany_5fprofile_276',['GLFW_OPENGL_ANY_PROFILE',['../glfw3_8h.html#ad6f2335d6f21cc9bab96633b1c111d5f',1,'glfw3.h']]], ['glfw_5fopengl_5fapi_277',['GLFW_OPENGL_API',['../glfw3_8h.html#a01b3f66db266341425e9abee6b257db2',1,'glfw3.h']]], ['glfw_5fopengl_5fcompat_5fprofile_278',['GLFW_OPENGL_COMPAT_PROFILE',['../glfw3_8h.html#ac06b663d79c8fcf04669cc8fcc0b7670',1,'glfw3.h']]], ['glfw_5fopengl_5fcore_5fprofile_279',['GLFW_OPENGL_CORE_PROFILE',['../glfw3_8h.html#af094bb16da76f66ebceb19ee213b3de8',1,'glfw3.h']]], ['glfw_5fopengl_5fdebug_5fcontext_280',['GLFW_OPENGL_DEBUG_CONTEXT',['../group__window.html#ga87ec2df0b915201e950ca42d5d0831e1',1,'glfw3.h']]], ['glfw_5fopengl_5fes_5fapi_281',['GLFW_OPENGL_ES_API',['../glfw3_8h.html#a28d9b3bc6c2a522d815c8e146595051f',1,'glfw3.h']]], ['glfw_5fopengl_5fforward_5fcompat_282',['GLFW_OPENGL_FORWARD_COMPAT',['../group__window.html#ga13d24b12465da8b28985f46c8557925b',1,'glfw3.h']]], ['glfw_5fopengl_5fprofile_283',['GLFW_OPENGL_PROFILE',['../group__window.html#ga44f3a6b4261fbe351e0b950b0f372e12',1,'glfw3.h']]], ['glfw_5fosmesa_5fcontext_5fapi_284',['GLFW_OSMESA_CONTEXT_API',['../glfw3_8h.html#afd34a473af9fa81f317910ea371b19e3',1,'glfw3.h']]], ['glfw_5fout_5fof_5fmemory_285',['GLFW_OUT_OF_MEMORY',['../group__errors.html#ga9023953a2bcb98c2906afd071d21ee7f',1,'glfw3.h']]], ['glfw_5fplatform_5ferror_286',['GLFW_PLATFORM_ERROR',['../group__errors.html#gad44162d78100ea5e87cdd38426b8c7a1',1,'glfw3.h']]], ['glfw_5fpress_287',['GLFW_PRESS',['../group__input.html#ga2485743d0b59df3791c45951c4195265',1,'glfw3.h']]], ['glfw_5fraw_5fmouse_5fmotion_288',['GLFW_RAW_MOUSE_MOTION',['../glfw3_8h.html#aeeda1be76a44a1fc97c1282e06281fbb',1,'glfw3.h']]], ['glfw_5fred_5fbits_289',['GLFW_RED_BITS',['../group__window.html#gaf78ed8e417dbcc1e354906cc2708c982',1,'glfw3.h']]], ['glfw_5frefresh_5frate_290',['GLFW_REFRESH_RATE',['../group__window.html#ga0f20825e6e47ee8ba389024519682212',1,'glfw3.h']]], ['glfw_5frelease_291',['GLFW_RELEASE',['../group__input.html#gada11d965c4da13090ad336e030e4d11f',1,'glfw3.h']]], ['glfw_5frelease_5fbehavior_5fflush_292',['GLFW_RELEASE_BEHAVIOR_FLUSH',['../glfw3_8h.html#a999961d391db49cb4f949c1dece0e13b',1,'glfw3.h']]], ['glfw_5frelease_5fbehavior_5fnone_293',['GLFW_RELEASE_BEHAVIOR_NONE',['../glfw3_8h.html#afca09088eccacdce4b59036cfae349c5',1,'glfw3.h']]], ['glfw_5frepeat_294',['GLFW_REPEAT',['../group__input.html#gac96fd3b9fc66c6f0eebaf6532595338f',1,'glfw3.h']]], ['glfw_5fresizable_295',['GLFW_RESIZABLE',['../group__window.html#gadba13c7a1b3aa40831eb2beedbd5bd1d',1,'glfw3.h']]], ['glfw_5fsamples_296',['GLFW_SAMPLES',['../group__window.html#ga2cdf86fdcb7722fb8829c4e201607535',1,'glfw3.h']]], ['glfw_5fscale_5fto_5fmonitor_297',['GLFW_SCALE_TO_MONITOR',['../group__window.html#ga620bc4280c7eab81ac9f02204500ed47',1,'glfw3.h']]], ['glfw_5fsrgb_5fcapable_298',['GLFW_SRGB_CAPABLE',['../group__window.html#ga444a8f00414a63220591f9fdb7b5642b',1,'glfw3.h']]], ['glfw_5fstencil_5fbits_299',['GLFW_STENCIL_BITS',['../group__window.html#ga5339890a45a1fb38e93cb9fcc5fd069d',1,'glfw3.h']]], ['glfw_5fstereo_300',['GLFW_STEREO',['../group__window.html#ga83d991efca02537e2d69969135b77b03',1,'glfw3.h']]], ['glfw_5fsticky_5fkeys_301',['GLFW_STICKY_KEYS',['../glfw3_8h.html#ae3bbe2315b7691ab088159eb6c9110fc',1,'glfw3.h']]], ['glfw_5fsticky_5fmouse_5fbuttons_302',['GLFW_STICKY_MOUSE_BUTTONS',['../glfw3_8h.html#a4d7ce8ce71030c3b04e2b78145bc59d1',1,'glfw3.h']]], ['glfw_5ftransparent_5fframebuffer_303',['GLFW_TRANSPARENT_FRAMEBUFFER',['../group__window.html#ga60a0578c3b9449027d683a9c6abb9f14',1,'glfw3.h']]], ['glfw_5ftrue_304',['GLFW_TRUE',['../group__init.html#ga2744fbb29b5631bb28802dbe0cf36eba',1,'glfw3.h']]], ['glfw_5fversion_5fmajor_305',['GLFW_VERSION_MAJOR',['../group__init.html#ga6337d9ea43b22fc529b2bba066b4a576',1,'glfw3.h']]], ['glfw_5fversion_5fminor_306',['GLFW_VERSION_MINOR',['../group__init.html#gaf80d40f0aea7088ff337606e9c48f7a3',1,'glfw3.h']]], ['glfw_5fversion_5frevision_307',['GLFW_VERSION_REVISION',['../group__init.html#gab72ae2e2035d9ea461abc3495eac0502',1,'glfw3.h']]], ['glfw_5fversion_5funavailable_308',['GLFW_VERSION_UNAVAILABLE',['../group__errors.html#gad16c5565b4a69f9c2a9ac2c0dbc89462',1,'glfw3.h']]], ['glfw_5fvisible_309',['GLFW_VISIBLE',['../group__window.html#gafb3cdc45297e06d8f1eb13adc69ca6c4',1,'glfw3.h']]], ['glfw_5fvresize_5fcursor_310',['GLFW_VRESIZE_CURSOR',['../group__shapes.html#gaf024f0e1ff8366fb2b5c260509a1fce5',1,'glfw3.h']]], ['glfw_5fx11_5fclass_5fname_311',['GLFW_X11_CLASS_NAME',['../group__window.html#gae5a9ea2fccccd92edbd343fc56461114',1,'glfw3.h']]], ['glfw_5fx11_5finstance_5fname_312',['GLFW_X11_INSTANCE_NAME',['../group__window.html#ga494c3c0d911e4b860b946530a3e389e8',1,'glfw3.h']]], ['glfwcharfun_313',['GLFWcharfun',['../group__input.html#gabf24451c7ceb1952bc02b17a0d5c3e5f',1,'glfw3.h']]], ['glfwcharmodsfun_314',['GLFWcharmodsfun',['../group__input.html#gae36fb6897d2b7df9b128900c8ce9c507',1,'glfw3.h']]], ['glfwcreatecursor_315',['glfwCreateCursor',['../group__input.html#gafca356935e10135016aa49ffa464c355',1,'glfw3.h']]], ['glfwcreatestandardcursor_316',['glfwCreateStandardCursor',['../group__input.html#gaa65f416d03ebbbb5b8db71a489fcb894',1,'glfw3.h']]], ['glfwcreatewindow_317',['glfwCreateWindow',['../group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344',1,'glfw3.h']]], ['glfwcreatewindowsurface_318',['glfwCreateWindowSurface',['../group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965',1,'glfw3.h']]], ['glfwcursor_319',['GLFWcursor',['../group__input.html#ga89261ae18c75e863aaf2656ecdd238f4',1,'glfw3.h']]], ['glfwcursorenterfun_320',['GLFWcursorenterfun',['../group__input.html#ga51ab436c41eeaed6db5a0c9403b1c840',1,'glfw3.h']]], ['glfwcursorposfun_321',['GLFWcursorposfun',['../group__input.html#ga4cfad918fa836f09541e7b9acd36686c',1,'glfw3.h']]], ['glfwdefaultwindowhints_322',['glfwDefaultWindowHints',['../group__window.html#gaa77c4898dfb83344a6b4f76aa16b9a4a',1,'glfw3.h']]], ['glfwdestroycursor_323',['glfwDestroyCursor',['../group__input.html#ga81b952cd1764274d0db7fb3c5a79ba6a',1,'glfw3.h']]], ['glfwdestroywindow_324',['glfwDestroyWindow',['../group__window.html#gacdf43e51376051d2c091662e9fe3d7b2',1,'glfw3.h']]], ['glfwdropfun_325',['GLFWdropfun',['../group__input.html#gafd0493dc32cd5ca5810e6148c0c026ea',1,'glfw3.h']]], ['glfwerrorfun_326',['GLFWerrorfun',['../group__init.html#ga6b8a2639706d5c409fc1287e8f55e928',1,'glfw3.h']]], ['glfwextensionsupported_327',['glfwExtensionSupported',['../group__context.html#ga87425065c011cef1ebd6aac75e059dfa',1,'glfw3.h']]], ['glfwfocuswindow_328',['glfwFocusWindow',['../group__window.html#ga873780357abd3f3a081d71a40aae45a1',1,'glfw3.h']]], ['glfwframebuffersizefun_329',['GLFWframebuffersizefun',['../group__window.html#ga3e218ef9ff826129c55a7d5f6971a285',1,'glfw3.h']]], ['glfwgamepadstate_330',['GLFWgamepadstate',['../structGLFWgamepadstate.html',1,'GLFWgamepadstate'],['../group__input.html#ga0b86867abb735af3b959f61c44b1d029',1,'GLFWgamepadstate(): glfw3.h']]], ['glfwgammaramp_331',['GLFWgammaramp',['../structGLFWgammaramp.html',1,'GLFWgammaramp'],['../group__monitor.html#gaec0bd37af673be8813592849f13e02f0',1,'GLFWgammaramp(): glfw3.h']]], ['glfwgetclipboardstring_332',['glfwGetClipboardString',['../group__input.html#ga5aba1d704d9ab539282b1fbe9f18bb94',1,'glfw3.h']]], ['glfwgetcocoamonitor_333',['glfwGetCocoaMonitor',['../group__native.html#gaf22f429aec4b1aab316142d66d9be3e6',1,'glfw3native.h']]], ['glfwgetcocoawindow_334',['glfwGetCocoaWindow',['../group__native.html#gac3ed9d495d0c2bb9652de5a50c648715',1,'glfw3native.h']]], ['glfwgetcurrentcontext_335',['glfwGetCurrentContext',['../group__context.html#gac84759b1f6c2d271a4fea8ae89ec980d',1,'glfw3.h']]], ['glfwgetcursorpos_336',['glfwGetCursorPos',['../group__input.html#ga01d37b6c40133676b9cea60ca1d7c0cc',1,'glfw3.h']]], ['glfwgeteglcontext_337',['glfwGetEGLContext',['../group__native.html#ga671c5072becd085f4ab5771a9c8efcf1',1,'glfw3native.h']]], ['glfwgetegldisplay_338',['glfwGetEGLDisplay',['../group__native.html#ga1cd8d973f47aacb5532d368147cc3138',1,'glfw3native.h']]], ['glfwgeteglsurface_339',['glfwGetEGLSurface',['../group__native.html#ga2199b36117a6a695fec8441d8052eee6',1,'glfw3native.h']]], ['glfwgeterror_340',['glfwGetError',['../group__init.html#ga944986b4ec0b928d488141f92982aa18',1,'glfw3.h']]], ['glfwgetframebuffersize_341',['glfwGetFramebufferSize',['../group__window.html#ga0e2637a4161afb283f5300c7f94785c9',1,'glfw3.h']]], ['glfwgetgamepadname_342',['glfwGetGamepadName',['../group__input.html#ga5c71e3533b2d384db9317fcd7661b210',1,'glfw3.h']]], ['glfwgetgamepadstate_343',['glfwGetGamepadState',['../group__input.html#gadccddea8bce6113fa459de379ddaf051',1,'glfw3.h']]], ['glfwgetgammaramp_344',['glfwGetGammaRamp',['../group__monitor.html#gab7c41deb2219bde3e1eb756ddaa9ec80',1,'glfw3.h']]], ['glfwgetglxcontext_345',['glfwGetGLXContext',['../group__native.html#ga62d884114b0abfcdc2930e89f20867e2',1,'glfw3native.h']]], ['glfwgetglxwindow_346',['glfwGetGLXWindow',['../group__native.html#ga1ed27b8766e859a21381e8f8ce18d049',1,'glfw3native.h']]], ['glfwgetinputmode_347',['glfwGetInputMode',['../group__input.html#gaf5b859dbe19bdf434e42695ea45cc5f4',1,'glfw3.h']]], ['glfwgetinstanceprocaddress_348',['glfwGetInstanceProcAddress',['../group__vulkan.html#gadf228fac94c5fd8f12423ec9af9ff1e9',1,'glfw3.h']]], ['glfwgetjoystickaxes_349',['glfwGetJoystickAxes',['../group__input.html#gaa8806536731e92c061bc70bcff6edbd0',1,'glfw3.h']]], ['glfwgetjoystickbuttons_350',['glfwGetJoystickButtons',['../group__input.html#gadb3cbf44af90a1536f519659a53bddd6',1,'glfw3.h']]], ['glfwgetjoystickguid_351',['glfwGetJoystickGUID',['../group__input.html#gae168c2c0b8cf2a1cb67c6b3c00bdd543',1,'glfw3.h']]], ['glfwgetjoystickhats_352',['glfwGetJoystickHats',['../group__input.html#ga2d8d0634bb81c180899aeb07477a67ea',1,'glfw3.h']]], ['glfwgetjoystickname_353',['glfwGetJoystickName',['../group__input.html#gafbe3e51f670320908cfe4e20d3e5559e',1,'glfw3.h']]], ['glfwgetjoystickuserpointer_354',['glfwGetJoystickUserPointer',['../group__input.html#ga06290acb7ed23895bf26b8e981827ebd',1,'glfw3.h']]], ['glfwgetkey_355',['glfwGetKey',['../group__input.html#gadd341da06bc8d418b4dc3a3518af9ad2',1,'glfw3.h']]], ['glfwgetkeyname_356',['glfwGetKeyName',['../group__input.html#ga237a182e5ec0b21ce64543f3b5e7e2be',1,'glfw3.h']]], ['glfwgetkeyscancode_357',['glfwGetKeyScancode',['../group__input.html#ga67ddd1b7dcbbaff03e4a76c0ea67103a',1,'glfw3.h']]], ['glfwgetmonitorcontentscale_358',['glfwGetMonitorContentScale',['../group__monitor.html#gad3152e84465fa620b601265ebfcdb21b',1,'glfw3.h']]], ['glfwgetmonitorname_359',['glfwGetMonitorName',['../group__monitor.html#ga79a34ee22ff080ca954a9663e4679daf',1,'glfw3.h']]], ['glfwgetmonitorphysicalsize_360',['glfwGetMonitorPhysicalSize',['../group__monitor.html#ga7d8bffc6c55539286a6bd20d32a8d7ea',1,'glfw3.h']]], ['glfwgetmonitorpos_361',['glfwGetMonitorPos',['../group__monitor.html#ga102f54e7acc9149edbcf0997152df8c9',1,'glfw3.h']]], ['glfwgetmonitors_362',['glfwGetMonitors',['../group__monitor.html#ga3fba51c8bd36491d4712aa5bd074a537',1,'glfw3.h']]], ['glfwgetmonitoruserpointer_363',['glfwGetMonitorUserPointer',['../group__monitor.html#gac2d4209016b049222877f620010ed0d8',1,'glfw3.h']]], ['glfwgetmonitorworkarea_364',['glfwGetMonitorWorkarea',['../group__monitor.html#ga7387a3bdb64bfe8ebf2b9e54f5b6c9d0',1,'glfw3.h']]], ['glfwgetmousebutton_365',['glfwGetMouseButton',['../group__input.html#gac1473feacb5996c01a7a5a33b5066704',1,'glfw3.h']]], ['glfwgetnsglcontext_366',['glfwGetNSGLContext',['../group__native.html#ga559e002e3cd63c979881770cd4dc63bc',1,'glfw3native.h']]], ['glfwgetosmesacolorbuffer_367',['glfwGetOSMesaColorBuffer',['../group__native.html#ga3b36e3e3dcf308b776427b6bd73cc132',1,'glfw3native.h']]], ['glfwgetosmesacontext_368',['glfwGetOSMesaContext',['../group__native.html#ga9e47700080094eb569cb053afaa88773',1,'glfw3native.h']]], ['glfwgetosmesadepthbuffer_369',['glfwGetOSMesaDepthBuffer',['../group__native.html#ga6b64039ffc88a7a2f57f0956c0c75d53',1,'glfw3native.h']]], ['glfwgetphysicaldevicepresentationsupport_370',['glfwGetPhysicalDevicePresentationSupport',['../group__vulkan.html#gaff3823355cdd7e2f3f9f4d9ea9518d92',1,'glfw3.h']]], ['glfwgetprimarymonitor_371',['glfwGetPrimaryMonitor',['../group__monitor.html#ga721867d84c6d18d6790d64d2847ca0b1',1,'glfw3.h']]], ['glfwgetprocaddress_372',['glfwGetProcAddress',['../group__context.html#ga35f1837e6f666781842483937612f163',1,'glfw3.h']]], ['glfwgetrequiredinstanceextensions_373',['glfwGetRequiredInstanceExtensions',['../group__vulkan.html#ga1abcbe61033958f22f63ef82008874b1',1,'glfw3.h']]], ['glfwgettime_374',['glfwGetTime',['../group__input.html#gaa6cf4e7a77158a3b8fd00328b1720a4a',1,'glfw3.h']]], ['glfwgettimerfrequency_375',['glfwGetTimerFrequency',['../group__input.html#ga3289ee876572f6e91f06df3a24824443',1,'glfw3.h']]], ['glfwgettimervalue_376',['glfwGetTimerValue',['../group__input.html#ga09b2bd37d328e0b9456c7ec575cc26aa',1,'glfw3.h']]], ['glfwgetversion_377',['glfwGetVersion',['../group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197',1,'glfw3.h']]], ['glfwgetversionstring_378',['glfwGetVersionString',['../group__init.html#ga23d47dc013fce2bf58036da66079a657',1,'glfw3.h']]], ['glfwgetvideomode_379',['glfwGetVideoMode',['../group__monitor.html#gafc1bb972a921ad5b3bd5d63a95fc2d52',1,'glfw3.h']]], ['glfwgetvideomodes_380',['glfwGetVideoModes',['../group__monitor.html#ga820b0ce9a5237d645ea7cbb4bd383458',1,'glfw3.h']]], ['glfwgetwaylanddisplay_381',['glfwGetWaylandDisplay',['../group__native.html#gaaf8118a3c877f3a6bc8e7a649519de5e',1,'glfw3native.h']]], ['glfwgetwaylandmonitor_382',['glfwGetWaylandMonitor',['../group__native.html#gab10427a667b6cd91eec7709f7a906bd3',1,'glfw3native.h']]], ['glfwgetwaylandwindow_383',['glfwGetWaylandWindow',['../group__native.html#ga4738d7aca4191363519a9a641c3ab64c',1,'glfw3native.h']]], ['glfwgetwglcontext_384',['glfwGetWGLContext',['../group__native.html#gadc4010d91d9cc1134d040eeb1202a143',1,'glfw3native.h']]], ['glfwgetwin32adapter_385',['glfwGetWin32Adapter',['../group__native.html#gac84f63a3f9db145b9435e5e0dbc4183d',1,'glfw3native.h']]], ['glfwgetwin32monitor_386',['glfwGetWin32Monitor',['../group__native.html#gac408b09a330749402d5d1fa1f5894dd9',1,'glfw3native.h']]], ['glfwgetwin32window_387',['glfwGetWin32Window',['../group__native.html#gafe5079aa79038b0079fc09d5f0a8e667',1,'glfw3native.h']]], ['glfwgetwindowattrib_388',['glfwGetWindowAttrib',['../group__window.html#gacccb29947ea4b16860ebef42c2cb9337',1,'glfw3.h']]], ['glfwgetwindowcontentscale_389',['glfwGetWindowContentScale',['../group__window.html#gaf5d31de9c19c4f994facea64d2b3106c',1,'glfw3.h']]], ['glfwgetwindowframesize_390',['glfwGetWindowFrameSize',['../group__window.html#ga1a9fd382058c53101b21cf211898f1f1',1,'glfw3.h']]], ['glfwgetwindowmonitor_391',['glfwGetWindowMonitor',['../group__window.html#gaeac25e64789974ccbe0811766bd91a16',1,'glfw3.h']]], ['glfwgetwindowopacity_392',['glfwGetWindowOpacity',['../group__window.html#gad09f0bd7a6307c4533b7061828480a84',1,'glfw3.h']]], ['glfwgetwindowpos_393',['glfwGetWindowPos',['../group__window.html#ga73cb526c000876fd8ddf571570fdb634',1,'glfw3.h']]], ['glfwgetwindowsize_394',['glfwGetWindowSize',['../group__window.html#gaeea7cbc03373a41fb51cfbf9f2a5d4c6',1,'glfw3.h']]], ['glfwgetwindowuserpointer_395',['glfwGetWindowUserPointer',['../group__window.html#ga17807ce0f45ac3f8bb50d6dcc59a4e06',1,'glfw3.h']]], ['glfwgetx11adapter_396',['glfwGetX11Adapter',['../group__native.html#ga088fbfa80f50569402b41be71ad66e40',1,'glfw3native.h']]], ['glfwgetx11display_397',['glfwGetX11Display',['../group__native.html#ga8519b66594ea3ef6eeafaa2e3ee37406',1,'glfw3native.h']]], ['glfwgetx11monitor_398',['glfwGetX11Monitor',['../group__native.html#gab2f8cc043905e9fa9b12bfdbbcfe874c',1,'glfw3native.h']]], ['glfwgetx11selectionstring_399',['glfwGetX11SelectionString',['../group__native.html#ga72f23e3980b83788c70aa854eca31430',1,'glfw3native.h']]], ['glfwgetx11window_400',['glfwGetX11Window',['../group__native.html#ga90ca676322740842db446999a1b1f21d',1,'glfw3native.h']]], ['glfwglproc_401',['GLFWglproc',['../group__context.html#ga3d47c2d2fbe0be9c505d0e04e91a133c',1,'glfw3.h']]], ['glfwhidewindow_402',['glfwHideWindow',['../group__window.html#ga49401f82a1ba5f15db5590728314d47c',1,'glfw3.h']]], ['glfwiconifywindow_403',['glfwIconifyWindow',['../group__window.html#ga1bb559c0ebaad63c5c05ad2a066779c4',1,'glfw3.h']]], ['glfwimage_404',['GLFWimage',['../structGLFWimage.html',1,'GLFWimage'],['../group__window.html#gac81c32f4437de7b3aa58ab62c3d9e5b1',1,'GLFWimage(): glfw3.h']]], ['glfwinit_405',['glfwInit',['../group__init.html#ga317aac130a235ab08c6db0834907d85e',1,'glfw3.h']]], ['glfwinithint_406',['glfwInitHint',['../group__init.html#ga110fd1d3f0412822b4f1908c026f724a',1,'glfw3.h']]], ['glfwjoystickfun_407',['GLFWjoystickfun',['../group__input.html#gaa67aa597e974298c748bfe4fb17d406d',1,'glfw3.h']]], ['glfwjoystickisgamepad_408',['glfwJoystickIsGamepad',['../group__input.html#gad0f676860f329d80f7e47e9f06a96f00',1,'glfw3.h']]], ['glfwjoystickpresent_409',['glfwJoystickPresent',['../group__input.html#gaed0966cee139d815317f9ffcba64c9f1',1,'glfw3.h']]], ['glfwkeyfun_410',['GLFWkeyfun',['../group__input.html#ga0192a232a41e4e82948217c8ba94fdfd',1,'glfw3.h']]], ['glfwmakecontextcurrent_411',['glfwMakeContextCurrent',['../group__context.html#ga1c04dc242268f827290fe40aa1c91157',1,'glfw3.h']]], ['glfwmaximizewindow_412',['glfwMaximizeWindow',['../group__window.html#ga3f541387449d911274324ae7f17ec56b',1,'glfw3.h']]], ['glfwmonitor_413',['GLFWmonitor',['../group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3',1,'glfw3.h']]], ['glfwmonitorfun_414',['GLFWmonitorfun',['../group__monitor.html#ga8a7ee579a66720f24d656526f3e44c63',1,'glfw3.h']]], ['glfwmousebuttonfun_415',['GLFWmousebuttonfun',['../group__input.html#ga39893a4a7e7c3239c98d29c9e084350c',1,'glfw3.h']]], ['glfwpollevents_416',['glfwPollEvents',['../group__window.html#ga37bd57223967b4211d60ca1a0bf3c832',1,'glfw3.h']]], ['glfwpostemptyevent_417',['glfwPostEmptyEvent',['../group__window.html#gab5997a25187e9fd5c6f2ecbbc8dfd7e9',1,'glfw3.h']]], ['glfwrawmousemotionsupported_418',['glfwRawMouseMotionSupported',['../group__input.html#gae4ee0dbd0d256183e1ea4026d897e1c2',1,'glfw3.h']]], ['glfwrequestwindowattention_419',['glfwRequestWindowAttention',['../group__window.html#ga2f8d59323fc4692c1d54ba08c863a703',1,'glfw3.h']]], ['glfwrestorewindow_420',['glfwRestoreWindow',['../group__window.html#ga52527a5904b47d802b6b4bb519cdebc7',1,'glfw3.h']]], ['glfwscrollfun_421',['GLFWscrollfun',['../group__input.html#ga4687e2199c60a18a8dd1da532e6d75c9',1,'glfw3.h']]], ['glfwsetcharcallback_422',['glfwSetCharCallback',['../group__input.html#gab25c4a220fd8f5717718dbc487828996',1,'glfw3.h']]], ['glfwsetcharmodscallback_423',['glfwSetCharModsCallback',['../group__input.html#ga0b7f4ad13c2b17435ff13b6dcfb4e43c',1,'glfw3.h']]], ['glfwsetclipboardstring_424',['glfwSetClipboardString',['../group__input.html#gaba1f022c5eb07dfac421df34cdcd31dd',1,'glfw3.h']]], ['glfwsetcursor_425',['glfwSetCursor',['../group__input.html#gad3b4f38c8d5dae036bc8fa959e18343e',1,'glfw3.h']]], ['glfwsetcursorentercallback_426',['glfwSetCursorEnterCallback',['../group__input.html#gad27f8ad0142c038a281466c0966817d8',1,'glfw3.h']]], ['glfwsetcursorpos_427',['glfwSetCursorPos',['../group__input.html#ga04b03af936d906ca123c8f4ee08b39e7',1,'glfw3.h']]], ['glfwsetcursorposcallback_428',['glfwSetCursorPosCallback',['../group__input.html#gac1f879ab7435d54d4d79bb469fe225d7',1,'glfw3.h']]], ['glfwsetdropcallback_429',['glfwSetDropCallback',['../group__input.html#gab773f0ee0a07cff77a210cea40bc1f6b',1,'glfw3.h']]], ['glfwseterrorcallback_430',['glfwSetErrorCallback',['../group__init.html#gaff45816610d53f0b83656092a4034f40',1,'glfw3.h']]], ['glfwsetframebuffersizecallback_431',['glfwSetFramebufferSizeCallback',['../group__window.html#gab3fb7c3366577daef18c0023e2a8591f',1,'glfw3.h']]], ['glfwsetgamma_432',['glfwSetGamma',['../group__monitor.html#ga6ac582625c990220785ddd34efa3169a',1,'glfw3.h']]], ['glfwsetgammaramp_433',['glfwSetGammaRamp',['../group__monitor.html#ga583f0ffd0d29613d8cd172b996bbf0dd',1,'glfw3.h']]], ['glfwsetinputmode_434',['glfwSetInputMode',['../group__input.html#gaa92336e173da9c8834558b54ee80563b',1,'glfw3.h']]], ['glfwsetjoystickcallback_435',['glfwSetJoystickCallback',['../group__input.html#ga2f60a0e5b7bd8d1b7344dc0a7cb32b4c',1,'glfw3.h']]], ['glfwsetjoystickuserpointer_436',['glfwSetJoystickUserPointer',['../group__input.html#ga6b2f72d64d636b48a727b437cbb7489e',1,'glfw3.h']]], ['glfwsetkeycallback_437',['glfwSetKeyCallback',['../group__input.html#ga1caf18159767e761185e49a3be019f8d',1,'glfw3.h']]], ['glfwsetmonitorcallback_438',['glfwSetMonitorCallback',['../group__monitor.html#gab39df645587c8518192aa746c2fb06c3',1,'glfw3.h']]], ['glfwsetmonitoruserpointer_439',['glfwSetMonitorUserPointer',['../group__monitor.html#ga702750e24313a686d3637297b6e85fda',1,'glfw3.h']]], ['glfwsetmousebuttoncallback_440',['glfwSetMouseButtonCallback',['../group__input.html#ga6ab84420974d812bee700e45284a723c',1,'glfw3.h']]], ['glfwsetscrollcallback_441',['glfwSetScrollCallback',['../group__input.html#ga571e45a030ae4061f746ed56cb76aede',1,'glfw3.h']]], ['glfwsettime_442',['glfwSetTime',['../group__input.html#gaf59589ef6e8b8c8b5ad184b25afd4dc0',1,'glfw3.h']]], ['glfwsetwindowaspectratio_443',['glfwSetWindowAspectRatio',['../group__window.html#ga72ac8cb1ee2e312a878b55153d81b937',1,'glfw3.h']]], ['glfwsetwindowattrib_444',['glfwSetWindowAttrib',['../group__window.html#gace2afda29b4116ec012e410a6819033e',1,'glfw3.h']]], ['glfwsetwindowclosecallback_445',['glfwSetWindowCloseCallback',['../group__window.html#gada646d775a7776a95ac000cfc1885331',1,'glfw3.h']]], ['glfwsetwindowcontentscalecallback_446',['glfwSetWindowContentScaleCallback',['../group__window.html#gaf2832ebb5aa6c252a2d261de002c92d6',1,'glfw3.h']]], ['glfwsetwindowfocuscallback_447',['glfwSetWindowFocusCallback',['../group__window.html#gac2d83c4a10f071baf841f6730528e66c',1,'glfw3.h']]], ['glfwsetwindowicon_448',['glfwSetWindowIcon',['../group__window.html#gadd7ccd39fe7a7d1f0904666ae5932dc5',1,'glfw3.h']]], ['glfwsetwindowiconifycallback_449',['glfwSetWindowIconifyCallback',['../group__window.html#gac793e9efd255567b5fb8b445052cfd3e',1,'glfw3.h']]], ['glfwsetwindowmaximizecallback_450',['glfwSetWindowMaximizeCallback',['../group__window.html#gacbe64c339fbd94885e62145563b6dc93',1,'glfw3.h']]], ['glfwsetwindowmonitor_451',['glfwSetWindowMonitor',['../group__window.html#ga81c76c418af80a1cce7055bccb0ae0a7',1,'glfw3.h']]], ['glfwsetwindowopacity_452',['glfwSetWindowOpacity',['../group__window.html#gac31caeb3d1088831b13d2c8a156802e9',1,'glfw3.h']]], ['glfwsetwindowpos_453',['glfwSetWindowPos',['../group__window.html#ga1abb6d690e8c88e0c8cd1751356dbca8',1,'glfw3.h']]], ['glfwsetwindowposcallback_454',['glfwSetWindowPosCallback',['../group__window.html#ga08bdfbba88934f9c4f92fd757979ac74',1,'glfw3.h']]], ['glfwsetwindowrefreshcallback_455',['glfwSetWindowRefreshCallback',['../group__window.html#ga1c5c7eb889c33c7f4d10dd35b327654e',1,'glfw3.h']]], ['glfwsetwindowshouldclose_456',['glfwSetWindowShouldClose',['../group__window.html#ga49c449dde2a6f87d996f4daaa09d6708',1,'glfw3.h']]], ['glfwsetwindowsize_457',['glfwSetWindowSize',['../group__window.html#ga371911f12c74c504dd8d47d832d095cb',1,'glfw3.h']]], ['glfwsetwindowsizecallback_458',['glfwSetWindowSizeCallback',['../group__window.html#gad91b8b047a0c4c6033c38853864c34f8',1,'glfw3.h']]], ['glfwsetwindowsizelimits_459',['glfwSetWindowSizeLimits',['../group__window.html#gac314fa6cec7d2d307be9963e2709cc90',1,'glfw3.h']]], ['glfwsetwindowtitle_460',['glfwSetWindowTitle',['../group__window.html#ga5d877f09e968cef7a360b513306f17ff',1,'glfw3.h']]], ['glfwsetwindowuserpointer_461',['glfwSetWindowUserPointer',['../group__window.html#ga3d2fc6026e690ab31a13f78bc9fd3651',1,'glfw3.h']]], ['glfwsetx11selectionstring_462',['glfwSetX11SelectionString',['../group__native.html#ga55f879ab02d93367f966186b6f0133f7',1,'glfw3native.h']]], ['glfwshowwindow_463',['glfwShowWindow',['../group__window.html#ga61be47917b72536a148300f46494fc66',1,'glfw3.h']]], ['glfwswapbuffers_464',['glfwSwapBuffers',['../group__window.html#ga15a5a1ee5b3c2ca6b15ca209a12efd14',1,'glfw3.h']]], ['glfwswapinterval_465',['glfwSwapInterval',['../group__context.html#ga6d4e0cdf151b5e579bd67f13202994ed',1,'glfw3.h']]], ['glfwterminate_466',['glfwTerminate',['../group__init.html#gaaae48c0a18607ea4a4ba951d939f0901',1,'glfw3.h']]], ['glfwupdategamepadmappings_467',['glfwUpdateGamepadMappings',['../group__input.html#gaed5104612f2fa8e66aa6e846652ad00f',1,'glfw3.h']]], ['glfwvidmode_468',['GLFWvidmode',['../structGLFWvidmode.html',1,'GLFWvidmode'],['../group__monitor.html#gae48aadf4ea0967e6605c8f58fa5daccb',1,'GLFWvidmode(): glfw3.h']]], ['glfwvkproc_469',['GLFWvkproc',['../group__vulkan.html#ga70c01918dc9d233a4fbe0681a43018af',1,'glfw3.h']]], ['glfwvulkansupported_470',['glfwVulkanSupported',['../group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b',1,'glfw3.h']]], ['glfwwaitevents_471',['glfwWaitEvents',['../group__window.html#ga554e37d781f0a997656c26b2c56c835e',1,'glfw3.h']]], ['glfwwaiteventstimeout_472',['glfwWaitEventsTimeout',['../group__window.html#ga605a178db92f1a7f1a925563ef3ea2cf',1,'glfw3.h']]], ['glfwwindow_473',['GLFWwindow',['../group__window.html#ga3c96d80d363e67d13a41b5d1821f3242',1,'glfw3.h']]], ['glfwwindowclosefun_474',['GLFWwindowclosefun',['../group__window.html#ga93e7c2555bd837f4ed8b20f76cada72e',1,'glfw3.h']]], ['glfwwindowcontentscalefun_475',['GLFWwindowcontentscalefun',['../group__window.html#ga1da46b65eafcc1a7ff0adb8f4a7b72fd',1,'glfw3.h']]], ['glfwwindowfocusfun_476',['GLFWwindowfocusfun',['../group__window.html#ga58be2061828dd35080bb438405d3a7e2',1,'glfw3.h']]], ['glfwwindowhint_477',['glfwWindowHint',['../group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033',1,'glfw3.h']]], ['glfwwindowhintstring_478',['glfwWindowHintString',['../group__window.html#ga8cb2782861c9d997bcf2dea97f363e5f',1,'glfw3.h']]], ['glfwwindowiconifyfun_479',['GLFWwindowiconifyfun',['../group__window.html#gad2d4e4c3d28b1242e742e8268b9528af',1,'glfw3.h']]], ['glfwwindowmaximizefun_480',['GLFWwindowmaximizefun',['../group__window.html#ga7269a3d1cb100c0081f95fc09afa4949',1,'glfw3.h']]], ['glfwwindowposfun_481',['GLFWwindowposfun',['../group__window.html#gafd8db81fdb0e850549dc6bace5ed697a',1,'glfw3.h']]], ['glfwwindowrefreshfun_482',['GLFWwindowrefreshfun',['../group__window.html#ga7a56f9e0227e2cd9470d80d919032e08',1,'glfw3.h']]], ['glfwwindowshouldclose_483',['glfwWindowShouldClose',['../group__window.html#ga24e02fbfefbb81fc45320989f8140ab5',1,'glfw3.h']]], ['glfwwindowsizefun_484',['GLFWwindowsizefun',['../group__window.html#gae49ee6ebc03fa2da024b89943a331355',1,'glfw3.h']]], ['green_485',['green',['../structGLFWgammaramp.html#affccc6f5df47820b6562d709da3a5a3a',1,'GLFWgammaramp']]], ['greenbits_486',['greenBits',['../structGLFWvidmode.html#a292fdd281f3485fb3ff102a5bda43faa',1,'GLFWvidmode']]], ['getting_20started_487',['Getting started',['../quick_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_6.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_6.js ================================================ var searchData= [ ['height_488',['height',['../structGLFWvidmode.html#ac65942a5f6981695517437a9d571d03c',1,'GLFWvidmode::height()'],['../structGLFWimage.html#a0b7d95368f0c80d5e5c9875057c7dbec',1,'GLFWimage::height()']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_7.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_7.js ================================================ var searchData= [ ['initialization_2c_20version_20and_20error_20reference_489',['Initialization, version and error reference',['../group__init.html',1,'']]], ['input_20reference_490',['Input reference',['../group__input.html',1,'']]], ['input_2edox_491',['input.dox',['../input_8dox.html',1,'']]], ['input_20guide_492',['Input guide',['../input_guide.html',1,'']]], ['internal_2edox_493',['internal.dox',['../internal_8dox.html',1,'']]], ['internal_20structure_494',['Internal structure',['../internals_guide.html',1,'']]], ['intro_2edox_495',['intro.dox',['../intro_8dox.html',1,'']]], ['introduction_20to_20the_20api_496',['Introduction to the API',['../intro_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_8.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_8.js ================================================ var searchData= [ ['joystick_20hat_20states_497',['Joystick hat states',['../group__hat__state.html',1,'']]], ['joysticks_498',['Joysticks',['../group__joysticks.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_9.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_9.js ================================================ var searchData= [ ['keyboard_20keys_499',['Keyboard keys',['../group__keys.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_a.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_a.js ================================================ var searchData= [ ['mouse_20buttons_500',['Mouse buttons',['../group__buttons.html',1,'']]], ['main_2edox_501',['main.dox',['../main_8dox.html',1,'']]], ['modifier_20key_20flags_502',['Modifier key flags',['../group__mods.html',1,'']]], ['monitor_20reference_503',['Monitor reference',['../group__monitor.html',1,'']]], ['monitor_2edox_504',['monitor.dox',['../monitor_8dox.html',1,'']]], ['monitor_20guide_505',['Monitor guide',['../monitor_guide.html',1,'']]], ['moving_2edox_506',['moving.dox',['../moving_8dox.html',1,'']]], ['moving_20from_20glfw_202_20to_203_507',['Moving from GLFW 2 to 3',['../moving_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_b.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_b.js ================================================ var searchData= [ ['notitle_508',['notitle',['../index.html',1,'']]], ['native_20access_509',['Native access',['../group__native.html',1,'']]], ['news_2edox_510',['news.dox',['../news_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_c.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_c.js ================================================ var searchData= [ ['pixels_511',['pixels',['../structGLFWimage.html#a0c532a5c2bb715555279b7817daba0fb',1,'GLFWimage']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_d.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_d.js ================================================ var searchData= [ ['quick_2edox_512',['quick.dox',['../quick_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_e.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_e.js ================================================ var searchData= [ ['release_20notes_513',['Release notes',['../news.html',1,'']]], ['red_514',['red',['../structGLFWgammaramp.html#a2cce5d968734b685623eef913e635138',1,'GLFWgammaramp']]], ['redbits_515',['redBits',['../structGLFWvidmode.html#a6066c4ecd251098700062d3b735dba1b',1,'GLFWvidmode']]], ['refreshrate_516',['refreshRate',['../structGLFWvidmode.html#a791bdd6c7697b09f7e9c97054bf05649',1,'GLFWvidmode']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/all_f.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/all_f.js ================================================ var searchData= [ ['standards_20conformance_517',['Standards conformance',['../compat_guide.html',1,'']]], ['standard_20cursor_20shapes_518',['Standard cursor shapes',['../group__shapes.html',1,'']]], ['size_519',['size',['../structGLFWgammaramp.html#ad620e1cffbff9a32c51bca46301b59a5',1,'GLFWgammaramp']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/classes_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/classes_0.js ================================================ var searchData= [ ['glfwgamepadstate_527',['GLFWgamepadstate',['../structGLFWgamepadstate.html',1,'']]], ['glfwgammaramp_528',['GLFWgammaramp',['../structGLFWgammaramp.html',1,'']]], ['glfwimage_529',['GLFWimage',['../structGLFWimage.html',1,'']]], ['glfwvidmode_530',['GLFWvidmode',['../structGLFWvidmode.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/defines_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/defines_0.js ================================================ var searchData= [ ['glapientry_732',['GLAPIENTRY',['../glfw3_8h.html#aa97755eb47e4bf2727ad45d610e18206',1,'glfw3.h']]], ['glfw_5fany_5frelease_5fbehavior_733',['GLFW_ANY_RELEASE_BEHAVIOR',['../glfw3_8h.html#a6b47d806f285efe9bfd7aeec667297ee',1,'glfw3.h']]], ['glfw_5fapientry_5fdefined_734',['GLFW_APIENTRY_DEFINED',['../glfw3_8h.html#a8a8538c5500308b4211844f2fb26c7b9',1,'glfw3.h']]], ['glfw_5fconnected_735',['GLFW_CONNECTED',['../glfw3_8h.html#abe11513fd1ffbee5bb9b173f06028b9e',1,'glfw3.h']]], ['glfw_5fcursor_736',['GLFW_CURSOR',['../glfw3_8h.html#aade31da5b884a84a7625c6b059b9132c',1,'glfw3.h']]], ['glfw_5fcursor_5fdisabled_737',['GLFW_CURSOR_DISABLED',['../glfw3_8h.html#a2315b99a329ce53e6a13a9d46fd5ca88',1,'glfw3.h']]], ['glfw_5fcursor_5fhidden_738',['GLFW_CURSOR_HIDDEN',['../glfw3_8h.html#ac4d5cb9d78de8573349c58763d53bf11',1,'glfw3.h']]], ['glfw_5fcursor_5fnormal_739',['GLFW_CURSOR_NORMAL',['../glfw3_8h.html#ae04dd25c8577e19fa8c97368561f6c68',1,'glfw3.h']]], ['glfw_5fdisconnected_740',['GLFW_DISCONNECTED',['../glfw3_8h.html#aab64b25921ef21d89252d6f0a71bfc32',1,'glfw3.h']]], ['glfw_5fdont_5fcare_741',['GLFW_DONT_CARE',['../glfw3_8h.html#a7a2edf2c18446833d27d07f1b7f3d571',1,'glfw3.h']]], ['glfw_5fegl_5fcontext_5fapi_742',['GLFW_EGL_CONTEXT_API',['../glfw3_8h.html#a03cf65c9ab01fc8b872ba58842c531c9',1,'glfw3.h']]], ['glfw_5flock_5fkey_5fmods_743',['GLFW_LOCK_KEY_MODS',['../glfw3_8h.html#a07b84de0b52143e1958f88a7d9105947',1,'glfw3.h']]], ['glfw_5flose_5fcontext_5fon_5freset_744',['GLFW_LOSE_CONTEXT_ON_RESET',['../glfw3_8h.html#aec1132f245143fc915b2f0995228564c',1,'glfw3.h']]], ['glfw_5fnative_5fcontext_5fapi_745',['GLFW_NATIVE_CONTEXT_API',['../glfw3_8h.html#a0494c9bfd3f584ab41e6dbeeaa0e6a19',1,'glfw3.h']]], ['glfw_5fno_5fapi_746',['GLFW_NO_API',['../glfw3_8h.html#a8f6dcdc968d214ff14779564f1389264',1,'glfw3.h']]], ['glfw_5fno_5freset_5fnotification_747',['GLFW_NO_RESET_NOTIFICATION',['../glfw3_8h.html#aee84a679230d205005e22487ff678a85',1,'glfw3.h']]], ['glfw_5fno_5frobustness_748',['GLFW_NO_ROBUSTNESS',['../glfw3_8h.html#a8b306cb27f5bb0d6d67c7356a0e0fc34',1,'glfw3.h']]], ['glfw_5fopengl_5fany_5fprofile_749',['GLFW_OPENGL_ANY_PROFILE',['../glfw3_8h.html#ad6f2335d6f21cc9bab96633b1c111d5f',1,'glfw3.h']]], ['glfw_5fopengl_5fapi_750',['GLFW_OPENGL_API',['../glfw3_8h.html#a01b3f66db266341425e9abee6b257db2',1,'glfw3.h']]], ['glfw_5fopengl_5fcompat_5fprofile_751',['GLFW_OPENGL_COMPAT_PROFILE',['../glfw3_8h.html#ac06b663d79c8fcf04669cc8fcc0b7670',1,'glfw3.h']]], ['glfw_5fopengl_5fcore_5fprofile_752',['GLFW_OPENGL_CORE_PROFILE',['../glfw3_8h.html#af094bb16da76f66ebceb19ee213b3de8',1,'glfw3.h']]], ['glfw_5fopengl_5fes_5fapi_753',['GLFW_OPENGL_ES_API',['../glfw3_8h.html#a28d9b3bc6c2a522d815c8e146595051f',1,'glfw3.h']]], ['glfw_5fosmesa_5fcontext_5fapi_754',['GLFW_OSMESA_CONTEXT_API',['../glfw3_8h.html#afd34a473af9fa81f317910ea371b19e3',1,'glfw3.h']]], ['glfw_5fraw_5fmouse_5fmotion_755',['GLFW_RAW_MOUSE_MOTION',['../glfw3_8h.html#aeeda1be76a44a1fc97c1282e06281fbb',1,'glfw3.h']]], ['glfw_5frelease_5fbehavior_5fflush_756',['GLFW_RELEASE_BEHAVIOR_FLUSH',['../glfw3_8h.html#a999961d391db49cb4f949c1dece0e13b',1,'glfw3.h']]], ['glfw_5frelease_5fbehavior_5fnone_757',['GLFW_RELEASE_BEHAVIOR_NONE',['../glfw3_8h.html#afca09088eccacdce4b59036cfae349c5',1,'glfw3.h']]], ['glfw_5fsticky_5fkeys_758',['GLFW_STICKY_KEYS',['../glfw3_8h.html#ae3bbe2315b7691ab088159eb6c9110fc',1,'glfw3.h']]], ['glfw_5fsticky_5fmouse_5fbuttons_759',['GLFW_STICKY_MOUSE_BUTTONS',['../glfw3_8h.html#a4d7ce8ce71030c3b04e2b78145bc59d1',1,'glfw3.h']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_0.js ================================================ var searchData= [ ['build_2edox_531',['build.dox',['../build_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_1.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_1.js ================================================ var searchData= [ ['compat_2edox_532',['compat.dox',['../compat_8dox.html',1,'']]], ['compile_2edox_533',['compile.dox',['../compile_8dox.html',1,'']]], ['context_2edox_534',['context.dox',['../context_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_2.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_2.js ================================================ var searchData= [ ['glfw3_2eh_535',['glfw3.h',['../glfw3_8h.html',1,'']]], ['glfw3native_2eh_536',['glfw3native.h',['../glfw3native_8h.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_3.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_3.js ================================================ var searchData= [ ['input_2edox_537',['input.dox',['../input_8dox.html',1,'']]], ['internal_2edox_538',['internal.dox',['../internal_8dox.html',1,'']]], ['intro_2edox_539',['intro.dox',['../intro_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_4.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_4.js ================================================ var searchData= [ ['main_2edox_540',['main.dox',['../main_8dox.html',1,'']]], ['monitor_2edox_541',['monitor.dox',['../monitor_8dox.html',1,'']]], ['moving_2edox_542',['moving.dox',['../moving_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_5.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_5.js ================================================ var searchData= [ ['news_2edox_543',['news.dox',['../news_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_6.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_6.js ================================================ var searchData= [ ['quick_2edox_544',['quick.dox',['../quick_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_7.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_7.js ================================================ var searchData= [ ['vulkan_2edox_545',['vulkan.dox',['../vulkan_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/files_8.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/files_8.js ================================================ var searchData= [ ['window_2edox_546',['window.dox',['../window_8dox.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/functions_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/functions_0.js ================================================ var searchData= [ ['glfwcreatecursor_547',['glfwCreateCursor',['../group__input.html#gafca356935e10135016aa49ffa464c355',1,'glfw3.h']]], ['glfwcreatestandardcursor_548',['glfwCreateStandardCursor',['../group__input.html#gaa65f416d03ebbbb5b8db71a489fcb894',1,'glfw3.h']]], ['glfwcreatewindow_549',['glfwCreateWindow',['../group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344',1,'glfw3.h']]], ['glfwcreatewindowsurface_550',['glfwCreateWindowSurface',['../group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965',1,'glfw3.h']]], ['glfwdefaultwindowhints_551',['glfwDefaultWindowHints',['../group__window.html#gaa77c4898dfb83344a6b4f76aa16b9a4a',1,'glfw3.h']]], ['glfwdestroycursor_552',['glfwDestroyCursor',['../group__input.html#ga81b952cd1764274d0db7fb3c5a79ba6a',1,'glfw3.h']]], ['glfwdestroywindow_553',['glfwDestroyWindow',['../group__window.html#gacdf43e51376051d2c091662e9fe3d7b2',1,'glfw3.h']]], ['glfwextensionsupported_554',['glfwExtensionSupported',['../group__context.html#ga87425065c011cef1ebd6aac75e059dfa',1,'glfw3.h']]], ['glfwfocuswindow_555',['glfwFocusWindow',['../group__window.html#ga873780357abd3f3a081d71a40aae45a1',1,'glfw3.h']]], ['glfwgetclipboardstring_556',['glfwGetClipboardString',['../group__input.html#ga5aba1d704d9ab539282b1fbe9f18bb94',1,'glfw3.h']]], ['glfwgetcocoamonitor_557',['glfwGetCocoaMonitor',['../group__native.html#gaf22f429aec4b1aab316142d66d9be3e6',1,'glfw3native.h']]], ['glfwgetcocoawindow_558',['glfwGetCocoaWindow',['../group__native.html#gac3ed9d495d0c2bb9652de5a50c648715',1,'glfw3native.h']]], ['glfwgetcurrentcontext_559',['glfwGetCurrentContext',['../group__context.html#gac84759b1f6c2d271a4fea8ae89ec980d',1,'glfw3.h']]], ['glfwgetcursorpos_560',['glfwGetCursorPos',['../group__input.html#ga01d37b6c40133676b9cea60ca1d7c0cc',1,'glfw3.h']]], ['glfwgeteglcontext_561',['glfwGetEGLContext',['../group__native.html#ga671c5072becd085f4ab5771a9c8efcf1',1,'glfw3native.h']]], ['glfwgetegldisplay_562',['glfwGetEGLDisplay',['../group__native.html#ga1cd8d973f47aacb5532d368147cc3138',1,'glfw3native.h']]], ['glfwgeteglsurface_563',['glfwGetEGLSurface',['../group__native.html#ga2199b36117a6a695fec8441d8052eee6',1,'glfw3native.h']]], ['glfwgeterror_564',['glfwGetError',['../group__init.html#ga944986b4ec0b928d488141f92982aa18',1,'glfw3.h']]], ['glfwgetframebuffersize_565',['glfwGetFramebufferSize',['../group__window.html#ga0e2637a4161afb283f5300c7f94785c9',1,'glfw3.h']]], ['glfwgetgamepadname_566',['glfwGetGamepadName',['../group__input.html#ga5c71e3533b2d384db9317fcd7661b210',1,'glfw3.h']]], ['glfwgetgamepadstate_567',['glfwGetGamepadState',['../group__input.html#gadccddea8bce6113fa459de379ddaf051',1,'glfw3.h']]], ['glfwgetgammaramp_568',['glfwGetGammaRamp',['../group__monitor.html#gab7c41deb2219bde3e1eb756ddaa9ec80',1,'glfw3.h']]], ['glfwgetglxcontext_569',['glfwGetGLXContext',['../group__native.html#ga62d884114b0abfcdc2930e89f20867e2',1,'glfw3native.h']]], ['glfwgetglxwindow_570',['glfwGetGLXWindow',['../group__native.html#ga1ed27b8766e859a21381e8f8ce18d049',1,'glfw3native.h']]], ['glfwgetinputmode_571',['glfwGetInputMode',['../group__input.html#gaf5b859dbe19bdf434e42695ea45cc5f4',1,'glfw3.h']]], ['glfwgetinstanceprocaddress_572',['glfwGetInstanceProcAddress',['../group__vulkan.html#gadf228fac94c5fd8f12423ec9af9ff1e9',1,'glfw3.h']]], ['glfwgetjoystickaxes_573',['glfwGetJoystickAxes',['../group__input.html#gaa8806536731e92c061bc70bcff6edbd0',1,'glfw3.h']]], ['glfwgetjoystickbuttons_574',['glfwGetJoystickButtons',['../group__input.html#gadb3cbf44af90a1536f519659a53bddd6',1,'glfw3.h']]], ['glfwgetjoystickguid_575',['glfwGetJoystickGUID',['../group__input.html#gae168c2c0b8cf2a1cb67c6b3c00bdd543',1,'glfw3.h']]], ['glfwgetjoystickhats_576',['glfwGetJoystickHats',['../group__input.html#ga2d8d0634bb81c180899aeb07477a67ea',1,'glfw3.h']]], ['glfwgetjoystickname_577',['glfwGetJoystickName',['../group__input.html#gafbe3e51f670320908cfe4e20d3e5559e',1,'glfw3.h']]], ['glfwgetjoystickuserpointer_578',['glfwGetJoystickUserPointer',['../group__input.html#ga06290acb7ed23895bf26b8e981827ebd',1,'glfw3.h']]], ['glfwgetkey_579',['glfwGetKey',['../group__input.html#gadd341da06bc8d418b4dc3a3518af9ad2',1,'glfw3.h']]], ['glfwgetkeyname_580',['glfwGetKeyName',['../group__input.html#ga237a182e5ec0b21ce64543f3b5e7e2be',1,'glfw3.h']]], ['glfwgetkeyscancode_581',['glfwGetKeyScancode',['../group__input.html#ga67ddd1b7dcbbaff03e4a76c0ea67103a',1,'glfw3.h']]], ['glfwgetmonitorcontentscale_582',['glfwGetMonitorContentScale',['../group__monitor.html#gad3152e84465fa620b601265ebfcdb21b',1,'glfw3.h']]], ['glfwgetmonitorname_583',['glfwGetMonitorName',['../group__monitor.html#ga79a34ee22ff080ca954a9663e4679daf',1,'glfw3.h']]], ['glfwgetmonitorphysicalsize_584',['glfwGetMonitorPhysicalSize',['../group__monitor.html#ga7d8bffc6c55539286a6bd20d32a8d7ea',1,'glfw3.h']]], ['glfwgetmonitorpos_585',['glfwGetMonitorPos',['../group__monitor.html#ga102f54e7acc9149edbcf0997152df8c9',1,'glfw3.h']]], ['glfwgetmonitors_586',['glfwGetMonitors',['../group__monitor.html#ga3fba51c8bd36491d4712aa5bd074a537',1,'glfw3.h']]], ['glfwgetmonitoruserpointer_587',['glfwGetMonitorUserPointer',['../group__monitor.html#gac2d4209016b049222877f620010ed0d8',1,'glfw3.h']]], ['glfwgetmonitorworkarea_588',['glfwGetMonitorWorkarea',['../group__monitor.html#ga7387a3bdb64bfe8ebf2b9e54f5b6c9d0',1,'glfw3.h']]], ['glfwgetmousebutton_589',['glfwGetMouseButton',['../group__input.html#gac1473feacb5996c01a7a5a33b5066704',1,'glfw3.h']]], ['glfwgetnsglcontext_590',['glfwGetNSGLContext',['../group__native.html#ga559e002e3cd63c979881770cd4dc63bc',1,'glfw3native.h']]], ['glfwgetosmesacolorbuffer_591',['glfwGetOSMesaColorBuffer',['../group__native.html#ga3b36e3e3dcf308b776427b6bd73cc132',1,'glfw3native.h']]], ['glfwgetosmesacontext_592',['glfwGetOSMesaContext',['../group__native.html#ga9e47700080094eb569cb053afaa88773',1,'glfw3native.h']]], ['glfwgetosmesadepthbuffer_593',['glfwGetOSMesaDepthBuffer',['../group__native.html#ga6b64039ffc88a7a2f57f0956c0c75d53',1,'glfw3native.h']]], ['glfwgetphysicaldevicepresentationsupport_594',['glfwGetPhysicalDevicePresentationSupport',['../group__vulkan.html#gaff3823355cdd7e2f3f9f4d9ea9518d92',1,'glfw3.h']]], ['glfwgetprimarymonitor_595',['glfwGetPrimaryMonitor',['../group__monitor.html#ga721867d84c6d18d6790d64d2847ca0b1',1,'glfw3.h']]], ['glfwgetprocaddress_596',['glfwGetProcAddress',['../group__context.html#ga35f1837e6f666781842483937612f163',1,'glfw3.h']]], ['glfwgetrequiredinstanceextensions_597',['glfwGetRequiredInstanceExtensions',['../group__vulkan.html#ga1abcbe61033958f22f63ef82008874b1',1,'glfw3.h']]], ['glfwgettime_598',['glfwGetTime',['../group__input.html#gaa6cf4e7a77158a3b8fd00328b1720a4a',1,'glfw3.h']]], ['glfwgettimerfrequency_599',['glfwGetTimerFrequency',['../group__input.html#ga3289ee876572f6e91f06df3a24824443',1,'glfw3.h']]], ['glfwgettimervalue_600',['glfwGetTimerValue',['../group__input.html#ga09b2bd37d328e0b9456c7ec575cc26aa',1,'glfw3.h']]], ['glfwgetversion_601',['glfwGetVersion',['../group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197',1,'glfw3.h']]], ['glfwgetversionstring_602',['glfwGetVersionString',['../group__init.html#ga23d47dc013fce2bf58036da66079a657',1,'glfw3.h']]], ['glfwgetvideomode_603',['glfwGetVideoMode',['../group__monitor.html#gafc1bb972a921ad5b3bd5d63a95fc2d52',1,'glfw3.h']]], ['glfwgetvideomodes_604',['glfwGetVideoModes',['../group__monitor.html#ga820b0ce9a5237d645ea7cbb4bd383458',1,'glfw3.h']]], ['glfwgetwaylanddisplay_605',['glfwGetWaylandDisplay',['../group__native.html#gaaf8118a3c877f3a6bc8e7a649519de5e',1,'glfw3native.h']]], ['glfwgetwaylandmonitor_606',['glfwGetWaylandMonitor',['../group__native.html#gab10427a667b6cd91eec7709f7a906bd3',1,'glfw3native.h']]], ['glfwgetwaylandwindow_607',['glfwGetWaylandWindow',['../group__native.html#ga4738d7aca4191363519a9a641c3ab64c',1,'glfw3native.h']]], ['glfwgetwglcontext_608',['glfwGetWGLContext',['../group__native.html#gadc4010d91d9cc1134d040eeb1202a143',1,'glfw3native.h']]], ['glfwgetwin32adapter_609',['glfwGetWin32Adapter',['../group__native.html#gac84f63a3f9db145b9435e5e0dbc4183d',1,'glfw3native.h']]], ['glfwgetwin32monitor_610',['glfwGetWin32Monitor',['../group__native.html#gac408b09a330749402d5d1fa1f5894dd9',1,'glfw3native.h']]], ['glfwgetwin32window_611',['glfwGetWin32Window',['../group__native.html#gafe5079aa79038b0079fc09d5f0a8e667',1,'glfw3native.h']]], ['glfwgetwindowattrib_612',['glfwGetWindowAttrib',['../group__window.html#gacccb29947ea4b16860ebef42c2cb9337',1,'glfw3.h']]], ['glfwgetwindowcontentscale_613',['glfwGetWindowContentScale',['../group__window.html#gaf5d31de9c19c4f994facea64d2b3106c',1,'glfw3.h']]], ['glfwgetwindowframesize_614',['glfwGetWindowFrameSize',['../group__window.html#ga1a9fd382058c53101b21cf211898f1f1',1,'glfw3.h']]], ['glfwgetwindowmonitor_615',['glfwGetWindowMonitor',['../group__window.html#gaeac25e64789974ccbe0811766bd91a16',1,'glfw3.h']]], ['glfwgetwindowopacity_616',['glfwGetWindowOpacity',['../group__window.html#gad09f0bd7a6307c4533b7061828480a84',1,'glfw3.h']]], ['glfwgetwindowpos_617',['glfwGetWindowPos',['../group__window.html#ga73cb526c000876fd8ddf571570fdb634',1,'glfw3.h']]], ['glfwgetwindowsize_618',['glfwGetWindowSize',['../group__window.html#gaeea7cbc03373a41fb51cfbf9f2a5d4c6',1,'glfw3.h']]], ['glfwgetwindowuserpointer_619',['glfwGetWindowUserPointer',['../group__window.html#ga17807ce0f45ac3f8bb50d6dcc59a4e06',1,'glfw3.h']]], ['glfwgetx11adapter_620',['glfwGetX11Adapter',['../group__native.html#ga088fbfa80f50569402b41be71ad66e40',1,'glfw3native.h']]], ['glfwgetx11display_621',['glfwGetX11Display',['../group__native.html#ga8519b66594ea3ef6eeafaa2e3ee37406',1,'glfw3native.h']]], ['glfwgetx11monitor_622',['glfwGetX11Monitor',['../group__native.html#gab2f8cc043905e9fa9b12bfdbbcfe874c',1,'glfw3native.h']]], ['glfwgetx11selectionstring_623',['glfwGetX11SelectionString',['../group__native.html#ga72f23e3980b83788c70aa854eca31430',1,'glfw3native.h']]], ['glfwgetx11window_624',['glfwGetX11Window',['../group__native.html#ga90ca676322740842db446999a1b1f21d',1,'glfw3native.h']]], ['glfwhidewindow_625',['glfwHideWindow',['../group__window.html#ga49401f82a1ba5f15db5590728314d47c',1,'glfw3.h']]], ['glfwiconifywindow_626',['glfwIconifyWindow',['../group__window.html#ga1bb559c0ebaad63c5c05ad2a066779c4',1,'glfw3.h']]], ['glfwinit_627',['glfwInit',['../group__init.html#ga317aac130a235ab08c6db0834907d85e',1,'glfw3.h']]], ['glfwinithint_628',['glfwInitHint',['../group__init.html#ga110fd1d3f0412822b4f1908c026f724a',1,'glfw3.h']]], ['glfwjoystickisgamepad_629',['glfwJoystickIsGamepad',['../group__input.html#gad0f676860f329d80f7e47e9f06a96f00',1,'glfw3.h']]], ['glfwjoystickpresent_630',['glfwJoystickPresent',['../group__input.html#gaed0966cee139d815317f9ffcba64c9f1',1,'glfw3.h']]], ['glfwmakecontextcurrent_631',['glfwMakeContextCurrent',['../group__context.html#ga1c04dc242268f827290fe40aa1c91157',1,'glfw3.h']]], ['glfwmaximizewindow_632',['glfwMaximizeWindow',['../group__window.html#ga3f541387449d911274324ae7f17ec56b',1,'glfw3.h']]], ['glfwpollevents_633',['glfwPollEvents',['../group__window.html#ga37bd57223967b4211d60ca1a0bf3c832',1,'glfw3.h']]], ['glfwpostemptyevent_634',['glfwPostEmptyEvent',['../group__window.html#gab5997a25187e9fd5c6f2ecbbc8dfd7e9',1,'glfw3.h']]], ['glfwrawmousemotionsupported_635',['glfwRawMouseMotionSupported',['../group__input.html#gae4ee0dbd0d256183e1ea4026d897e1c2',1,'glfw3.h']]], ['glfwrequestwindowattention_636',['glfwRequestWindowAttention',['../group__window.html#ga2f8d59323fc4692c1d54ba08c863a703',1,'glfw3.h']]], ['glfwrestorewindow_637',['glfwRestoreWindow',['../group__window.html#ga52527a5904b47d802b6b4bb519cdebc7',1,'glfw3.h']]], ['glfwsetcharcallback_638',['glfwSetCharCallback',['../group__input.html#gab25c4a220fd8f5717718dbc487828996',1,'glfw3.h']]], ['glfwsetcharmodscallback_639',['glfwSetCharModsCallback',['../group__input.html#ga0b7f4ad13c2b17435ff13b6dcfb4e43c',1,'glfw3.h']]], ['glfwsetclipboardstring_640',['glfwSetClipboardString',['../group__input.html#gaba1f022c5eb07dfac421df34cdcd31dd',1,'glfw3.h']]], ['glfwsetcursor_641',['glfwSetCursor',['../group__input.html#gad3b4f38c8d5dae036bc8fa959e18343e',1,'glfw3.h']]], ['glfwsetcursorentercallback_642',['glfwSetCursorEnterCallback',['../group__input.html#gad27f8ad0142c038a281466c0966817d8',1,'glfw3.h']]], ['glfwsetcursorpos_643',['glfwSetCursorPos',['../group__input.html#ga04b03af936d906ca123c8f4ee08b39e7',1,'glfw3.h']]], ['glfwsetcursorposcallback_644',['glfwSetCursorPosCallback',['../group__input.html#gac1f879ab7435d54d4d79bb469fe225d7',1,'glfw3.h']]], ['glfwsetdropcallback_645',['glfwSetDropCallback',['../group__input.html#gab773f0ee0a07cff77a210cea40bc1f6b',1,'glfw3.h']]], ['glfwseterrorcallback_646',['glfwSetErrorCallback',['../group__init.html#gaff45816610d53f0b83656092a4034f40',1,'glfw3.h']]], ['glfwsetframebuffersizecallback_647',['glfwSetFramebufferSizeCallback',['../group__window.html#gab3fb7c3366577daef18c0023e2a8591f',1,'glfw3.h']]], ['glfwsetgamma_648',['glfwSetGamma',['../group__monitor.html#ga6ac582625c990220785ddd34efa3169a',1,'glfw3.h']]], ['glfwsetgammaramp_649',['glfwSetGammaRamp',['../group__monitor.html#ga583f0ffd0d29613d8cd172b996bbf0dd',1,'glfw3.h']]], ['glfwsetinputmode_650',['glfwSetInputMode',['../group__input.html#gaa92336e173da9c8834558b54ee80563b',1,'glfw3.h']]], ['glfwsetjoystickcallback_651',['glfwSetJoystickCallback',['../group__input.html#ga2f60a0e5b7bd8d1b7344dc0a7cb32b4c',1,'glfw3.h']]], ['glfwsetjoystickuserpointer_652',['glfwSetJoystickUserPointer',['../group__input.html#ga6b2f72d64d636b48a727b437cbb7489e',1,'glfw3.h']]], ['glfwsetkeycallback_653',['glfwSetKeyCallback',['../group__input.html#ga1caf18159767e761185e49a3be019f8d',1,'glfw3.h']]], ['glfwsetmonitorcallback_654',['glfwSetMonitorCallback',['../group__monitor.html#gab39df645587c8518192aa746c2fb06c3',1,'glfw3.h']]], ['glfwsetmonitoruserpointer_655',['glfwSetMonitorUserPointer',['../group__monitor.html#ga702750e24313a686d3637297b6e85fda',1,'glfw3.h']]], ['glfwsetmousebuttoncallback_656',['glfwSetMouseButtonCallback',['../group__input.html#ga6ab84420974d812bee700e45284a723c',1,'glfw3.h']]], ['glfwsetscrollcallback_657',['glfwSetScrollCallback',['../group__input.html#ga571e45a030ae4061f746ed56cb76aede',1,'glfw3.h']]], ['glfwsettime_658',['glfwSetTime',['../group__input.html#gaf59589ef6e8b8c8b5ad184b25afd4dc0',1,'glfw3.h']]], ['glfwsetwindowaspectratio_659',['glfwSetWindowAspectRatio',['../group__window.html#ga72ac8cb1ee2e312a878b55153d81b937',1,'glfw3.h']]], ['glfwsetwindowattrib_660',['glfwSetWindowAttrib',['../group__window.html#gace2afda29b4116ec012e410a6819033e',1,'glfw3.h']]], ['glfwsetwindowclosecallback_661',['glfwSetWindowCloseCallback',['../group__window.html#gada646d775a7776a95ac000cfc1885331',1,'glfw3.h']]], ['glfwsetwindowcontentscalecallback_662',['glfwSetWindowContentScaleCallback',['../group__window.html#gaf2832ebb5aa6c252a2d261de002c92d6',1,'glfw3.h']]], ['glfwsetwindowfocuscallback_663',['glfwSetWindowFocusCallback',['../group__window.html#gac2d83c4a10f071baf841f6730528e66c',1,'glfw3.h']]], ['glfwsetwindowicon_664',['glfwSetWindowIcon',['../group__window.html#gadd7ccd39fe7a7d1f0904666ae5932dc5',1,'glfw3.h']]], ['glfwsetwindowiconifycallback_665',['glfwSetWindowIconifyCallback',['../group__window.html#gac793e9efd255567b5fb8b445052cfd3e',1,'glfw3.h']]], ['glfwsetwindowmaximizecallback_666',['glfwSetWindowMaximizeCallback',['../group__window.html#gacbe64c339fbd94885e62145563b6dc93',1,'glfw3.h']]], ['glfwsetwindowmonitor_667',['glfwSetWindowMonitor',['../group__window.html#ga81c76c418af80a1cce7055bccb0ae0a7',1,'glfw3.h']]], ['glfwsetwindowopacity_668',['glfwSetWindowOpacity',['../group__window.html#gac31caeb3d1088831b13d2c8a156802e9',1,'glfw3.h']]], ['glfwsetwindowpos_669',['glfwSetWindowPos',['../group__window.html#ga1abb6d690e8c88e0c8cd1751356dbca8',1,'glfw3.h']]], ['glfwsetwindowposcallback_670',['glfwSetWindowPosCallback',['../group__window.html#ga08bdfbba88934f9c4f92fd757979ac74',1,'glfw3.h']]], ['glfwsetwindowrefreshcallback_671',['glfwSetWindowRefreshCallback',['../group__window.html#ga1c5c7eb889c33c7f4d10dd35b327654e',1,'glfw3.h']]], ['glfwsetwindowshouldclose_672',['glfwSetWindowShouldClose',['../group__window.html#ga49c449dde2a6f87d996f4daaa09d6708',1,'glfw3.h']]], ['glfwsetwindowsize_673',['glfwSetWindowSize',['../group__window.html#ga371911f12c74c504dd8d47d832d095cb',1,'glfw3.h']]], ['glfwsetwindowsizecallback_674',['glfwSetWindowSizeCallback',['../group__window.html#gad91b8b047a0c4c6033c38853864c34f8',1,'glfw3.h']]], ['glfwsetwindowsizelimits_675',['glfwSetWindowSizeLimits',['../group__window.html#gac314fa6cec7d2d307be9963e2709cc90',1,'glfw3.h']]], ['glfwsetwindowtitle_676',['glfwSetWindowTitle',['../group__window.html#ga5d877f09e968cef7a360b513306f17ff',1,'glfw3.h']]], ['glfwsetwindowuserpointer_677',['glfwSetWindowUserPointer',['../group__window.html#ga3d2fc6026e690ab31a13f78bc9fd3651',1,'glfw3.h']]], ['glfwsetx11selectionstring_678',['glfwSetX11SelectionString',['../group__native.html#ga55f879ab02d93367f966186b6f0133f7',1,'glfw3native.h']]], ['glfwshowwindow_679',['glfwShowWindow',['../group__window.html#ga61be47917b72536a148300f46494fc66',1,'glfw3.h']]], ['glfwswapbuffers_680',['glfwSwapBuffers',['../group__window.html#ga15a5a1ee5b3c2ca6b15ca209a12efd14',1,'glfw3.h']]], ['glfwswapinterval_681',['glfwSwapInterval',['../group__context.html#ga6d4e0cdf151b5e579bd67f13202994ed',1,'glfw3.h']]], ['glfwterminate_682',['glfwTerminate',['../group__init.html#gaaae48c0a18607ea4a4ba951d939f0901',1,'glfw3.h']]], ['glfwupdategamepadmappings_683',['glfwUpdateGamepadMappings',['../group__input.html#gaed5104612f2fa8e66aa6e846652ad00f',1,'glfw3.h']]], ['glfwvulkansupported_684',['glfwVulkanSupported',['../group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b',1,'glfw3.h']]], ['glfwwaitevents_685',['glfwWaitEvents',['../group__window.html#ga554e37d781f0a997656c26b2c56c835e',1,'glfw3.h']]], ['glfwwaiteventstimeout_686',['glfwWaitEventsTimeout',['../group__window.html#ga605a178db92f1a7f1a925563ef3ea2cf',1,'glfw3.h']]], ['glfwwindowhint_687',['glfwWindowHint',['../group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033',1,'glfw3.h']]], ['glfwwindowhintstring_688',['glfwWindowHintString',['../group__window.html#ga8cb2782861c9d997bcf2dea97f363e5f',1,'glfw3.h']]], ['glfwwindowshouldclose_689',['glfwWindowShouldClose',['../group__window.html#ga24e02fbfefbb81fc45320989f8140ab5',1,'glfw3.h']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_0.js ================================================ var searchData= [ ['context_20reference_760',['Context reference',['../group__context.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_1.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_1.js ================================================ var searchData= [ ['error_20codes_761',['Error codes',['../group__errors.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_2.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_2.js ================================================ var searchData= [ ['gamepad_20axes_762',['Gamepad axes',['../group__gamepad__axes.html',1,'']]], ['gamepad_20buttons_763',['Gamepad buttons',['../group__gamepad__buttons.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_3.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_3.js ================================================ var searchData= [ ['initialization_2c_20version_20and_20error_20reference_764',['Initialization, version and error reference',['../group__init.html',1,'']]], ['input_20reference_765',['Input reference',['../group__input.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_4.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_4.js ================================================ var searchData= [ ['joystick_20hat_20states_766',['Joystick hat states',['../group__hat__state.html',1,'']]], ['joysticks_767',['Joysticks',['../group__joysticks.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_5.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_5.js ================================================ var searchData= [ ['keyboard_20keys_768',['Keyboard keys',['../group__keys.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_6.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_6.js ================================================ var searchData= [ ['mouse_20buttons_769',['Mouse buttons',['../group__buttons.html',1,'']]], ['modifier_20key_20flags_770',['Modifier key flags',['../group__mods.html',1,'']]], ['monitor_20reference_771',['Monitor reference',['../group__monitor.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_7.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_7.js ================================================ var searchData= [ ['native_20access_772',['Native access',['../group__native.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_8.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_8.js ================================================ var searchData= [ ['standard_20cursor_20shapes_773',['Standard cursor shapes',['../group__shapes.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_9.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_9.js ================================================ var searchData= [ ['vulkan_20reference_774',['Vulkan reference',['../group__vulkan.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/groups_a.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/groups_a.js ================================================ var searchData= [ ['window_20reference_775',['Window reference',['../group__window.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/nomatches.html ================================================
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_0.js ================================================ var searchData= [ ['bug_20list_776',['Bug List',['../bug.html',1,'']]], ['building_20applications_777',['Building applications',['../build_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_1.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_1.js ================================================ var searchData= [ ['compiling_20glfw_778',['Compiling GLFW',['../compile_guide.html',1,'']]], ['context_20guide_779',['Context guide',['../context_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_2.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_2.js ================================================ var searchData= [ ['deprecated_20list_780',['Deprecated List',['../deprecated.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_3.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_3.js ================================================ var searchData= [ ['getting_20started_781',['Getting started',['../quick_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_4.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_4.js ================================================ var searchData= [ ['input_20guide_782',['Input guide',['../input_guide.html',1,'']]], ['internal_20structure_783',['Internal structure',['../internals_guide.html',1,'']]], ['introduction_20to_20the_20api_784',['Introduction to the API',['../intro_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_5.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_5.js ================================================ var searchData= [ ['monitor_20guide_785',['Monitor guide',['../monitor_guide.html',1,'']]], ['moving_20from_20glfw_202_20to_203_786',['Moving from GLFW 2 to 3',['../moving_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_6.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_6.js ================================================ var searchData= [ ['notitle_787',['notitle',['../index.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_7.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_7.js ================================================ var searchData= [ ['release_20notes_788',['Release notes',['../news.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_8.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_8.js ================================================ var searchData= [ ['standards_20conformance_789',['Standards conformance',['../compat_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_9.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_9.js ================================================ var searchData= [ ['vulkan_20guide_790',['Vulkan guide',['../vulkan_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/pages_a.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/pages_a.js ================================================ var searchData= [ ['window_20guide_791',['Window guide',['../window_guide.html',1,'']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/search.css ================================================ /*---------------- Search Box */ #FSearchBox { float: left; } #MSearchBox { white-space : nowrap; float: none; margin-top: 8px; right: 0px; width: 170px; height: 24px; z-index: 102; } #MSearchBox .left { display:block; position:absolute; left:10px; width:20px; height:19px; background:url('search_l.png') no-repeat; background-position:right; } #MSearchSelect { display:block; position:absolute; width:20px; height:19px; } .left #MSearchSelect { left:4px; } .right #MSearchSelect { right:5px; } #MSearchField { display:block; position:absolute; height:19px; background:url('search_m.png') repeat-x; border:none; width:115px; margin-left:20px; padding-left:4px; color: #909090; outline: none; font: 9pt Arial, Verdana, sans-serif; -webkit-border-radius: 0px; } #FSearchBox #MSearchField { margin-left:15px; } #MSearchBox .right { display:block; position:absolute; right:10px; top:8px; width:20px; height:19px; background:url('search_r.png') no-repeat; background-position:left; } #MSearchClose { display: none; position: absolute; top: 4px; background : none; border: none; margin: 0px 4px 0px 0px; padding: 0px 0px; outline: none; } .left #MSearchClose { left: 6px; } .right #MSearchClose { right: 2px; } .MSearchBoxActive #MSearchField { color: #000000; } /*---------------- Search filter selection */ #MSearchSelectWindow { display: none; position: absolute; left: 0; top: 0; border: 1px solid #90A5CE; background-color: #F9FAFC; z-index: 10001; padding-top: 4px; padding-bottom: 4px; -moz-border-radius: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } .SelectItem { font: 8pt Arial, Verdana, sans-serif; padding-left: 2px; padding-right: 12px; border: 0px; } span.SelectionMark { margin-right: 4px; font-family: monospace; outline-style: none; text-decoration: none; } a.SelectItem { display: block; outline-style: none; color: #000000; text-decoration: none; padding-left: 6px; padding-right: 12px; } a.SelectItem:focus, a.SelectItem:active { color: #000000; outline-style: none; text-decoration: none; } a.SelectItem:hover { color: #FFFFFF; background-color: #3D578C; outline-style: none; text-decoration: none; cursor: pointer; display: block; } /*---------------- Search results window */ iframe#MSearchResults { width: 60ex; height: 15em; } #MSearchResultsWindow { display: none; position: absolute; left: 0; top: 0; border: 1px solid #000; background-color: #EEF1F7; z-index:10000; } /* ----------------------------------- */ #SRIndex { clear:both; padding-bottom: 15px; } .SREntry { font-size: 10pt; padding-left: 1ex; } .SRPage .SREntry { font-size: 8pt; padding: 1px 5px; } body.SRPage { margin: 5px 2px; } .SRChildren { padding-left: 3ex; padding-bottom: .5em } .SRPage .SRChildren { display: none; } .SRSymbol { font-weight: bold; color: #425E97; font-family: Arial, Verdana, sans-serif; text-decoration: none; outline: none; } a.SRScope { display: block; color: #425E97; font-family: Arial, Verdana, sans-serif; text-decoration: none; outline: none; } a.SRSymbol:focus, a.SRSymbol:active, a.SRScope:focus, a.SRScope:active { text-decoration: underline; } span.SRScope { padding-left: 4px; } .SRPage .SRStatus { padding: 2px 5px; font-size: 8pt; font-style: italic; } .SRResult { display: none; } DIV.searchresults { margin-left: 10px; margin-right: 10px; } /*---------------- External search page results */ .searchresult { background-color: #F0F3F8; } .pages b { color: white; padding: 5px 5px 3px 5px; background-image: url("../tab_a.png"); background-repeat: repeat-x; text-shadow: 0 1px 1px #000000; } .pages { line-height: 17px; margin-left: 4px; text-decoration: none; } .hl { font-weight: bold; } #searchresults { margin-bottom: 20px; } .searchpages { margin-top: 10px; } ================================================ FILE: thirdparty/glfw/docs/html/search/search.js ================================================ /* @licstart The following is the entire license notice for the JavaScript code in this file. Copyright (C) 1997-2017 by Dimitri van Heesch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @licend The above is the entire license notice for the JavaScript code in this file */ function convertToId(search) { var result = ''; for (i=0;i do a search { this.Search(); } } this.OnSearchSelectKey = function(evt) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==40 && this.searchIndex0) // Up { this.searchIndex--; this.OnSelectItem(this.searchIndex); } else if (e.keyCode==13 || e.keyCode==27) { this.OnSelectItem(this.searchIndex); this.CloseSelectionWindow(); this.DOMSearchField().focus(); } return false; } // --------- Actions // Closes the results window. this.CloseResultsWindow = function() { this.DOMPopupSearchResultsWindow().style.display = 'none'; this.DOMSearchClose().style.display = 'none'; this.Activate(false); } this.CloseSelectionWindow = function() { this.DOMSearchSelectWindow().style.display = 'none'; } // Performs a search. this.Search = function() { this.keyTimeout = 0; // strip leading whitespace var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); var code = searchValue.toLowerCase().charCodeAt(0); var idxChar = searchValue.substr(0, 1).toLowerCase(); if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair { idxChar = searchValue.substr(0, 2); } var resultsPage; var resultsPageWithSearch; var hasResultsPage; var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); if (idx!=-1) { var hexCode=idx.toString(16); resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; resultsPageWithSearch = resultsPage+'?'+escape(searchValue); hasResultsPage = true; } else // nothing available for this search term { resultsPage = this.resultsPath + '/nomatches.html'; resultsPageWithSearch = resultsPage; hasResultsPage = false; } window.frames.MSearchResults.location = resultsPageWithSearch; var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); if (domPopupSearchResultsWindow.style.display!='block') { var domSearchBox = this.DOMSearchBox(); this.DOMSearchClose().style.display = 'inline'; if (this.insideFrame) { var domPopupSearchResults = this.DOMPopupSearchResults(); domPopupSearchResultsWindow.style.position = 'relative'; domPopupSearchResultsWindow.style.display = 'block'; var width = document.body.clientWidth - 8; // the -8 is for IE :-( domPopupSearchResultsWindow.style.width = width + 'px'; domPopupSearchResults.style.width = width + 'px'; } else { var domPopupSearchResults = this.DOMPopupSearchResults(); var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; domPopupSearchResultsWindow.style.display = 'block'; left -= domPopupSearchResults.offsetWidth; domPopupSearchResultsWindow.style.top = top + 'px'; domPopupSearchResultsWindow.style.left = left + 'px'; } } this.lastSearchValue = searchValue; this.lastResultsPage = resultsPage; } // -------- Activation Functions // Activates or deactivates the search panel, resetting things to // their default values if necessary. this.Activate = function(isActive) { if (isActive || // open it this.DOMPopupSearchResultsWindow().style.display == 'block' ) { this.DOMSearchBox().className = 'MSearchBoxActive'; var searchField = this.DOMSearchField(); if (searchField.value == this.searchLabel) // clear "Search" term upon entry { searchField.value = ''; this.searchActive = true; } } else if (!isActive) // directly remove the panel { this.DOMSearchBox().className = 'MSearchBoxInactive'; this.DOMSearchField().value = this.searchLabel; this.searchActive = false; this.lastSearchValue = '' this.lastResultsPage = ''; } } } // ----------------------------------------------------------------------- // The class that handles everything on the search results page. function SearchResults(name) { // The number of matches from the last run of . this.lastMatchCount = 0; this.lastKey = 0; this.repeatOn = false; // Toggles the visibility of the passed element ID. this.FindChildElement = function(id) { var parentElement = document.getElementById(id); var element = parentElement.firstChild; while (element && element!=parentElement) { if (element.nodeName == 'DIV' && element.className == 'SRChildren') { return element; } if (element.nodeName == 'DIV' && element.hasChildNodes()) { element = element.firstChild; } else if (element.nextSibling) { element = element.nextSibling; } else { do { element = element.parentNode; } while (element && element!=parentElement && !element.nextSibling); if (element && element!=parentElement) { element = element.nextSibling; } } } } this.Toggle = function(id) { var element = this.FindChildElement(id); if (element) { if (element.style.display == 'block') { element.style.display = 'none'; } else { element.style.display = 'block'; } } } // Searches for the passed string. If there is no parameter, // it takes it from the URL query. // // Always returns true, since other documents may try to call it // and that may or may not be possible. this.Search = function(search) { if (!search) // get search word from URL { search = window.location.search; search = search.substring(1); // Remove the leading '?' search = unescape(search); } search = search.replace(/^ +/, ""); // strip leading spaces search = search.replace(/ +$/, ""); // strip trailing spaces search = search.toLowerCase(); search = convertToId(search); var resultRows = document.getElementsByTagName("div"); var matches = 0; var i = 0; while (i < resultRows.length) { var row = resultRows.item(i); if (row.className == "SRResult") { var rowMatchName = row.id.toLowerCase(); rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' if (search.length<=rowMatchName.length && rowMatchName.substr(0, search.length)==search) { row.style.display = 'block'; matches++; } else { row.style.display = 'none'; } } i++; } document.getElementById("Searching").style.display='none'; if (matches == 0) // no results { document.getElementById("NoMatches").style.display='block'; } else // at least one result { document.getElementById("NoMatches").style.display='none'; } this.lastMatchCount = matches; return true; } // return the first item with index index or higher that is visible this.NavNext = function(index) { var focusItem; while (1) { var focusName = 'Item'+index; focusItem = document.getElementById(focusName); if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { break; } else if (!focusItem) // last element { break; } focusItem=null; index++; } return focusItem; } this.NavPrev = function(index) { var focusItem; while (1) { var focusName = 'Item'+index; focusItem = document.getElementById(focusName); if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { break; } else if (!focusItem) // last element { break; } focusItem=null; index--; } return focusItem; } this.ProcessKeys = function(e) { if (e.type == "keydown") { this.repeatOn = false; this.lastKey = e.keyCode; } else if (e.type == "keypress") { if (!this.repeatOn) { if (this.lastKey) this.repeatOn = true; return false; // ignore first keypress after keydown } } else if (e.type == "keyup") { this.lastKey = 0; this.repeatOn = false; } return this.lastKey!=0; } this.Nav = function(evt,itemIndex) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==13) return true; if (!this.ProcessKeys(e)) return false; if (this.lastKey==38) // Up { var newIndex = itemIndex-1; var focusItem = this.NavPrev(newIndex); if (focusItem) { var child = this.FindChildElement(focusItem.parentNode.parentNode.id); if (child && child.style.display == 'block') // children visible { var n=0; var tmpElem; while (1) // search for last child { tmpElem = document.getElementById('Item'+newIndex+'_c'+n); if (tmpElem) { focusItem = tmpElem; } else // found it! { break; } n++; } } } if (focusItem) { focusItem.focus(); } else // return focus to search field { parent.document.getElementById("MSearchField").focus(); } } else if (this.lastKey==40) // Down { var newIndex = itemIndex+1; var focusItem; var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem && elem.style.display == 'block') // children visible { focusItem = document.getElementById('Item'+itemIndex+'_c0'); } if (!focusItem) focusItem = this.NavNext(newIndex); if (focusItem) focusItem.focus(); } else if (this.lastKey==39) // Right { var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem) elem.style.display = 'block'; } else if (this.lastKey==37) // Left { var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem) elem.style.display = 'none'; } else if (this.lastKey==27) // Escape { parent.searchBox.CloseResultsWindow(); parent.document.getElementById("MSearchField").focus(); } else if (this.lastKey==13) // Enter { return true; } return false; } this.NavChild = function(evt,itemIndex,childIndex) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==13) return true; if (!this.ProcessKeys(e)) return false; if (this.lastKey==38) // Up { if (childIndex>0) { var newIndex = childIndex-1; document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); } else // already at first child, jump to parent { document.getElementById('Item'+itemIndex).focus(); } } else if (this.lastKey==40) // Down { var newIndex = childIndex+1; var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); if (!elem) // last child, jump to parent next parent { elem = this.NavNext(itemIndex+1); } if (elem) { elem.focus(); } } else if (this.lastKey==27) // Escape { parent.searchBox.CloseResultsWindow(); parent.document.getElementById("MSearchField").focus(); } else if (this.lastKey==13) // Enter { return true; } return false; } } function setKeyActions(elem,action) { elem.setAttribute('onkeydown',action); elem.setAttribute('onkeypress',action); elem.setAttribute('onkeyup',action); } function setClassAttr(elem,attr) { elem.setAttribute('class',attr); elem.setAttribute('className',attr); } function createResults() { var results = document.getElementById("SRResults"); for (var e=0; e
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/typedefs_0.js ================================================ var searchData= [ ['glfwcharfun_703',['GLFWcharfun',['../group__input.html#gabf24451c7ceb1952bc02b17a0d5c3e5f',1,'glfw3.h']]], ['glfwcharmodsfun_704',['GLFWcharmodsfun',['../group__input.html#gae36fb6897d2b7df9b128900c8ce9c507',1,'glfw3.h']]], ['glfwcursor_705',['GLFWcursor',['../group__input.html#ga89261ae18c75e863aaf2656ecdd238f4',1,'glfw3.h']]], ['glfwcursorenterfun_706',['GLFWcursorenterfun',['../group__input.html#ga51ab436c41eeaed6db5a0c9403b1c840',1,'glfw3.h']]], ['glfwcursorposfun_707',['GLFWcursorposfun',['../group__input.html#ga4cfad918fa836f09541e7b9acd36686c',1,'glfw3.h']]], ['glfwdropfun_708',['GLFWdropfun',['../group__input.html#gafd0493dc32cd5ca5810e6148c0c026ea',1,'glfw3.h']]], ['glfwerrorfun_709',['GLFWerrorfun',['../group__init.html#ga6b8a2639706d5c409fc1287e8f55e928',1,'glfw3.h']]], ['glfwframebuffersizefun_710',['GLFWframebuffersizefun',['../group__window.html#ga3e218ef9ff826129c55a7d5f6971a285',1,'glfw3.h']]], ['glfwgamepadstate_711',['GLFWgamepadstate',['../group__input.html#ga0b86867abb735af3b959f61c44b1d029',1,'glfw3.h']]], ['glfwgammaramp_712',['GLFWgammaramp',['../group__monitor.html#gaec0bd37af673be8813592849f13e02f0',1,'glfw3.h']]], ['glfwglproc_713',['GLFWglproc',['../group__context.html#ga3d47c2d2fbe0be9c505d0e04e91a133c',1,'glfw3.h']]], ['glfwimage_714',['GLFWimage',['../group__window.html#gac81c32f4437de7b3aa58ab62c3d9e5b1',1,'glfw3.h']]], ['glfwjoystickfun_715',['GLFWjoystickfun',['../group__input.html#gaa67aa597e974298c748bfe4fb17d406d',1,'glfw3.h']]], ['glfwkeyfun_716',['GLFWkeyfun',['../group__input.html#ga0192a232a41e4e82948217c8ba94fdfd',1,'glfw3.h']]], ['glfwmonitor_717',['GLFWmonitor',['../group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3',1,'glfw3.h']]], ['glfwmonitorfun_718',['GLFWmonitorfun',['../group__monitor.html#ga8a7ee579a66720f24d656526f3e44c63',1,'glfw3.h']]], ['glfwmousebuttonfun_719',['GLFWmousebuttonfun',['../group__input.html#ga39893a4a7e7c3239c98d29c9e084350c',1,'glfw3.h']]], ['glfwscrollfun_720',['GLFWscrollfun',['../group__input.html#ga4687e2199c60a18a8dd1da532e6d75c9',1,'glfw3.h']]], ['glfwvidmode_721',['GLFWvidmode',['../group__monitor.html#gae48aadf4ea0967e6605c8f58fa5daccb',1,'glfw3.h']]], ['glfwvkproc_722',['GLFWvkproc',['../group__vulkan.html#ga70c01918dc9d233a4fbe0681a43018af',1,'glfw3.h']]], ['glfwwindow_723',['GLFWwindow',['../group__window.html#ga3c96d80d363e67d13a41b5d1821f3242',1,'glfw3.h']]], ['glfwwindowclosefun_724',['GLFWwindowclosefun',['../group__window.html#ga93e7c2555bd837f4ed8b20f76cada72e',1,'glfw3.h']]], ['glfwwindowcontentscalefun_725',['GLFWwindowcontentscalefun',['../group__window.html#ga1da46b65eafcc1a7ff0adb8f4a7b72fd',1,'glfw3.h']]], ['glfwwindowfocusfun_726',['GLFWwindowfocusfun',['../group__window.html#ga58be2061828dd35080bb438405d3a7e2',1,'glfw3.h']]], ['glfwwindowiconifyfun_727',['GLFWwindowiconifyfun',['../group__window.html#gad2d4e4c3d28b1242e742e8268b9528af',1,'glfw3.h']]], ['glfwwindowmaximizefun_728',['GLFWwindowmaximizefun',['../group__window.html#ga7269a3d1cb100c0081f95fc09afa4949',1,'glfw3.h']]], ['glfwwindowposfun_729',['GLFWwindowposfun',['../group__window.html#gafd8db81fdb0e850549dc6bace5ed697a',1,'glfw3.h']]], ['glfwwindowrefreshfun_730',['GLFWwindowrefreshfun',['../group__window.html#ga7a56f9e0227e2cd9470d80d919032e08',1,'glfw3.h']]], ['glfwwindowsizefun_731',['GLFWwindowsizefun',['../group__window.html#gae49ee6ebc03fa2da024b89943a331355',1,'glfw3.h']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_0.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_0.js ================================================ var searchData= [ ['axes_690',['axes',['../structGLFWgamepadstate.html#a8b2c8939b1d31458de5359998375c189',1,'GLFWgamepadstate']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_1.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_1.js ================================================ var searchData= [ ['blue_691',['blue',['../structGLFWgammaramp.html#acf0c836d0efe29c392fe8d1a1042744b',1,'GLFWgammaramp']]], ['bluebits_692',['blueBits',['../structGLFWvidmode.html#af310977f58d2e3b188175b6e3d314047',1,'GLFWvidmode']]], ['buttons_693',['buttons',['../structGLFWgamepadstate.html#a27e9896b51c65df15fba2c7139bfdb9a',1,'GLFWgamepadstate']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_2.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_2.js ================================================ var searchData= [ ['green_694',['green',['../structGLFWgammaramp.html#affccc6f5df47820b6562d709da3a5a3a',1,'GLFWgammaramp']]], ['greenbits_695',['greenBits',['../structGLFWvidmode.html#a292fdd281f3485fb3ff102a5bda43faa',1,'GLFWvidmode']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_3.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_3.js ================================================ var searchData= [ ['height_696',['height',['../structGLFWvidmode.html#ac65942a5f6981695517437a9d571d03c',1,'GLFWvidmode::height()'],['../structGLFWimage.html#a0b7d95368f0c80d5e5c9875057c7dbec',1,'GLFWimage::height()']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_4.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_4.js ================================================ var searchData= [ ['pixels_697',['pixels',['../structGLFWimage.html#a0c532a5c2bb715555279b7817daba0fb',1,'GLFWimage']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_5.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_5.js ================================================ var searchData= [ ['red_698',['red',['../structGLFWgammaramp.html#a2cce5d968734b685623eef913e635138',1,'GLFWgammaramp']]], ['redbits_699',['redBits',['../structGLFWvidmode.html#a6066c4ecd251098700062d3b735dba1b',1,'GLFWvidmode']]], ['refreshrate_700',['refreshRate',['../structGLFWvidmode.html#a791bdd6c7697b09f7e9c97054bf05649',1,'GLFWvidmode']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_6.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_6.js ================================================ var searchData= [ ['size_701',['size',['../structGLFWgammaramp.html#ad620e1cffbff9a32c51bca46301b59a5',1,'GLFWgammaramp']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/search/variables_7.html ================================================
    Loading...
    Searching...
    No Matches
    ================================================ FILE: thirdparty/glfw/docs/html/search/variables_7.js ================================================ var searchData= [ ['width_702',['width',['../structGLFWvidmode.html#a698dcb200562051a7249cb6ae154c71d',1,'GLFWvidmode::width()'],['../structGLFWimage.html#af6a71cc999fe6d3aea31dd7e9687d835',1,'GLFWimage::width()']]] ]; ================================================ FILE: thirdparty/glfw/docs/html/structGLFWgamepadstate.html ================================================ GLFW: GLFWgamepadstate Struct Reference
    GLFWgamepadstate Struct Reference

    Gamepad input state. More...

    Data Fields

    unsigned char buttons [15]
     
    float axes [6]
     

    Detailed Description

    This describes the input state of a gamepad.

    See also
    Gamepad input
    glfwGetGamepadState
    Since
    Added in version 3.3.

    Field Documentation

    ◆ buttons

    unsigned char GLFWgamepadstate::buttons[15]

    The states of each gamepad button, GLFW_PRESS or GLFW_RELEASE.

    ◆ axes

    float GLFWgamepadstate::axes[6]

    The states of each gamepad axis, in the range -1.0 to 1.0 inclusive.


    The documentation for this struct was generated from the following file:
    ================================================ FILE: thirdparty/glfw/docs/html/structGLFWgammaramp.html ================================================ GLFW: GLFWgammaramp Struct Reference
    GLFWgammaramp Struct Reference

    Gamma ramp. More...

    Data Fields

    unsigned short * red
     
    unsigned short * green
     
    unsigned short * blue
     
    unsigned int size
     

    Detailed Description

    This describes the gamma ramp for a monitor.

    See also
    Gamma ramp
    glfwGetGammaRamp
    glfwSetGammaRamp
    Since
    Added in version 3.0.

    Field Documentation

    ◆ red

    unsigned short* GLFWgammaramp::red

    An array of value describing the response of the red channel.

    ◆ green

    unsigned short* GLFWgammaramp::green

    An array of value describing the response of the green channel.

    ◆ blue

    unsigned short* GLFWgammaramp::blue

    An array of value describing the response of the blue channel.

    ◆ size

    unsigned int GLFWgammaramp::size

    The number of elements in each array.


    The documentation for this struct was generated from the following file:
    ================================================ FILE: thirdparty/glfw/docs/html/structGLFWimage.html ================================================ GLFW: GLFWimage Struct Reference
    GLFWimage Struct Reference

    Image data. More...

    Data Fields

    int width
     
    int height
     
    unsigned char * pixels
     

    Detailed Description

    This describes a single 2D image. See the documentation for each related function what the expected pixel format is.

    See also
    Custom cursor creation
    Window icon
    Since
    Added in version 2.1. GLFW 3: Removed format and bytes-per-pixel members.

    Field Documentation

    ◆ width

    int GLFWimage::width

    The width, in pixels, of this image.

    ◆ height

    int GLFWimage::height

    The height, in pixels, of this image.

    ◆ pixels

    unsigned char* GLFWimage::pixels

    The pixel data of this image, arranged left-to-right, top-to-bottom.


    The documentation for this struct was generated from the following file:
    ================================================ FILE: thirdparty/glfw/docs/html/structGLFWvidmode.html ================================================ GLFW: GLFWvidmode Struct Reference
    GLFWvidmode Struct Reference

    Video mode type. More...

    Data Fields

    int width
     
    int height
     
    int redBits
     
    int greenBits
     
    int blueBits
     
    int refreshRate
     

    Detailed Description

    This describes a single video mode.

    See also
    Video modes
    glfwGetVideoMode
    glfwGetVideoModes
    Since
    Added in version 1.0. GLFW 3: Added refresh rate member.

    Field Documentation

    ◆ width

    int GLFWvidmode::width

    The width, in screen coordinates, of the video mode.

    ◆ height

    int GLFWvidmode::height

    The height, in screen coordinates, of the video mode.

    ◆ redBits

    int GLFWvidmode::redBits

    The bit depth of the red channel of the video mode.

    ◆ greenBits

    int GLFWvidmode::greenBits

    The bit depth of the green channel of the video mode.

    ◆ blueBits

    int GLFWvidmode::blueBits

    The bit depth of the blue channel of the video mode.

    ◆ refreshRate

    int GLFWvidmode::refreshRate

    The refresh rate, in Hz, of the video mode.


    The documentation for this struct was generated from the following file:
    ================================================ FILE: thirdparty/glfw/docs/html/tabs.css ================================================ .sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} ================================================ FILE: thirdparty/glfw/docs/html/vulkan_8dox.html ================================================ GLFW: vulkan.dox File Reference
    vulkan.dox File Reference
    ================================================ FILE: thirdparty/glfw/docs/html/vulkan_guide.html ================================================ GLFW: Vulkan guide
    Vulkan guide

    This guide is intended to fill the gaps between the Vulkan documentation and the rest of the GLFW documentation and is not a replacement for either. It assumes some familiarity with Vulkan concepts like loaders, devices, queues and surfaces and leaves it to the Vulkan documentation to explain the details of Vulkan functions.

    To develop for Vulkan you should download the LunarG Vulkan SDK for your platform. Apart from headers and link libraries, they also provide the validation layers necessary for development.

    For details on a specific function in this category, see the Vulkan reference. There are also guides for the other areas of the GLFW API.

    Linking against the Vulkan loader

    By default, GLFW will look for the Vulkan loader on demand at runtime via its standard name (vulkan-1.dll on Windows, libvulkan.so.1 on Linux and other Unix-like systems and libvulkan.1.dylib on macOS). This means that GLFW does not need to be linked against the loader. However, it also means that if you are using the static library form of the Vulkan loader GLFW will either fail to find it or (worse) use the wrong one.

    The GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader directly instead of dynamically loading it at runtime. Not linking against the Vulkan loader will then be a compile-time error.

    macOS: Because the Vulkan loader and ICD are not installed globally on macOS, you need to set up the application bundle according to the LunarG SDK documentation. This is explained in more detail in the SDK documentation for macOS.

    Including the Vulkan and GLFW header files

    To include the Vulkan header, define GLFW_INCLUDE_VULKAN before including the GLFW header.

    #define GLFW_INCLUDE_VULKAN
    #include <GLFW/glfw3.h>

    If you instead want to include the Vulkan header from a custom location or use your own custom Vulkan header then do this before the GLFW header.

    #include <path/to/vulkan.h>
    #include <GLFW/glfw3.h>

    Unless a Vulkan header is included, either by the GLFW header or above it, any GLFW functions that take or return Vulkan types will not be declared.

    The VK_USE_PLATFORM_*_KHR macros do not need to be defined for the Vulkan part of GLFW to work. Define them only if you are using these extensions directly.

    Querying for Vulkan support

    If you are linking directly against the Vulkan loader then you can skip this section. The canonical desktop loader library exports all Vulkan core and Khronos extension functions, allowing them to be called directly.

    If you are loading the Vulkan loader dynamically instead of linking directly against it, you can check for the availability of a loader and ICD with glfwVulkanSupported.

    {
    // Vulkan is available, at least for compute
    }

    This function returns GLFW_TRUE if the Vulkan loader and any minimally functional ICD was found.

    If if one or both were not found, calling any other Vulkan related GLFW function will generate a GLFW_API_UNAVAILABLE error.

    Querying Vulkan function pointers

    To load any Vulkan core or extension function from the found loader, call glfwGetInstanceProcAddress. To load functions needed for instance creation, pass NULL as the instance.

    PFN_vkCreateInstance pfnCreateInstance = (PFN_vkCreateInstance)
    glfwGetInstanceProcAddress(NULL, "vkCreateInstance");

    Once you have created an instance, you can load from it all other Vulkan core functions and functions from any instance extensions you enabled.

    PFN_vkCreateDevice pfnCreateDevice = (PFN_vkCreateDevice)
    glfwGetInstanceProcAddress(instance, "vkCreateDevice");

    This function in turn calls vkGetInstanceProcAddr. If that fails, the function falls back to a platform-specific query of the Vulkan loader (i.e. dlsym or GetProcAddress). If that also fails, the function returns NULL. For more information about vkGetInstanceProcAddr, see the Vulkan documentation.

    Vulkan also provides vkGetDeviceProcAddr for loading device-specific versions of Vulkan function. This function can be retrieved from an instance with glfwGetInstanceProcAddress.

    PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)
    glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr");

    Device-specific functions may execute a little bit faster, due to not having to dispatch internally based on the device passed to them. For more information about vkGetDeviceProcAddr, see the Vulkan documentation.

    Querying required Vulkan extensions

    To do anything useful with Vulkan you need to create an instance. If you want to use Vulkan to render to a window, you must enable the instance extensions GLFW requires to create Vulkan surfaces.

    To query the instance extensions required, call glfwGetRequiredInstanceExtensions.

    uint32_t count;
    const char** extensions = glfwGetRequiredInstanceExtensions(&count);

    These extensions must all be enabled when creating instances that are going to be passed to glfwGetPhysicalDevicePresentationSupport and glfwCreateWindowSurface. The set of extensions will vary depending on platform and may also vary depending on graphics drivers and other factors.

    If it fails it will return NULL and GLFW will not be able to create Vulkan window surfaces. You can still use Vulkan for off-screen rendering and compute work.

    If successful the returned array will always include VK_KHR_surface, so if you don't require any additional extensions you can pass this list directly to the VkInstanceCreateInfo struct.

    VkInstanceCreateInfo ici;
    memset(&ici, 0, sizeof(ici));
    ici.enabledExtensionCount = count;
    ici.ppEnabledExtensionNames = extensions;
    ...

    Additional extensions may be required by future versions of GLFW. You should check whether any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the VkInstanceCreateInfo struct.

    Querying for Vulkan presentation support

    Not every queue family of every Vulkan device can present images to surfaces. To check whether a specific queue family of a physical device supports image presentation without first having to create a window and surface, call glfwGetPhysicalDevicePresentationSupport.

    if (glfwGetPhysicalDevicePresentationSupport(instance, physical_device, queue_family_index))
    {
    // Queue family supports image presentation
    }

    The VK_KHR_surface extension additionally provides the vkGetPhysicalDeviceSurfaceSupportKHR function, which performs the same test on an existing Vulkan surface.

    Creating the window

    Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan, there is no need to create a context. You can disable context creation with the GLFW_CLIENT_API hint.

    GLFWwindow* window = glfwCreateWindow(640, 480, "Window Title", NULL, NULL);

    See Windows without contexts for more information.

    Creating a Vulkan window surface

    You can create a Vulkan surface (as defined by the VK_KHR_surface extension) for a GLFW window with glfwCreateWindowSurface.

    VkSurfaceKHR surface;
    VkResult err = glfwCreateWindowSurface(instance, window, NULL, &surface);
    if (err)
    {
    // Window surface creation failed
    }

    If an OpenGL or OpenGL ES context was created on the window, the context has ownership of the presentation on the window and a Vulkan surface cannot be created.

    It is your responsibility to destroy the surface. GLFW does not destroy it for you. Call vkDestroySurfaceKHR function from the same extension to destroy it.

    The header of the GLFW 3 API.
    struct GLFWwindow GLFWwindow
    Opaque window object.
    Definition: glfw3.h:1152
    const char ** glfwGetRequiredInstanceExtensions(uint32_t *count)
    Returns the Vulkan instance extensions required by GLFW.
    int glfwVulkanSupported(void)
    Returns whether the Vulkan loader and an ICD have been found.
    VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow *window, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
    Creates a Vulkan surface for the specified window.
    #define GLFW_NO_API
    Definition: glfw3.h:1004
    #define GLFW_CLIENT_API
    Context client API hint and attribute.
    Definition: glfw3.h:917
    GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
    Creates a window and its associated context.
    void glfwWindowHint(int hint, int value)
    Sets the specified window hint to the desired value.
    int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily)
    Returns whether the specified queue family can present images.
    GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char *procname)
    Returns the address of the specified Vulkan instance function.
    ================================================ FILE: thirdparty/glfw/docs/html/window_8dox.html ================================================ GLFW: window.dox File Reference
    window.dox File Reference
    ================================================ FILE: thirdparty/glfw/docs/html/window_guide.html ================================================ GLFW: Window guide
    Window guide

    This guide introduces the window related functions of GLFW. For details on a specific function in this category, see the Window reference. There are also guides for the other areas of GLFW.

    Window objects

    The GLFWwindow object encapsulates both a window and a context. They are created with glfwCreateWindow and destroyed with glfwDestroyWindow, or glfwTerminate, if any remain. As the window and context are inseparably linked, the object pointer is used as both a context and window handle.

    To see the event stream provided to the various window related callbacks, run the events test program.

    Window creation

    A window and its OpenGL or OpenGL ES context are created with glfwCreateWindow, which returns a handle to the created window object. For example, this creates a 640 by 480 windowed mode window:

    GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);

    If window creation fails, NULL will be returned, so it is necessary to check the return value.

    The window handle is passed to all window related functions and is provided to along with all input events, so event handlers can tell which window received the event.

    Full screen windows

    To create a full screen window, you need to specify which monitor the window should use. In most cases, the user's primary monitor is a good choice. For more information about retrieving monitors, see Retrieving monitors.

    GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);

    Full screen windows cover the entire display area of a monitor, have no border or decorations.

    Windowed mode windows can be made full screen by setting a monitor with glfwSetWindowMonitor, and full screen ones can be made windowed by unsetting it with the same function.

    Each field of the GLFWvidmode structure corresponds to a function parameter or window hint and combine to form the desired video mode for that window. The supported video mode most closely matching the desired video mode will be set for the chosen monitor as long as the window has input focus. For more information about retrieving video modes, see Video modes.

    Video mode field Corresponds to
    GLFWvidmode.width width parameter of glfwCreateWindow
    GLFWvidmode.height height parameter of glfwCreateWindow
    GLFWvidmode.redBits GLFW_RED_BITS hint
    GLFWvidmode.greenBits GLFW_GREEN_BITS hint
    GLFWvidmode.blueBits GLFW_BLUE_BITS hint
    GLFWvidmode.refreshRate GLFW_REFRESH_RATE hint

    Once you have a full screen window, you can change its resolution, refresh rate and monitor with glfwSetWindowMonitor. If you only need change its resolution you can also call glfwSetWindowSize. In all cases, the new video mode will be selected the same way as the video mode chosen by glfwCreateWindow. If the window has an OpenGL or OpenGL ES context, it will be unaffected.

    By default, the original video mode of the monitor will be restored and the window iconified if it loses input focus, to allow the user to switch back to the desktop. This behavior can be disabled with the GLFW_AUTO_ICONIFY window hint, for example if you wish to simultaneously cover multiple monitors with full screen windows.

    If a monitor is disconnected, all windows that are full screen on that monitor will be switched to windowed mode. See Monitor configuration changes for more information.

    "Windowed full screen" windows

    If the closest match for the desired video mode is the current one, the video mode will not be changed, making window creation faster and application switching much smoother. This is sometimes called windowed full screen or borderless full screen window and counts as a full screen window. To create such a window, request the current video mode.

    This also works for windowed mode windows that are made full screen.

    const GLFWvidmode* mode = glfwGetVideoMode(monitor);
    glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);

    Note that glfwGetVideoMode returns the current video mode of a monitor, so if you already have a full screen window on that monitor that you want to make windowed full screen, you need to have saved the desktop resolution before.

    Window destruction

    When a window is no longer needed, destroy it with glfwDestroyWindow.

    Window destruction always succeeds. Before the actual destruction, all callbacks are removed so no further events will be delivered for the window. All windows remaining when glfwTerminate is called are destroyed as well.

    When a full screen window is destroyed, the original video mode of its monitor is restored, but the gamma ramp is left untouched.

    Window creation hints

    There are a number of hints that can be set before the creation of a window and context. Some affect the window itself, others affect the framebuffer or context. These hints are set to their default values each time the library is initialized with glfwInit. Integer value hints can be set individually with glfwWindowHint and string value hints with glfwWindowHintString. You can reset all at once to their defaults with glfwDefaultWindowHints.

    Some hints are platform specific. These are always valid to set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or calls.

    Note
    Window hints need to be set before the creation of the window and context you wish to have the specified attributes. They function as additional arguments to glfwCreateWindow.

    Hard and soft constraints

    Some window hints are hard constraints. These must match the available capabilities exactly for window and context creation to succeed. Hints that are not hard constraints are matched as closely as possible, but the resulting context and framebuffer may differ from what these hints requested.

    The following hints are always hard constraints:

    The following additional hints are hard constraints when requesting an OpenGL context, but are ignored when requesting an OpenGL ES context:

    Window related hints

    GLFW_RESIZABLE specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using the glfwSetWindowSize function. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen and undecorated windows.

    GLFW_VISIBLE specifies whether the windowed mode window will be initially visible. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen windows.

    GLFW_DECORATED specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen windows.

    GLFW_FOCUSED specifies whether the windowed mode window will be given input focus when created. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen and initially hidden windows.

    GLFW_AUTO_ICONIFY specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for windowed mode windows.

    GLFW_FLOATING specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen windows.

    GLFW_MAXIMIZED specifies whether the windowed mode window will be maximized when created. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen windows.

    GLFW_CENTER_CURSOR specifies whether the cursor should be centered over newly created full screen windows. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for windowed mode windows.

    GLFW_TRANSPARENT_FRAMEBUFFER specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values are GLFW_TRUE and GLFW_FALSE.

    Windows: GLFW sets a color key for the window to work around repainting issues with a transparent framebuffer. The chosen color value is RGB 255,0,255 (magenta). This will make pixels with that exact color fully transparent regardless of their alpha values. If this is a problem, make these pixels any other color before buffer swap.

    GLFW_FOCUS_ON_SHOW specifies whether the window will be given input focus when glfwShowWindow is called. Possible values are GLFW_TRUE and GLFW_FALSE.

    GLFW_SCALE_TO_MONITOR specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values are GLFW_TRUE and GLFW_FALSE.

    This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.

    Framebuffer related hints

    GLFW_RED_BITS, GLFW_GREEN_BITS, GLFW_BLUE_BITS, GLFW_ALPHA_BITS, GLFW_DEPTH_BITS and GLFW_STENCIL_BITS specify the desired bit depths of the various components of the default framebuffer. A value of GLFW_DONT_CARE means the application has no preference.

    GLFW_ACCUM_RED_BITS, GLFW_ACCUM_GREEN_BITS, GLFW_ACCUM_BLUE_BITS and GLFW_ACCUM_ALPHA_BITS specify the desired bit depths of the various components of the accumulation buffer. A value of GLFW_DONT_CARE means the application has no preference.

    Accumulation buffers are a legacy OpenGL feature and should not be used in new code.

    GLFW_AUX_BUFFERS specifies the desired number of auxiliary buffers. A value of GLFW_DONT_CARE means the application has no preference.

    Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.

    GLFW_STEREO specifies whether to use OpenGL stereoscopic rendering. Possible values are GLFW_TRUE and GLFW_FALSE. This is a hard constraint.

    GLFW_SAMPLES specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value of GLFW_DONT_CARE means the application has no preference.

    GLFW_SRGB_CAPABLE specifies whether the framebuffer should be sRGB capable. Possible values are GLFW_TRUE and GLFW_FALSE.

    OpenGL: If enabled and supported by the system, the GL_FRAMEBUFFER_SRGB enable will control sRGB rendering. By default, sRGB rendering will be disabled.
    OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.

    GLFW_DOUBLEBUFFER specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values are GLFW_TRUE and GLFW_FALSE.

    Monitor related hints

    GLFW_REFRESH_RATE specifies the desired refresh rate for full screen windows. A value of GLFW_DONT_CARE means the highest available refresh rate will be used. This hint is ignored for windowed mode windows.

    Context related hints

    GLFW_CLIENT_API specifies which client API to create the context for. Possible values are GLFW_OPENGL_API, GLFW_OPENGL_ES_API and GLFW_NO_API. This is a hard constraint.

    GLFW_CONTEXT_CREATION_API specifies which context creation API to use to create the context. Possible values are GLFW_NATIVE_CONTEXT_API, GLFW_EGL_CONTEXT_API and GLFW_OSMESA_CONTEXT_API. This is a hard constraint. If no client API is requested, this hint is ignored.

    macOS: The EGL API is not available on this platform and requests to use it will fail.
    Wayland: The EGL API is the native context creation API, so this hint will have no effect.
    OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functions glfwGetOSMesaColorBuffer and glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents.
    Note
    An OpenGL extension loader library that assumes it knows which context creation API is used on a given platform may fail if you change this hint. This can be resolved by having it load via glfwGetProcAddress, which always uses the selected API.
    Bug:
    On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.

    GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.

    Note
    Do not confuse these hints with GLFW_VERSION_MAJOR and GLFW_VERSION_MINOR, which provide the API version of the GLFW header.
    OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
    While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
    OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
    Note
    macOS: The OS only supports forward-compatible core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the GLFW_OPENGL_FORWARD_COMPAT and GLFW_OPENGL_PROFILE hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.

    GLFW_OPENGL_FORWARD_COMPAT specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.

    Forward-compatibility is described in detail in the OpenGL Reference Manual.

    GLFW_OPENGL_DEBUG_CONTEXT specifies whether to create a debug OpenGL context, which may have additional error and performance issue reporting functionality. Possible values are GLFW_TRUE and GLFW_FALSE. If OpenGL ES is requested, this hint is ignored.

    GLFW_OPENGL_PROFILE specifies which OpenGL profile to create the context for. Possible values are one of GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE, or GLFW_OPENGL_ANY_PROFILE to not request a specific profile. If requesting an OpenGL version below 3.2, GLFW_OPENGL_ANY_PROFILE must be used. If OpenGL ES is requested, this hint is ignored.

    OpenGL profiles are described in detail in the OpenGL Reference Manual.

    GLFW_CONTEXT_ROBUSTNESS specifies the robustness strategy to be used by the context. This can be one of GLFW_NO_RESET_NOTIFICATION or GLFW_LOSE_CONTEXT_ON_RESET, or GLFW_NO_ROBUSTNESS to not request a robustness strategy.

    GLFW_CONTEXT_RELEASE_BEHAVIOR specifies the release behavior to be used by the context. Possible values are one of GLFW_ANY_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_FLUSH or GLFW_RELEASE_BEHAVIOR_NONE. If the behavior is GLFW_ANY_RELEASE_BEHAVIOR, the default behavior of the context creation API will be used. If the behavior is GLFW_RELEASE_BEHAVIOR_FLUSH, the pipeline will be flushed whenever the context is released from being the current one. If the behavior is GLFW_RELEASE_BEHAVIOR_NONE, the pipeline will not be flushed on release.

    Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.

    GLFW_CONTEXT_NO_ERROR specifies whether errors should be generated by the context. Possible values are GLFW_TRUE and GLFW_FALSE. If enabled, situations that would have generated errors instead cause undefined behavior.

    The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.

    macOS specific window hints

    GLFW_COCOA_RETINA_FRAMEBUFFER specifies whether to use full resolution framebuffers on Retina displays. Possible values are GLFW_TRUE and GLFW_FALSE. This is ignored on other platforms.

    GLFW_COCOA_FRAME_NAME specifies the UTF-8 encoded name to use for autosaving the window frame, or if empty disables frame autosaving for the window. This is ignored on other platforms. This is set with glfwWindowHintString.

    GLFW_COCOA_GRAPHICS_SWITCHING specifies whether to in Automatic Graphics Switching, i.e. to allow the system to choose the integrated GPU for the OpenGL context and move it between GPUs if necessary or whether to force it to always run on the discrete GPU. This only affects systems with both integrated and discrete GPUs. Possible values are GLFW_TRUE and GLFW_FALSE. This is ignored on other platforms.

    Simpler programs and tools may want to enable this to save power, while games and other applications performing advanced rendering will want to leave it disabled.
    A bundled application that wishes to participate in Automatic Graphics Switching should also declare this in its Info.plist by setting the NSSupportsAutomaticGraphicsSwitching key to true.

    X11 specific window hints

    GLFW_X11_CLASS_NAME and GLFW_X11_INSTANCE_NAME specifies the desired ASCII encoded class and instance parts of the ICCCM WM_CLASS window property. These are set with glfwWindowHintString.

    Supported and default values

    Window hint Default value Supported values
    GLFW_RESIZABLE GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_VISIBLE GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_DECORATED GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_FOCUSED GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_AUTO_ICONIFY GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_FLOATING GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_MAXIMIZED GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_CENTER_CURSOR GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_TRANSPARENT_FRAMEBUFFER GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_FOCUS_ON_SHOW GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_SCALE_TO_MONITOR GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_RED_BITS 8 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_GREEN_BITS 8 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_BLUE_BITS 8 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_ALPHA_BITS 8 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_DEPTH_BITS 24 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_STENCIL_BITS 8 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_ACCUM_RED_BITS 0 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_ACCUM_GREEN_BITS 0 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_ACCUM_BLUE_BITS 0 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_ACCUM_ALPHA_BITS 0 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_AUX_BUFFERS 0 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_SAMPLES 0 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_REFRESH_RATE GLFW_DONT_CARE 0 to INT_MAX or GLFW_DONT_CARE
    GLFW_STEREO GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_SRGB_CAPABLE GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_DOUBLEBUFFER GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_CLIENT_API GLFW_OPENGL_API GLFW_OPENGL_API, GLFW_OPENGL_ES_API or GLFW_NO_API
    GLFW_CONTEXT_CREATION_API GLFW_NATIVE_CONTEXT_API GLFW_NATIVE_CONTEXT_API, GLFW_EGL_CONTEXT_API or GLFW_OSMESA_CONTEXT_API
    GLFW_CONTEXT_VERSION_MAJOR 1 Any valid major version number of the chosen client API
    GLFW_CONTEXT_VERSION_MINOR 0 Any valid minor version number of the chosen client API
    GLFW_CONTEXT_ROBUSTNESS GLFW_NO_ROBUSTNESS GLFW_NO_ROBUSTNESS, GLFW_NO_RESET_NOTIFICATION or GLFW_LOSE_CONTEXT_ON_RESET
    GLFW_CONTEXT_RELEASE_BEHAVIOR GLFW_ANY_RELEASE_BEHAVIOR GLFW_ANY_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_FLUSH or GLFW_RELEASE_BEHAVIOR_NONE
    GLFW_OPENGL_FORWARD_COMPAT GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_OPENGL_DEBUG_CONTEXT GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_OPENGL_PROFILE GLFW_OPENGL_ANY_PROFILE GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_COMPAT_PROFILE or GLFW_OPENGL_CORE_PROFILE
    GLFW_COCOA_RETINA_FRAMEBUFFER GLFW_TRUE GLFW_TRUE or GLFW_FALSE
    GLFW_COCOA_FRAME_NAME "" A UTF-8 encoded frame autosave name
    GLFW_COCOA_GRAPHICS_SWITCHING GLFW_FALSE GLFW_TRUE or GLFW_FALSE
    GLFW_X11_CLASS_NAME "" An ASCII encoded WM_CLASS class name
    GLFW_X11_INSTANCE_NAME "" An ASCII encoded WM_CLASS instance name

    Window event processing

    See Event processing.

    Window properties and events

    User pointer

    Each window has a user pointer that can be set with glfwSetWindowUserPointer and queried with glfwGetWindowUserPointer. This can be used for any purpose you need and will not be modified by GLFW throughout the life-time of the window.

    The initial value of the pointer is NULL.

    Window closing and close flag

    When the user attempts to close the window, for example by clicking the close widget or using a key chord like Alt+F4, the close flag of the window is set. The window is however not actually destroyed and, unless you watch for this state change, nothing further happens.

    The current state of the close flag is returned by glfwWindowShouldClose and can be set or cleared directly with glfwSetWindowShouldClose. A common pattern is to use the close flag as a main loop condition.

    while (!glfwWindowShouldClose(window))
    {
    render(window);
    glfwSwapBuffers(window);
    }

    If you wish to be notified when the user attempts to close a window, set a close callback.

    glfwSetWindowCloseCallback(window, window_close_callback);

    The callback function is called directly after the close flag has been set. It can be used for example to filter close requests and clear the close flag again unless certain conditions are met.

    void window_close_callback(GLFWwindow* window)
    {
    if (!time_to_close)
    }

    Window size

    The size of a window can be changed with glfwSetWindowSize. For windowed mode windows, this sets the size, in screen coordinates of the content area or content area of the window. The window system may impose limits on window size.

    glfwSetWindowSize(window, 640, 480);

    For full screen windows, the specified size becomes the new resolution of the window's desired video mode. The video mode most closely matching the new desired video mode is set immediately. The window is resized to fit the resolution of the set video mode.

    If you wish to be notified when a window is resized, whether by the user, the system or your own code, set a size callback.

    glfwSetWindowSizeCallback(window, window_size_callback);

    The callback function receives the new size, in screen coordinates, of the content area of the window when the window is resized.

    void window_size_callback(GLFWwindow* window, int width, int height)
    {
    }

    There is also glfwGetWindowSize for directly retrieving the current size of a window.

    int width, height;
    glfwGetWindowSize(window, &width, &height);
    Note
    Do not pass the window size to glViewport or other pixel-based OpenGL calls. The window size is in screen coordinates, not pixels. Use the framebuffer size, which is in pixels, for pixel-based calls.

    The above functions work with the size of the content area, but decorated windows typically have title bars and window frames around this rectangle. You can retrieve the extents of these with glfwGetWindowFrameSize.

    int left, top, right, bottom;
    glfwGetWindowFrameSize(window, &left, &top, &right, &bottom);

    The returned values are the distances, in screen coordinates, from the edges of the content area to the corresponding edges of the full window. As they are distances and not coordinates, they are always zero or positive.

    Framebuffer size

    While the size of a window is measured in screen coordinates, OpenGL works with pixels. The size you pass into glViewport, for example, should be in pixels. On some machines screen coordinates and pixels are the same, but on others they will not be. There is a second set of functions to retrieve the size, in pixels, of the framebuffer of a window.

    If you wish to be notified when the framebuffer of a window is resized, whether by the user or the system, set a size callback.

    glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

    The callback function receives the new size of the framebuffer when it is resized, which can for example be used to update the OpenGL viewport.

    void framebuffer_size_callback(GLFWwindow* window, int width, int height)
    {
    glViewport(0, 0, width, height);
    }

    There is also glfwGetFramebufferSize for directly retrieving the current size of the framebuffer of a window.

    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);

    The size of a framebuffer may change independently of the size of a window, for example if the window is dragged between a regular monitor and a high-DPI one.

    Window content scale

    The content scale for a window can be retrieved with glfwGetWindowContentScale.

    float xscale, yscale;
    glfwGetWindowContentScale(window, &xscale, &yscale);

    The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

    On systems where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on.

    If you wish to be notified when the content scale of a window changes, whether because of a system setting change or because it was moved to a monitor with a different scale, set a content scale callback.

    glfwSetWindowContentScaleCallback(window, window_content_scale_callback);

    The callback function receives the new content scale of the window.

    void window_content_scale_callback(GLFWwindow* window, float xscale, float yscale)
    {
    set_interface_scale(xscale, yscale);
    }

    On platforms where pixels and screen coordinates always map 1:1, the window will need to be resized to appear the same size when it is moved to a monitor with a different content scale. To have this done automatically both when the window is created and when its content scale later changes, set the GLFW_SCALE_TO_MONITOR window hint.

    Window size limits

    The minimum and maximum size of the content area of a windowed mode window can be enforced with glfwSetWindowSizeLimits. The user may resize the window to any size and aspect ratio within the specified limits, unless the aspect ratio is also set.

    glfwSetWindowSizeLimits(window, 200, 200, 400, 400);

    To specify only a minimum size or only a maximum one, set the other pair to GLFW_DONT_CARE.

    To disable size limits for a window, set them all to GLFW_DONT_CARE.

    The aspect ratio of the content area of a windowed mode window can be enforced with glfwSetWindowAspectRatio. The user may resize the window freely unless size limits are also set, but the size will be constrained to maintain the aspect ratio.

    glfwSetWindowAspectRatio(window, 16, 9);

    The aspect ratio is specified as a numerator and denominator, corresponding to the width and height, respectively. If you want a window to maintain its current aspect ratio, use its current size as the ratio.

    int width, height;
    glfwGetWindowSize(window, &width, &height);
    glfwSetWindowAspectRatio(window, width, height);

    To disable the aspect ratio limit for a window, set both terms to GLFW_DONT_CARE.

    You can have both size limits and aspect ratio set for a window, but the results are undefined if they conflict.

    Window position

    The position of a windowed-mode window can be changed with glfwSetWindowPos. This moves the window so that the upper-left corner of its content area has the specified screen coordinates. The window system may put limitations on window placement.

    glfwSetWindowPos(window, 100, 100);

    If you wish to be notified when a window is moved, whether by the user, the system or your own code, set a position callback.

    glfwSetWindowPosCallback(window, window_pos_callback);

    The callback function receives the new position, in screen coordinates, of the upper-left corner of the content area when the window is moved.

    void window_pos_callback(GLFWwindow* window, int xpos, int ypos)
    {
    }

    There is also glfwGetWindowPos for directly retrieving the current position of the content area of the window.

    int xpos, ypos;
    glfwGetWindowPos(window, &xpos, &ypos);

    Window title

    All GLFW windows have a title, although undecorated or full screen windows may not display it or only display it in a task bar or similar interface. You can set a UTF-8 encoded window title with glfwSetWindowTitle.

    glfwSetWindowTitle(window, "My Window");

    The specified string is copied before the function returns, so there is no need to keep it around.

    As long as your source file is encoded as UTF-8, you can use any Unicode characters directly in the source.

    glfwSetWindowTitle(window, "ラストエグザイル");

    If you are using C++11 or C11, you can use a UTF-8 string literal.

    glfwSetWindowTitle(window, u8"This is always a UTF-8 string");

    Window icon

    Decorated windows have icons on some platforms. You can set this icon by specifying a list of candidate images with glfwSetWindowIcon.

    GLFWimage images[2];
    images[0] = load_icon("my_icon.png");
    images[1] = load_icon("my_icon_small.png");
    glfwSetWindowIcon(window, 2, images);

    The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. The pixels are arranged canonically as sequential rows, starting from the top-left corner.

    To revert to the default window icon, pass in an empty image array.

    glfwSetWindowIcon(window, 0, NULL);

    Window monitor

    Full screen windows are associated with a specific monitor. You can get the handle for this monitor with glfwGetWindowMonitor.

    GLFWmonitor* monitor = glfwGetWindowMonitor(window);

    This monitor handle is one of those returned by glfwGetMonitors.

    For windowed mode windows, this function returns NULL. This is how to tell full screen windows from windowed mode windows.

    You can move windows between monitors or between full screen and windowed mode with glfwSetWindowMonitor. When making a window full screen on the same or on a different monitor, specify the desired monitor, resolution and refresh rate. The position arguments are ignored.

    const GLFWvidmode* mode = glfwGetVideoMode(monitor);
    glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);

    When making the window windowed, specify the desired position and size. The refresh rate argument is ignored.

    glfwSetWindowMonitor(window, NULL, xpos, ypos, width, height, 0);

    This restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.. To restore a window that was originally windowed to its original size and position, save these before making it full screen and then pass them in as above.

    Window iconification

    Windows can be iconified (i.e. minimized) with glfwIconifyWindow.

    When a full screen window is iconified, the original video mode of its monitor is restored until the user or application restores the window.

    Iconified windows can be restored with glfwRestoreWindow. This function also restores windows from maximization.

    When a full screen window is restored, the desired video mode is restored to its monitor as well.

    If you wish to be notified when a window is iconified or restored, whether by the user, system or your own code, set an iconify callback.

    glfwSetWindowIconifyCallback(window, window_iconify_callback);

    The callback function receives changes in the iconification state of the window.

    void window_iconify_callback(GLFWwindow* window, int iconified)
    {
    if (iconified)
    {
    // The window was iconified
    }
    else
    {
    // The window was restored
    }
    }

    You can also get the current iconification state with glfwGetWindowAttrib.

    int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);

    Window maximization

    Windows can be maximized (i.e. zoomed) with glfwMaximizeWindow.

    Full screen windows cannot be maximized and passing a full screen window to this function does nothing.

    Maximized windows can be restored with glfwRestoreWindow. This function also restores windows from iconification.

    If you wish to be notified when a window is maximized or restored, whether by the user, system or your own code, set a maximize callback.

    glfwSetWindowMaximizeCallback(window, window_maximize_callback);

    The callback function receives changes in the maximization state of the window.

    void window_maximize_callback(GLFWwindow* window, int maximized)
    {
    if (maximized)
    {
    // The window was maximized
    }
    else
    {
    // The window was restored
    }
    }

    You can also get the current maximization state with glfwGetWindowAttrib.

    int maximized = glfwGetWindowAttrib(window, GLFW_MAXIMIZED);

    By default, newly created windows are not maximized. You can change this behavior by setting the GLFW_MAXIMIZED window hint before creating the window.

    Window visibility

    Windowed mode windows can be hidden with glfwHideWindow.

    This makes the window completely invisible to the user, including removing it from the task bar, dock or window list. Full screen windows cannot be hidden and calling glfwHideWindow on a full screen window does nothing.

    Hidden windows can be shown with glfwShowWindow.

    By default, this function will also set the input focus to that window. Set the GLFW_FOCUS_ON_SHOW window hint to change this behavior for all newly created windows, or change the behavior for an existing window with glfwSetWindowAttrib.

    You can also get the current visibility state with glfwGetWindowAttrib.

    int visible = glfwGetWindowAttrib(window, GLFW_VISIBLE);

    By default, newly created windows are visible. You can change this behavior by setting the GLFW_VISIBLE window hint before creating the window.

    Windows created hidden are completely invisible to the user until shown. This can be useful if you need to set up your window further before showing it, for example moving it to a specific location.

    Window input focus

    Windows can be given input focus and brought to the front with glfwFocusWindow.

    Keep in mind that it can be very disruptive to the user when a window is forced to the top. For a less disruptive way of getting the user's attention, see attention requests.

    If you wish to be notified when a window gains or loses input focus, whether by the user, system or your own code, set a focus callback.

    glfwSetWindowFocusCallback(window, window_focus_callback);

    The callback function receives changes in the input focus state of the window.

    void window_focus_callback(GLFWwindow* window, int focused)
    {
    if (focused)
    {
    // The window gained input focus
    }
    else
    {
    // The window lost input focus
    }
    }

    You can also get the current input focus state with glfwGetWindowAttrib.

    int focused = glfwGetWindowAttrib(window, GLFW_FOCUSED);

    By default, newly created windows are given input focus. You can change this behavior by setting the GLFW_FOCUSED window hint before creating the window.

    Window attention request

    If you wish to notify the user of an event without interrupting, you can request attention with glfwRequestWindowAttention.

    The system will highlight the specified window, or on platforms where this is not supported, the application as a whole. Once the user has given it attention, the system will automatically end the request.

    Window damage and refresh

    If you wish to be notified when the contents of a window is damaged and needs to be refreshed, set a window refresh callback.

    glfwSetWindowRefreshCallback(m_handle, window_refresh_callback);

    The callback function is called when the contents of the window needs to be refreshed.

    void window_refresh_callback(GLFWwindow* window)
    {
    draw_editor_ui(window);
    glfwSwapBuffers(window);
    }
    Note
    On compositing window systems such as Aero, Compiz or Aqua, where the window contents are saved off-screen, this callback might only be called when the window or framebuffer is resized.

    Window transparency

    GLFW supports two kinds of transparency for windows; framebuffer transparency and whole window transparency. A single window may not use both methods. The results of doing this are undefined.

    Both methods require the platform to support it and not every version of every platform GLFW supports does this, so there are mechanisms to check whether the window really is transparent.

    Window framebuffers can be made transparent on a per-pixel per-frame basis with the GLFW_TRANSPARENT_FRAMEBUFFER window hint.

    If supported by the system, the window content area will be composited with the background using the framebuffer per-pixel alpha channel. This requires desktop compositing to be enabled on the system. It does not affect window decorations.

    You can check whether the window framebuffer was successfully made transparent with the GLFW_TRANSPARENT_FRAMEBUFFER window attribute.

    {
    // window framebuffer is currently transparent
    }

    GLFW comes with an example that enabled framebuffer transparency called gears.

    The opacity of the whole window, including any decorations, can be set with glfwSetWindowOpacity.

    glfwSetWindowOpacity(window, 0.5f);

    The opacity (or alpha) value is a positive finite number between zero and one, where 0 (zero) is fully transparent and 1 (one) is fully opaque. The initial opacity value for newly created windows is 1.

    The current opacity of a window can be queried with glfwGetWindowOpacity.

    float opacity = glfwGetWindowOpacity(window);

    If the system does not support whole window transparency, this function always returns one.

    GLFW comes with a test program that lets you control whole window transparency at run-time called opacity.

    Window attributes

    Windows have a number of attributes that can be returned using glfwGetWindowAttrib. Some reflect state that may change as a result of user interaction, (e.g. whether it has input focus), while others reflect inherent properties of the window (e.g. what kind of border it has). Some are related to the window and others to its OpenGL or OpenGL ES context.

    {
    // window has input focus
    }

    The GLFW_DECORATED, GLFW_RESIZABLE, GLFW_FLOATING, GLFW_AUTO_ICONIFY and GLFW_FOCUS_ON_SHOW window attributes can be changed with glfwSetWindowAttrib.

    Window related attributes

    GLFW_FOCUSED indicates whether the specified window has input focus. See Window input focus for details.

    GLFW_ICONIFIED indicates whether the specified window is iconified. See Window iconification for details.

    GLFW_MAXIMIZED indicates whether the specified window is maximized. See Window maximization for details.

    GLFW_HOVERED indicates whether the cursor is currently directly over the content area of the window, with no other windows between. See Cursor enter/leave events for details.

    GLFW_VISIBLE indicates whether the specified window is visible. See Window visibility for details.

    GLFW_RESIZABLE indicates whether the specified window is resizable by the user. This can be set before creation with the GLFW_RESIZABLE window hint or after with glfwSetWindowAttrib.

    GLFW_DECORATED indicates whether the specified window has decorations such as a border, a close widget, etc. This can be set before creation with the GLFW_DECORATED window hint or after with glfwSetWindowAttrib.

    GLFW_AUTO_ICONIFY indicates whether the specified full screen window is iconified on focus loss, a close widget, etc. This can be set before creation with the GLFW_AUTO_ICONIFY window hint or after with glfwSetWindowAttrib.

    GLFW_FLOATING indicates whether the specified window is floating, also called topmost or always-on-top. This can be set before creation with the GLFW_FLOATING window hint or after with glfwSetWindowAttrib.

    GLFW_TRANSPARENT_FRAMEBUFFER indicates whether the specified window has a transparent framebuffer, i.e. the window contents is composited with the background using the window framebuffer alpha channel. See Window transparency for details.

    GLFW_FOCUS_ON_SHOW specifies whether the window will be given input focus when glfwShowWindow is called. This can be set before creation with the GLFW_FOCUS_ON_SHOW window hint or after with glfwSetWindowAttrib.

    Context related attributes

    GLFW_CLIENT_API indicates the client API provided by the window's context; either GLFW_OPENGL_API, GLFW_OPENGL_ES_API or GLFW_NO_API.

    GLFW_CONTEXT_CREATION_API indicates the context creation API used to create the window's context; either GLFW_NATIVE_CONTEXT_API, GLFW_EGL_CONTEXT_API or GLFW_OSMESA_CONTEXT_API.

    GLFW_CONTEXT_VERSION_MAJOR, GLFW_CONTEXT_VERSION_MINOR and GLFW_CONTEXT_REVISION indicate the client API version of the window's context.

    Note
    Do not confuse these attributes with GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR and GLFW_VERSION_REVISION which provide the API version of the GLFW header.

    GLFW_OPENGL_FORWARD_COMPAT is GLFW_TRUE if the window's context is an OpenGL forward-compatible one, or GLFW_FALSE otherwise.

    GLFW_OPENGL_DEBUG_CONTEXT is GLFW_TRUE if the window's context is an OpenGL debug context, or GLFW_FALSE otherwise.

    GLFW_OPENGL_PROFILE indicates the OpenGL profile used by the context. This is GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE if the context uses a known profile, or GLFW_OPENGL_ANY_PROFILE if the OpenGL profile is unknown or the context is an OpenGL ES context. Note that the returned profile may not match the profile bits of the context flags, as GLFW will try other means of detecting the profile when no bits are set.

    GLFW_CONTEXT_RELEASE_BEHAVIOR indicates the release used by the context. Possible values are one of GLFW_ANY_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_FLUSH or GLFW_RELEASE_BEHAVIOR_NONE. If the behavior is GLFW_ANY_RELEASE_BEHAVIOR, the default behavior of the context creation API will be used. If the behavior is GLFW_RELEASE_BEHAVIOR_FLUSH, the pipeline will be flushed whenever the context is released from being the current one. If the behavior is GLFW_RELEASE_BEHAVIOR_NONE, the pipeline will not be flushed on release.

    GLFW_CONTEXT_NO_ERROR indicates whether errors are generated by the context. Possible values are GLFW_TRUE and GLFW_FALSE. If enabled, situations that would have generated errors instead cause undefined behavior.

    GLFW_CONTEXT_ROBUSTNESS indicates the robustness strategy used by the context. This is GLFW_LOSE_CONTEXT_ON_RESET or GLFW_NO_RESET_NOTIFICATION if the window's context supports robustness, or GLFW_NO_ROBUSTNESS otherwise.

    Framebuffer related attributes

    GLFW does not expose attributes of the default framebuffer (i.e. the framebuffer attached to the window) as these can be queried directly with either OpenGL, OpenGL ES or Vulkan.

    If you are using version 3.0 or later of OpenGL or OpenGL ES, the glGetFramebufferAttachmentParameteriv function can be used to retrieve the number of bits for the red, green, blue, alpha, depth and stencil buffer channels. Otherwise, the glGetIntegerv function can be used.

    The number of MSAA samples are always retrieved with glGetIntegerv. For contexts supporting framebuffer objects, the number of samples of the currently bound framebuffer is returned.

    Attribute glGetIntegerv glGetFramebufferAttachmentParameteriv
    Red bits GL_RED_BITS GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
    Green bits GL_GREEN_BITS GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
    Blue bits GL_BLUE_BITS GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
    Alpha bits GL_ALPHA_BITS GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
    Depth bits GL_DEPTH_BITS GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
    Stencil bits GL_STENCIL_BITS GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
    MSAA samples GL_SAMPLES Not provided by this function

    When calling glGetFramebufferAttachmentParameteriv, the red, green, blue and alpha sizes are queried from the GL_BACK_LEFT, while the depth and stencil sizes are queried from the GL_DEPTH and GL_STENCIL attachments, respectively.

    Buffer swapping

    GLFW windows are by default double buffered. That means that you have two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.

    When the entire frame has been rendered, it is time to swap the back and the front buffers in order to display what has been rendered and begin rendering a new frame. This is done with glfwSwapBuffers.

    Sometimes it can be useful to select when the buffer swap will occur. With the function glfwSwapInterval it is possible to select the minimum number of monitor refreshes the driver should wait from the time glfwSwapBuffers was called before swapping the buffers:

    If the interval is zero, the swap will take place immediately when glfwSwapBuffers is called without waiting for a refresh. Otherwise at least interval retraces will pass between each buffer swap. Using a swap interval of zero can be useful for benchmarking purposes, when it is not desirable to measure the time it takes to wait for the vertical retrace. However, a swap interval of one lets you avoid tearing.

    Note that this may not work on all machines, as some drivers have user-controlled settings that override any swap interval the application requests.

    A context that supports either the WGL_EXT_swap_control_tear or the GLX_EXT_swap_control_tear extension also accepts negative swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. This trades the risk of visible tears for greater framerate stability. You can check for these extensions with glfwExtensionSupported.

    #define GLFW_TRANSPARENT_FRAMEBUFFER
    Window framebuffer transparency hint and attribute.
    Definition: glfw3.h:818
    GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow *window, GLFWframebuffersizefun callback)
    Sets the framebuffer resize callback for the specified window.
    void glfwSetWindowSize(GLFWwindow *window, int width, int height)
    Sets the size of the content area of the specified window.
    #define GLFW_RED_BITS
    Framebuffer bit depth hint.
    Definition: glfw3.h:835
    void glfwSetWindowPos(GLFWwindow *window, int xpos, int ypos)
    Sets the position of the content area of the specified window.
    void glfwSetWindowAttrib(GLFWwindow *window, int attrib, int value)
    Sets an attribute of the specified window.
    void glfwRestoreWindow(GLFWwindow *window)
    Restores the specified window.
    void glfwGetWindowContentScale(GLFWwindow *window, float *xscale, float *yscale)
    Retrieves the content scale for the specified window.
    GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow *window, GLFWwindowrefreshfun callback)
    Sets the refresh callback for the specified window.
    GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow *window, GLFWwindowsizefun callback)
    Sets the size callback for the specified window.
    void glfwSetWindowMonitor(GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)
    Sets the mode, monitor, video mode and placement of a window.
    void glfwGetWindowPos(GLFWwindow *window, int *xpos, int *ypos)
    Retrieves the position of the content area of the specified window.
    GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow *window, GLFWwindowmaximizefun callback)
    Sets the maximize callback for the specified window.
    void glfwSetWindowTitle(GLFWwindow *window, const char *title)
    Sets the title of the specified window.
    struct GLFWwindow GLFWwindow
    Opaque window object.
    Definition: glfw3.h:1152
    void glfwSwapBuffers(GLFWwindow *window)
    Swaps the front and back buffers of the specified window.
    void glfwSwapInterval(int interval)
    Sets the swap interval for the current context.
    int blueBits
    Definition: glfw3.h:1640
    void glfwGetWindowFrameSize(GLFWwindow *window, int *left, int *top, int *right, int *bottom)
    Retrieves the size of the frame of the window.
    #define GLFW_GREEN_BITS
    Framebuffer bit depth hint.
    Definition: glfw3.h:840
    int glfwWindowShouldClose(GLFWwindow *window)
    Checks the close flag of the specified window.
    void glfwPollEvents(void)
    Processes all pending events.
    void glfwSetWindowSizeLimits(GLFWwindow *window, int minwidth, int minheight, int maxwidth, int maxheight)
    Sets the size limits of the specified window.
    GLFWmonitor * glfwGetPrimaryMonitor(void)
    Returns the primary monitor.
    GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow *window, GLFWwindowfocusfun callback)
    Sets the focus callback for the specified window.
    GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow *window, GLFWwindowclosefun callback)
    Sets the close callback for the specified window.
    void glfwFocusWindow(GLFWwindow *window)
    Brings the specified window to front and sets input focus.
    int height
    Definition: glfw3.h:1631
    GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow *window, GLFWwindowcontentscalefun callback)
    Sets the window content scale callback for the specified window.
    GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow *window, GLFWwindowposfun callback)
    Sets the position callback for the specified window.
    #define GLFW_FALSE
    Zero.
    Definition: glfw3.h:289
    #define GLFW_DONT_CARE
    Definition: glfw3.h:1096
    void glfwShowWindow(GLFWwindow *window)
    Makes the specified window visible.
    #define GLFW_TRUE
    One.
    Definition: glfw3.h:280
    #define GLFW_ICONIFIED
    Window iconification window attribute.
    Definition: glfw3.h:770
    void glfwRequestWindowAttention(GLFWwindow *window)
    Requests user attention to the specified window.
    #define GLFW_RESIZABLE
    Window resize-ability window hint and attribute.
    Definition: glfw3.h:776
    #define GLFW_FOCUSED
    Input focus window hint and attribute.
    Definition: glfw3.h:765
    #define GLFW_BLUE_BITS
    Framebuffer bit depth hint.
    Definition: glfw3.h:845
    void glfwHideWindow(GLFWwindow *window)
    Hides the specified window.
    int width
    Definition: glfw3.h:1628
    void glfwMaximizeWindow(GLFWwindow *window)
    Maximizes the specified window.
    void glfwSetWindowIcon(GLFWwindow *window, int count, const GLFWimage *images)
    Sets the icon for the specified window.
    GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
    Creates a window and its associated context.
    void glfwSetWindowShouldClose(GLFWwindow *window, int value)
    Sets the close flag of the specified window.
    void glfwSetWindowAspectRatio(GLFWwindow *window, int numer, int denom)
    Sets the aspect ratio of the specified window.
    int greenBits
    Definition: glfw3.h:1637
    float glfwGetWindowOpacity(GLFWwindow *window)
    Returns the opacity of the whole window.
    Image data.
    Definition: glfw3.h:1687
    void glfwSetWindowOpacity(GLFWwindow *window, float opacity)
    Sets the opacity of the whole window.
    GLFWmonitor * glfwGetWindowMonitor(GLFWwindow *window)
    Returns the monitor that the window uses for full screen mode.
    void glfwIconifyWindow(GLFWwindow *window)
    Iconifies the specified window.
    #define GLFW_MAXIMIZED
    Window maximization window hint and attribute.
    Definition: glfw3.h:806
    int glfwGetWindowAttrib(GLFWwindow *window, int attrib)
    Returns an attribute of the specified window.
    GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow *window, GLFWwindowiconifyfun callback)
    Sets the iconify callback for the specified window.
    void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
    Retrieves the size of the content area of the specified window.
    Video mode type.
    Definition: glfw3.h:1624
    void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
    Retrieves the size of the framebuffer of the specified window.
    int redBits
    Definition: glfw3.h:1634
    #define GLFW_REFRESH_RATE
    Monitor refresh rate hint.
    Definition: glfw3.h:905
    void glfwWindowHint(int hint, int value)
    Sets the specified window hint to the desired value.
    #define GLFW_VISIBLE
    Window visibility window hint and attribute.
    Definition: glfw3.h:782
    const GLFWvidmode * glfwGetVideoMode(GLFWmonitor *monitor)
    Returns the current mode of the specified monitor.
    void glfwDestroyWindow(GLFWwindow *window)
    Destroys the specified window and its context.
    struct GLFWmonitor GLFWmonitor
    Opaque monitor object.
    Definition: glfw3.h:1140
    int refreshRate
    Definition: glfw3.h:1643
    ================================================ FILE: thirdparty/glfw/docs/input.dox ================================================ /*! @page input_guide Input guide @tableofcontents This guide introduces the input related functions of GLFW. For details on a specific function in this category, see the @ref input. There are also guides for the other areas of GLFW. - @ref intro_guide - @ref window_guide - @ref context_guide - @ref vulkan_guide - @ref monitor_guide GLFW provides many kinds of input. While some can only be polled, like time, or only received via callbacks, like scrolling, many provide both callbacks and polling. Callbacks are more work to use than polling but is less CPU intensive and guarantees that you do not miss state changes. All input callbacks receive a window handle. By using the [window user pointer](@ref window_userptr), you can access non-global structures or objects from your callbacks. To get a better feel for how the various events callbacks behave, run the `events` test program. It register every callback supported by GLFW and prints out all arguments provided for every event, along with time and sequence information. @section events Event processing GLFW needs to poll the window system for events both to provide input to the application and to prove to the window system that the application hasn't locked up. Event processing is normally done each frame after [buffer swapping](@ref buffer_swap). Even when you have no windows, event polling needs to be done in order to receive monitor and joystick connection events. There are three functions for processing pending events. @ref glfwPollEvents, processes only those events that have already been received and then returns immediately. @code glfwPollEvents(); @endcode This is the best choice when rendering continuously, like most games do. If you only need to update the contents of the window when you receive new input, @ref glfwWaitEvents is a better choice. @code glfwWaitEvents(); @endcode It puts the thread to sleep until at least one event has been received and then processes all received events. This saves a great deal of CPU cycles and is useful for, for example, editing tools. If you want to wait for events but have UI elements or other tasks that need periodic updates, @ref glfwWaitEventsTimeout lets you specify a timeout. @code glfwWaitEventsTimeout(0.7); @endcode It puts the thread to sleep until at least one event has been received, or until the specified number of seconds have elapsed. It then processes any received events. If the main thread is sleeping in @ref glfwWaitEvents, you can wake it from another thread by posting an empty event to the event queue with @ref glfwPostEmptyEvent. @code glfwPostEmptyEvent(); @endcode Do not assume that callbacks will _only_ be called in response to the above functions. While it is necessary to process events in one or more of the ways above, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning. For example, on Windows the system function that @ref glfwSetWindowSize is implemented with will send window size events directly to the event callback that every window has and that GLFW implements for its windows. If you have set a [window size callback](@ref window_size) GLFW will call it in turn with the new size before everything returns back out of the @ref glfwSetWindowSize call. @section input_keyboard Keyboard input GLFW divides keyboard input into two categories; key events and character events. Key events relate to actual physical keyboard keys, whereas character events relate to the Unicode code points generated by pressing some of them. Keys and characters do not map 1:1. A single key press may produce several characters, and a single character may require several keys to produce. This may not be the case on your machine, but your users are likely not all using the same keyboard layout, input method or even operating system as you. @subsection input_key Key input If you wish to be notified when a physical key is pressed or released or when it repeats, set a key callback. @code glfwSetKeyCallback(window, key_callback); @endcode The callback function receives the [keyboard key](@ref keys), platform-specific scancode, key action and [modifier bits](@ref mods). @code void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_E && action == GLFW_PRESS) activate_airship(); } @endcode The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it, for example _E-mail_ and _Play_ keys. The scancode is unique for every key, regardless of whether it has a key token. Scancodes are platform-specific but consistent over time, so keys will have different scancodes depending on the platform but they are safe to save to disk. You can query the scancode for any [named key](@ref keys) on the current platform with @ref glfwGetKeyScancode. @code const int scancode = glfwGetKeyScancode(GLFW_KEY_X); set_key_mapping(scancode, swap_weapons); @endcode The last reported state for every [named key](@ref keys) is also saved in per-window state arrays that can be polled with @ref glfwGetKey. @code int state = glfwGetKey(window, GLFW_KEY_E); if (state == GLFW_PRESS) { activate_airship(); } @endcode The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`. This function only returns cached key event state. It does not poll the system for the current physical state of the key. @anchor GLFW_STICKY_KEYS Whenever you poll state, you risk missing the state change you are looking for. If a pressed key is released again before you poll its state, you will have missed the key press. The recommended solution for this is to use a key callback, but there is also the `GLFW_STICKY_KEYS` input mode. @code glfwSetInputMode(window, GLFW_STICKY_KEYS, GLFW_TRUE); @endcode When sticky keys mode is enabled, the pollable state of a key will remain `GLFW_PRESS` until the state of that key is polled with @ref glfwGetKey. Once it has been polled, if a key release event had been processed in the meantime, the state will reset to `GLFW_RELEASE`, otherwise it will remain `GLFW_PRESS`. @anchor GLFW_LOCK_KEY_MODS If you wish to know what the state of the Caps Lock and Num Lock keys was when input events were generated, set the `GLFW_LOCK_KEY_MODS` input mode. @code glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, GLFW_TRUE); @endcode When this input mode is enabled, any callback that receives [modifier bits](@ref mods) will have the @ref GLFW_MOD_CAPS_LOCK bit set if Caps Lock was on when the event occurred and the @ref GLFW_MOD_NUM_LOCK bit set if Num Lock was on. The `GLFW_KEY_LAST` constant holds the highest value of any [named key](@ref keys). @subsection input_char Text input GLFW supports text input in the form of a stream of [Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the operating system text input system. Unlike key input, text input obeys keyboard layouts and modifier keys and supports composing characters using [dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can encode the code points into UTF-8 or any other encoding you prefer. Because an `unsigned int` is 32 bits long on all platforms supported by GLFW, you can treat the code point argument as native endian UTF-32. If you wish to offer regular text input, set a character callback. @code glfwSetCharCallback(window, character_callback); @endcode The callback function receives Unicode code points for key events that would have led to regular text input and generally behaves as a standard text field on that platform. @code void character_callback(GLFWwindow* window, unsigned int codepoint) { } @endcode @subsection input_key_name Key names If you wish to refer to keys by name, you can query the keyboard layout dependent name of printable keys with @ref glfwGetKeyName. @code const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0); show_tutorial_hint("Press %s to move forward", key_name); @endcode This function can handle both [keys and scancodes](@ref input_key). If the specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is ignored. This matches the behavior of the key callback, meaning the callback arguments can always be passed unmodified to this function. @section input_mouse Mouse input Mouse input comes in many forms, including mouse motion, button presses and scrolling offsets. The cursor appearance can also be changed, either to a custom image or a standard cursor shape from the system theme. @subsection cursor_pos Cursor position If you wish to be notified when the cursor moves over the window, set a cursor position callback. @code glfwSetCursorPosCallback(window, cursor_position_callback); @endcode The callback functions receives the cursor position, measured in screen coordinates but relative to the top-left corner of the window content area. On platforms that provide it, the full sub-pixel cursor position is passed on. @code static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos) { } @endcode The cursor position is also saved per-window and can be polled with @ref glfwGetCursorPos. @code double xpos, ypos; glfwGetCursorPos(window, &xpos, &ypos); @endcode @subsection cursor_mode Cursor mode @anchor GLFW_CURSOR The `GLFW_CURSOR` input mode provides several cursor modes for special forms of mouse motion input. By default, the cursor mode is `GLFW_CURSOR_NORMAL`, meaning the regular arrow cursor (or another cursor set with @ref glfwSetCursor) is used and cursor motion is not limited. If you wish to implement mouse motion based camera controls or other input schemes that require unlimited mouse movement, set the cursor mode to `GLFW_CURSOR_DISABLED`. @code glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); @endcode This will hide the cursor and lock it to the specified window. GLFW will then take care of all the details of cursor re-centering and offset calculation and providing the application with a virtual cursor position. This virtual position is provided normally via both the cursor position callback and through polling. @note You should not implement your own version of this functionality using other features of GLFW. It is not supported and will not work as robustly as `GLFW_CURSOR_DISABLED`. If you only wish the cursor to become hidden when it is over a window but still want it to behave normally, set the cursor mode to `GLFW_CURSOR_HIDDEN`. @code glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); @endcode This mode puts no limit on the motion of the cursor. To exit out of either of these special modes, restore the `GLFW_CURSOR_NORMAL` cursor mode. @code glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); @endcode @anchor GLFW_RAW_MOUSE_MOTION @subsection raw_mouse_motion Raw mouse motion When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can be enabled if available. Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse motion is only provided when the cursor is disabled. Call @ref glfwRawMouseMotionSupported to check if the current machine provides raw motion and set the `GLFW_RAW_MOUSE_MOTION` input mode to enable it. It is disabled by default. @code if (glfwRawMouseMotionSupported()) glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE); @endcode If supported, raw mouse motion can be enabled or disabled per-window and at any time but it will only be provided when the cursor is disabled. @subsection cursor_object Cursor objects GLFW supports creating both custom and system theme cursor images, encapsulated as @ref GLFWcursor objects. They are created with @ref glfwCreateCursor or @ref glfwCreateStandardCursor and destroyed with @ref glfwDestroyCursor, or @ref glfwTerminate, if any remain. @subsubsection cursor_custom Custom cursor creation A custom cursor is created with @ref glfwCreateCursor, which returns a handle to the created cursor object. For example, this creates a 16x16 white square cursor with the hot-spot in the upper-left corner: @code unsigned char pixels[16 * 16 * 4]; memset(pixels, 0xff, sizeof(pixels)); GLFWimage image; image.width = 16; image.height = 16; image.pixels = pixels; GLFWcursor* cursor = glfwCreateCursor(&image, 0, 0); @endcode If cursor creation fails, `NULL` will be returned, so it is necessary to check the return value. The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. The pixels are arranged canonically as sequential rows, starting from the top-left corner. @subsubsection cursor_standard Standard cursor creation A cursor with a [standard shape](@ref shapes) from the current system cursor theme can be can be created with @ref glfwCreateStandardCursor. @code GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR); @endcode These cursor objects behave in the exact same way as those created with @ref glfwCreateCursor except that the system cursor theme provides the actual image. @subsubsection cursor_destruction Cursor destruction When a cursor is no longer needed, destroy it with @ref glfwDestroyCursor. @code glfwDestroyCursor(cursor); @endcode Cursor destruction always succeeds. If the cursor is current for any window, that window will revert to the default cursor. This does not affect the cursor mode. All remaining cursors are destroyed when @ref glfwTerminate is called. @subsubsection cursor_set Cursor setting A cursor can be set as current for a window with @ref glfwSetCursor. @code glfwSetCursor(window, cursor); @endcode Once set, the cursor image will be used as long as the system cursor is over the content area of the window and the [cursor mode](@ref cursor_mode) is set to `GLFW_CURSOR_NORMAL`. A single cursor may be set for any number of windows. To revert to the default cursor, set the cursor of that window to `NULL`. @code glfwSetCursor(window, NULL); @endcode When a cursor is destroyed, any window that has it set will revert to the default cursor. This does not affect the cursor mode. @subsection cursor_enter Cursor enter/leave events If you wish to be notified when the cursor enters or leaves the content area of a window, set a cursor enter/leave callback. @code glfwSetCursorEnterCallback(window, cursor_enter_callback); @endcode The callback function receives the new classification of the cursor. @code void cursor_enter_callback(GLFWwindow* window, int entered) { if (entered) { // The cursor entered the content area of the window } else { // The cursor left the content area of the window } } @endcode You can query whether the cursor is currently inside the content area of the window with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. @code if (glfwGetWindowAttrib(window, GLFW_HOVERED)) { highlight_interface(); } @endcode @subsection input_mouse_button Mouse button input If you wish to be notified when a mouse button is pressed or released, set a mouse button callback. @code glfwSetMouseButtonCallback(window, mouse_button_callback); @endcode The callback function receives the [mouse button](@ref buttons), button action and [modifier bits](@ref mods). @code void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS) popup_menu(); } @endcode The action is one of `GLFW_PRESS` or `GLFW_RELEASE`. Mouse button states for [named buttons](@ref buttons) are also saved in per-window state arrays that can be polled with @ref glfwGetMouseButton. @code int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT); if (state == GLFW_PRESS) { upgrade_cow(); } @endcode The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`. This function only returns cached mouse button event state. It does not poll the system for the current state of the mouse button. @anchor GLFW_STICKY_MOUSE_BUTTONS Whenever you poll state, you risk missing the state change you are looking for. If a pressed mouse button is released again before you poll its state, you will have missed the button press. The recommended solution for this is to use a mouse button callback, but there is also the `GLFW_STICKY_MOUSE_BUTTONS` input mode. @code glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, GLFW_TRUE); @endcode When sticky mouse buttons mode is enabled, the pollable state of a mouse button will remain `GLFW_PRESS` until the state of that button is polled with @ref glfwGetMouseButton. Once it has been polled, if a mouse button release event had been processed in the meantime, the state will reset to `GLFW_RELEASE`, otherwise it will remain `GLFW_PRESS`. The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any [named button](@ref buttons). @subsection scrolling Scroll input If you wish to be notified when the user scrolls, whether with a mouse wheel or touchpad gesture, set a scroll callback. @code glfwSetScrollCallback(window, scroll_callback); @endcode The callback function receives two-dimensional scroll offsets. @code void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { } @endcode A normal mouse wheel, being vertical, provides offsets along the Y-axis. @section joystick Joystick input The joystick functions expose connected joysticks and controllers, with both referred to as joysticks. It supports up to sixteen joysticks, ranging from `GLFW_JOYSTICK_1`, `GLFW_JOYSTICK_2` up to and including `GLFW_JOYSTICK_16` or `GLFW_JOYSTICK_LAST`. You can test whether a [joystick](@ref joysticks) is present with @ref glfwJoystickPresent. @code int present = glfwJoystickPresent(GLFW_JOYSTICK_1); @endcode Each joystick has zero or more axes, zero or more buttons, zero or more hats, a human-readable name, a user pointer and an SDL compatible GUID. When GLFW is initialized, detected joysticks are added to the beginning of the array. Once a joystick is detected, it keeps its assigned ID until it is disconnected or the library is terminated, so as joysticks are connected and disconnected, there may appear gaps in the IDs. Joystick axis, button and hat state is updated when polled and does not require a window to be created or events to be processed. However, if you want joystick connection and disconnection events reliably delivered to the [joystick callback](@ref joystick_event) then you must [process events](@ref events). To see all the properties of all connected joysticks in real-time, run the `joysticks` test program. @subsection joystick_axis Joystick axis states The positions of all axes of a joystick are returned by @ref glfwGetJoystickAxes. See the reference documentation for the lifetime of the returned array. @code int count; const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_5, &count); @endcode Each element in the returned array is a value between -1.0 and 1.0. @subsection joystick_button Joystick button states The states of all buttons of a joystick are returned by @ref glfwGetJoystickButtons. See the reference documentation for the lifetime of the returned array. @code int count; const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_3, &count); @endcode Each element in the returned array is either `GLFW_PRESS` or `GLFW_RELEASE`. For backward compatibility with earlier versions that did not have @ref glfwGetJoystickHats, the button array by default also includes all hats. See the reference documentation for @ref glfwGetJoystickButtons for details. @subsection joystick_hat Joystick hat states The states of all hats are returned by @ref glfwGetJoystickHats. See the reference documentation for the lifetime of the returned array. @code int count; const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count); @endcode Each element in the returned array is one of the following: Name | Value ---- | ----- `GLFW_HAT_CENTERED` | 0 `GLFW_HAT_UP` | 1 `GLFW_HAT_RIGHT` | 2 `GLFW_HAT_DOWN` | 4 `GLFW_HAT_LEFT` | 8 `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` The diagonal directions are bitwise combinations of the primary (up, right, down and left) directions and you can test for these individually by ANDing it with the corresponding direction. @code if (hats[2] & GLFW_HAT_RIGHT) { // State of hat 2 could be right-up, right or right-down } @endcode For backward compatibility with earlier versions that did not have @ref glfwGetJoystickHats, all hats are by default also included in the button array. See the reference documentation for @ref glfwGetJoystickButtons for details. @subsection joystick_name Joystick name The human-readable, UTF-8 encoded name of a joystick is returned by @ref glfwGetJoystickName. See the reference documentation for the lifetime of the returned string. @code const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4); @endcode Joystick names are not guaranteed to be unique. Two joysticks of the same model and make may have the same name. Only the [joystick token](@ref joysticks) is guaranteed to be unique, and only until that joystick is disconnected. @subsection joystick_userptr Joystick user pointer Each joystick has a user pointer that can be set with @ref glfwSetJoystickUserPointer and queried with @ref glfwGetJoystickUserPointer. This can be used for any purpose you need and will not be modified by GLFW. The value will be kept until the joystick is disconnected or until the library is terminated. The initial value of the pointer is `NULL`. @subsection joystick_event Joystick configuration changes If you wish to be notified when a joystick is connected or disconnected, set a joystick callback. @code glfwSetJoystickCallback(joystick_callback); @endcode The callback function receives the ID of the joystick that has been connected and disconnected and the event that occurred. @code void joystick_callback(int jid, int event) { if (event == GLFW_CONNECTED) { // The joystick was connected } else if (event == GLFW_DISCONNECTED) { // The joystick was disconnected } } @endcode For joystick connection and disconnection events to be delivered on all platforms, you need to call one of the [event processing](@ref events) functions. Joystick disconnection may also be detected and the callback called by joystick functions. The function will then return whatever it returns for a disconnected joystick. Only @ref glfwGetJoystickName and @ref glfwGetJoystickUserPointer will return useful values for a disconnected joystick and only before the monitor callback returns. @subsection gamepad Gamepad input The joystick functions provide unlabeled axes, buttons and hats, with no indication of where they are located on the device. Their order may also vary between platforms even with the same device. To solve this problem the SDL community crowdsourced the [SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) project, a database of mappings from many different devices to an Xbox-like gamepad. GLFW supports this mapping format and contains a copy of the mappings available at the time of release. See @ref gamepad_mapping for how to update this at runtime. Mappings will be assigned to joysticks automatically any time a joystick is connected or the mappings are updated. You can check whether a joystick is both present and has a gamepad mapping with @ref glfwJoystickIsGamepad. @code if (glfwJoystickIsGamepad(GLFW_JOYSTICK_2)) { // Use as gamepad } @endcode If you are only interested in gamepad input you can use this function instead of @ref glfwJoystickPresent. You can query the human-readable name provided by the gamepad mapping with @ref glfwGetGamepadName. This may or may not be the same as the [joystick name](@ref joystick_name). @code const char* name = glfwGetGamepadName(GLFW_JOYSTICK_7); @endcode To retrieve the gamepad state of a joystick, call @ref glfwGetGamepadState. @code GLFWgamepadstate state; if (glfwGetGamepadState(GLFW_JOYSTICK_3, &state)) { if (state.buttons[GLFW_GAMEPAD_BUTTON_A]) { input_jump(); } input_speed(state.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER]); } @endcode The @ref GLFWgamepadstate struct has two arrays; one for button states and one for axis states. The values for each button and axis are the same as for the @ref glfwGetJoystickButtons and @ref glfwGetJoystickAxes functions, i.e. `GLFW_PRESS` or `GLFW_RELEASE` for buttons and -1.0 to 1.0 inclusive for axes. The sizes of the arrays and the positions within each array are fixed. The [button indices](@ref gamepad_buttons) are `GLFW_GAMEPAD_BUTTON_A`, `GLFW_GAMEPAD_BUTTON_B`, `GLFW_GAMEPAD_BUTTON_X`, `GLFW_GAMEPAD_BUTTON_Y`, `GLFW_GAMEPAD_BUTTON_LEFT_BUMPER`, `GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER`, `GLFW_GAMEPAD_BUTTON_BACK`, `GLFW_GAMEPAD_BUTTON_START`, `GLFW_GAMEPAD_BUTTON_GUIDE`, `GLFW_GAMEPAD_BUTTON_LEFT_THUMB`, `GLFW_GAMEPAD_BUTTON_RIGHT_THUMB`, `GLFW_GAMEPAD_BUTTON_DPAD_UP`, `GLFW_GAMEPAD_BUTTON_DPAD_RIGHT`, `GLFW_GAMEPAD_BUTTON_DPAD_DOWN` and `GLFW_GAMEPAD_BUTTON_DPAD_LEFT`. For those who prefer, there are also the `GLFW_GAMEPAD_BUTTON_CROSS`, `GLFW_GAMEPAD_BUTTON_CIRCLE`, `GLFW_GAMEPAD_BUTTON_SQUARE` and `GLFW_GAMEPAD_BUTTON_TRIANGLE` aliases for the A, B, X and Y button indices. The [axis indices](@ref gamepad_axes) are `GLFW_GAMEPAD_AXIS_LEFT_X`, `GLFW_GAMEPAD_AXIS_LEFT_Y`, `GLFW_GAMEPAD_AXIS_RIGHT_X`, `GLFW_GAMEPAD_AXIS_RIGHT_Y`, `GLFW_GAMEPAD_AXIS_LEFT_TRIGGER` and `GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER`. The `GLFW_GAMEPAD_BUTTON_LAST` and `GLFW_GAMEPAD_AXIS_LAST` constants equal the largest available index for each array. @subsection gamepad_mapping Gamepad mappings GLFW contains a copy of the mappings available in [SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) at the time of release. Newer ones can be added at runtime with @ref glfwUpdateGamepadMappings. @code const char* mappings = load_file_contents("game/data/gamecontrollerdb.txt"); glfwUpdateGamepadMappings(mappings); @endcode This function supports everything from single lines up to and including the unmodified contents of the whole `gamecontrollerdb.txt` file. Below is a description of the mapping format. Please keep in mind that __this description is not authoritative__. The format is defined by the SDL and SDL_GameControllerDB projects and their documentation and code takes precedence. Each mapping is a single line of comma-separated values describing the GUID, name and layout of the gamepad. Lines that do not begin with a hexadecimal digit are ignored. The first value is always the gamepad GUID, a 32 character long hexadecimal string that typically identifies its make, model, revision and the type of connection to the computer. When this information is not available, the GUID is generated using the gamepad name. GLFW uses the SDL 2.0.5+ GUID format but can convert from the older formats. The second value is always the human-readable name of the gamepad. All subsequent values are in the form `:` and describe the layout of the mapping. These fields may not all be present and may occur in any order. The button fields are `a`, `b`, `c`, `d`, `back`, `start`, `guide`, `dpup`, `dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and `rightstick`. The axis fields are `leftx`, `lefty`, `rightx`, `righty`, `lefttrigger` and `righttrigger`. The value of an axis or button field can be a joystick button, a joystick axis, a hat bitmask or empty. Joystick buttons are specified as `bN`, for example `b2` for the third button. Joystick axes are specified as `aN`, for example `a7` for the eighth button. Joystick hat bit masks are specified as `hN.N`, for example `h0.8` for left on the first hat. More than one bit may be set in the mask. Before an axis there may be a `+` or `-` range modifier, for example `+a3` for the positive half of the fourth axis. This restricts input to only the positive or negative halves of the joystick axis. After an axis or half-axis there may be the `~` inversion modifier, for example `a2~` or `-a7~`. This negates the values of the gamepad axis. The hat bit mask match the [hat states](@ref hat_state) in the joystick functions. There is also the special `platform` field that specifies which platform the mapping is valid for. Possible values are `Windows`, `Mac OS X` and `Linux`. Below is an example of what a gamepad mapping might look like. It is the one built into GLFW for Xbox controllers accessed via the XInput API on Windows. This example has been broken into several lines to fit on the page, but real gamepad mappings must be a single line. @code{.unparsed} 78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0, b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8, rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4, righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8, @endcode @note GLFW does not yet support the output range and modifiers `+` and `-` that were recently added to SDL. The input modifiers `+`, `-` and `~` are supported and described above. @section time Time input GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime. @code double seconds = glfwGetTime(); @endcode It returns the number of seconds since the library was initialized with @ref glfwInit. The platform-specific time sources used typically have micro- or nanosecond resolution. You can modify the base time with @ref glfwSetTime. @code glfwSetTime(4.0); @endcode This sets the time to the specified time, in seconds, and it continues to count from there. You can also access the raw timer used to implement the functions above, with @ref glfwGetTimerValue. @code uint64_t value = glfwGetTimerValue(); @endcode This value is in 1 / frequency seconds. The frequency of the raw timer varies depending on the operating system and hardware. You can query the frequency, in Hz, with @ref glfwGetTimerFrequency. @code uint64_t frequency = glfwGetTimerFrequency(); @endcode @section clipboard Clipboard input and output If the system clipboard contains a UTF-8 encoded string or if it can be converted to one, you can retrieve it with @ref glfwGetClipboardString. See the reference documentation for the lifetime of the returned string. @code const char* text = glfwGetClipboardString(NULL); if (text) { insert_text(text); } @endcode If the clipboard is empty or if its contents could not be converted, `NULL` is returned. The contents of the system clipboard can be set to a UTF-8 encoded string with @ref glfwSetClipboardString. @code glfwSetClipboardString(NULL, "A string with words in it"); @endcode @section path_drop Path drop input If you wish to receive the paths of files and/or directories dropped on a window, set a file drop callback. @code glfwSetDropCallback(window, drop_callback); @endcode The callback function receives an array of paths encoded as UTF-8. @code void drop_callback(GLFWwindow* window, int count, const char** paths) { int i; for (i = 0; i < count; i++) handle_dropped_file(paths[i]); } @endcode The path array and its strings are only valid until the file drop callback returns, as they may have been generated specifically for that event. You need to make a deep copy of the array if you want to keep the paths. */ ================================================ FILE: thirdparty/glfw/docs/internal.dox ================================================ /*! @page internals_guide Internal structure @tableofcontents There are several interfaces inside GLFW. Each interface has its own area of responsibility and its own naming conventions. @section internals_public Public interface The most well-known is the public interface, described in the glfw3.h header file. This is implemented in source files shared by all platforms and these files contain no platform-specific code. This code usually ends up calling the platform and internal interfaces to do the actual work. The public interface uses the OpenGL naming conventions except with GLFW and glfw instead of GL and gl. For struct members, where OpenGL sets no precedent, it use headless camel case. Examples: `glfwCreateWindow`, `GLFWwindow`, `GLFW_RED_BITS` @section internals_native Native interface The [native interface](@ref native) is a small set of publicly available but platform-specific functions, described in the glfw3native.h header file and used to gain access to the underlying window, context and (on some platforms) display handles used by the platform interface. The function names of the native interface are similar to those of the public interface, but embeds the name of the interface that the returned handle is from. Examples: `glfwGetX11Window`, `glfwGetWGLContext` @section internals_internal Internal interface The internal interface consists of utility functions used by all other interfaces. It is shared code implemented in the same shared source files as the public and event interfaces. The internal interface is described in the internal.h header file. The internal interface is in charge of GLFW's global data, which it stores in a `_GLFWlibrary` struct named `_glfw`. The internal interface uses the same style as the public interface, except all global names have a leading underscore. Examples: `_glfwIsValidContextConfig`, `_GLFWwindow`, `_glfw.monitorCount` @section internals_platform Platform interface The platform interface implements all platform-specific operations as a service to the public interface. This includes event processing. The platform interface is never directly called by application code and never directly calls application-provided callbacks. It is also prohibited from modifying the platform-independent part of the internal structs. Instead, it calls the event interface when events interesting to GLFW are received. The platform interface mirrors those parts of the public interface that needs to perform platform-specific operations on some or all platforms. The are also named the same except that the glfw function prefix is replaced by _glfwPlatform. Examples: `_glfwPlatformCreateWindow` The platform interface also defines structs that contain platform-specific global and per-object state. Their names mirror those of the internal interface, except that an interface-specific suffix is added. Examples: `_GLFWwindowX11`, `_GLFWcontextWGL` These structs are incorporated as members into the internal interface structs using special macros that name them after the specific interface used. This prevents shared code from accidentally using these members. Examples: `window->win32.handle`, `_glfw.x11.display` @section internals_event Event interface The event interface is implemented in the same shared source files as the public interface and is responsible for delivering the events it receives to the application, either via callbacks, via window state changes or both. The function names of the event interface use a `_glfwInput` prefix and the ObjectEvent pattern. Examples: `_glfwInputWindowFocus`, `_glfwInputCursorPos` @section internals_static Static functions Static functions may be used by any interface and have no prefixes or suffixes. These use headless camel case. Examples: `isValidElementForJoystick` @section internals_config Configuration macros GLFW uses a number of configuration macros to select at compile time which interfaces and code paths to use. They are defined in the glfw_config.h header file, which is generated from the `glfw_config.h.in` file by CMake. Configuration macros the same style as tokens in the public interface, except with a leading underscore. Examples: `_GLFW_WIN32`, `_GLFW_BUILD_DLL` */ ================================================ FILE: thirdparty/glfw/docs/intro.dox ================================================ /*! @page intro_guide Introduction to the API @tableofcontents This guide introduces the basic concepts of GLFW and describes initialization, error handling and API guarantees and limitations. For a broad but shallow tutorial, see @ref quick_guide instead. For details on a specific function in this category, see the @ref init. There are also guides for the other areas of GLFW. - @ref window_guide - @ref context_guide - @ref vulkan_guide - @ref monitor_guide - @ref input_guide @section intro_init Initialization and termination Before most GLFW functions may be called, the library must be initialized. This initialization checks what features are available on the machine, enumerates monitors and joysticks, initializes the timer and performs any required platform-specific initialization. Only the following functions may be called before the library has been successfully initialized, and only from the main thread. - @ref glfwGetVersion - @ref glfwGetVersionString - @ref glfwGetError - @ref glfwSetErrorCallback - @ref glfwInitHint - @ref glfwInit - @ref glfwTerminate Calling any other function before successful initialization will cause a @ref GLFW_NOT_INITIALIZED error. @subsection intro_init_init Initializing GLFW The library is initialized with @ref glfwInit, which returns `GLFW_FALSE` if an error occurred. @code if (!glfwInit()) { // Handle initialization failure } @endcode If any part of initialization fails, any parts that succeeded are terminated as if @ref glfwTerminate had been called. The library only needs to be initialized once and additional calls to an already initialized library will return `GLFW_TRUE` immediately. Once the library has been successfully initialized, it should be terminated before the application exits. Modern systems are very good at freeing resources allocated by programs that exit, but GLFW sometimes has to change global system settings and these might not be restored without termination. @subsection init_hints Initialization hints Initialization hints are set before @ref glfwInit and affect how the library behaves until termination. Hints are set with @ref glfwInitHint. @code glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE); @endcode The values you set hints to are never reset by GLFW, but they only take effect during initialization. Once GLFW has been initialized, any values you set will be ignored until the library is terminated and initialized again. Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions. @subsubsection init_hints_shared Shared init hints @anchor GLFW_JOYSTICK_HAT_BUTTONS __GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not have @ref glfwGetJoystickHats. Set this with @ref glfwInitHint. @subsubsection init_hints_osx macOS specific init hints @anchor GLFW_COCOA_CHDIR_RESOURCES_hint __GLFW_COCOA_CHDIR_RESOURCES__ specifies whether to set the current directory to the application to the `Contents/Resources` subdirectory of the application's bundle, if present. Set this with @ref glfwInitHint. @anchor GLFW_COCOA_MENUBAR_hint __GLFW_COCOA_MENUBAR__ specifies whether to create a basic menu bar, either from a nib or manually, when the first window is created, which is when AppKit is initialized. Set this with @ref glfwInitHint. @subsubsection init_hints_values Supported and default values Initialization hint | Default value | Supported values ------------------------------- | ------------- | ---------------- @ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` @ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` @ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` @subsection intro_init_terminate Terminating GLFW Before your application exits, you should terminate the GLFW library if it has been initialized. This is done with @ref glfwTerminate. @code glfwTerminate(); @endcode This will destroy any remaining window, monitor and cursor objects, restore any modified gamma ramps, re-enable the screensaver if it had been disabled and free any other resources allocated by GLFW. Once the library is terminated, it is as if it had never been initialized and you will need to initialize it again before being able to use GLFW. If the library was not initialized or had already been terminated, it return immediately. @section error_handling Error handling Some GLFW functions have return values that indicate an error, but this is often not very helpful when trying to figure out what happened or why it occurred. Other functions have no return value reserved for errors, so error notification needs a separate channel. Finally, far from all GLFW functions have return values. The last [error code](@ref errors) for the calling thread can be queried at any time with @ref glfwGetError. @code int code = glfwGetError(NULL); if (code != GLFW_NO_ERROR) handle_error(code); @endcode If no error has occurred since the last call, @ref GLFW_NO_ERROR (zero) is returned. The error is cleared before the function returns. The error code indicates the general category of the error. Some error codes, such as @ref GLFW_NOT_INITIALIZED has only a single meaning, whereas others like @ref GLFW_PLATFORM_ERROR are used for many different errors. GLFW often has more information about an error than its general category. You can retrieve a UTF-8 encoded human-readable description along with the error code. If no error has occurred since the last call, the description is set to `NULL`. @code const char* description; int code = glfwGetError(&description); if (description) display_error_message(code, description); @endcode The retrieved description string is only valid until the next error occurs. This means you must make a copy of it if you want to keep it. You can also set an error callback, which will be called each time an error occurs. It is set with @ref glfwSetErrorCallback. @code glfwSetErrorCallback(error_callback); @endcode The error callback receives the same error code and human-readable description returned by @ref glfwGetError. @code void error_callback(int code, const char* description) { display_error_message(code, description); } @endcode The error callback is called after the error is stored, so calling @ref glfwGetError from within the error callback returns the same values as the callback argument. The description string passed to the callback is only valid until the error callback returns. This means you must make a copy of it if you want to keep it. __Reported errors are never fatal.__ As long as GLFW was successfully initialized, it will remain initialized and in a safe state until terminated regardless of how many errors occur. If an error occurs during initialization that causes @ref glfwInit to fail, any part of the library that was initialized will be safely terminated. Do not rely on a currently invalid call to generate a specific error, as in the future that same call may generate a different error or become valid. @section coordinate_systems Coordinate systems GLFW has two primary coordinate systems: the _virtual screen_ and the window _content area_ or _content area_. Both use the same unit: _virtual screen coordinates_, or just _screen coordinates_, which don't necessarily correspond to pixels. Both the virtual screen and the content area coordinate systems have the X-axis pointing to the right and the Y-axis pointing down. Window and monitor positions are specified as the position of the upper-left corners of their content areas relative to the virtual screen, while cursor positions are specified relative to a window's content area. Because the origin of the window's content area coordinate system is also the point from which the window position is specified, you can translate content area coordinates to the virtual screen by adding the window position. The window frame, when present, extends out from the content area but does not affect the window position. Almost all positions and sizes in GLFW are measured in screen coordinates relative to one of the two origins above. This includes cursor positions, window positions and sizes, window frame sizes, monitor positions and video mode resolutions. Two exceptions are the [monitor physical size](@ref monitor_size), which is measured in millimetres, and [framebuffer size](@ref window_fbsize), which is measured in pixels. Pixels and screen coordinates may map 1:1 on your machine, but they won't on every other machine, for example on a Mac with a Retina display. The ratio between screen coordinates and pixels may also change at run-time depending on which monitor the window is currently considered to be on. @section guarantees_limitations Guarantees and limitations This section describes the conditions under which GLFW can be expected to function, barring bugs in the operating system or drivers. Use of GLFW outside of these limits may work on some platforms, or on some machines, or some of the time, or on some versions of GLFW, but it may break at any time and this will not be considered a bug. @subsection lifetime Pointer lifetimes GLFW will never free any pointer you provide to it and you must never free any pointer it provides to you. Many GLFW functions return pointers to dynamically allocated structures, strings or arrays, and some callbacks are provided with strings or arrays. These are always managed by GLFW and should never be freed by the application. The lifetime of these pointers is documented for each GLFW function and callback. If you need to keep this data, you must copy it before its lifetime expires. Many GLFW functions accept pointers to structures or strings allocated by the application. These are never freed by GLFW and are always the responsibility of the application. If GLFW needs to keep the data in these structures or strings, it is copied before the function returns. Pointer lifetimes are guaranteed not to be shortened in future minor or patch releases. @subsection reentrancy Reentrancy GLFW event processing and object destruction are not reentrant. This means that the following functions must not be called from any callback function: - @ref glfwDestroyWindow - @ref glfwDestroyCursor - @ref glfwPollEvents - @ref glfwWaitEvents - @ref glfwWaitEventsTimeout - @ref glfwTerminate These functions may be made reentrant in future minor or patch releases, but functions not on this list will not be made non-reentrant. @subsection thread_safety Thread safety Most GLFW functions must only be called from the main thread (the thread that calls main), but some may be called from any thread once the library has been initialized. Before initialization the whole library is thread-unsafe. The reference documentation for every GLFW function states whether it is limited to the main thread. Initialization, termination, event processing and the creation and destruction of windows, cursors and OpenGL and OpenGL ES contexts are all restricted to the main thread due to limitations of one or several platforms. Because event processing must be performed on the main thread, all callbacks except for the error callback will only be called on that thread. The error callback may be called on any thread, as any GLFW function may generate errors. The error code and description may be queried from any thread. - @ref glfwGetError Empty events may be posted from any thread. - @ref glfwPostEmptyEvent The window user pointer and close flag may be read and written from any thread, but this is not synchronized by GLFW. - @ref glfwGetWindowUserPointer - @ref glfwSetWindowUserPointer - @ref glfwWindowShouldClose - @ref glfwSetWindowShouldClose These functions for working with OpenGL and OpenGL ES contexts may be called from any thread, but the window object is not synchronized by GLFW. - @ref glfwMakeContextCurrent - @ref glfwGetCurrentContext - @ref glfwSwapBuffers - @ref glfwSwapInterval - @ref glfwExtensionSupported - @ref glfwGetProcAddress The raw timer functions may be called from any thread. - @ref glfwGetTimerFrequency - @ref glfwGetTimerValue The regular timer may be used from any thread, but reading and writing the timer offset is not synchronized by GLFW. - @ref glfwGetTime - @ref glfwSetTime Library version information may be queried from any thread. - @ref glfwGetVersion - @ref glfwGetVersionString All Vulkan related functions may be called from any thread. - @ref glfwVulkanSupported - @ref glfwGetRequiredInstanceExtensions - @ref glfwGetInstanceProcAddress - @ref glfwGetPhysicalDevicePresentationSupport - @ref glfwCreateWindowSurface GLFW uses synchronization objects internally only to manage the per-thread context and error states. Additional synchronization is left to the application. Functions that may currently be called from any thread will always remain so, but functions that are currently limited to the main thread may be updated to allow calls from any thread in future releases. @subsection compatibility Version compatibility GLFW uses [Semantic Versioning](https://semver.org/). This guarantees source and binary backward compatibility with earlier minor versions of the API. This means that you can drop in a newer version of the library and existing programs will continue to compile and existing binaries will continue to run. Once a function or constant has been added, the signature of that function or value of that constant will remain unchanged until the next major version of GLFW. No compatibility of any kind is guaranteed between major versions. Undocumented behavior, i.e. behavior that is not described in the documentation, may change at any time until it is documented. If the reference documentation and the implementation differ, the reference documentation will almost always take precedence and the implementation will be fixed in the next release. The reference documentation will also take precedence over anything stated in a guide. @subsection event_order Event order The order of arrival of related events is not guaranteed to be consistent across platforms. The exception is synthetic key and mouse button release events, which are always delivered after the window defocus event. @section intro_version Version management GLFW provides mechanisms for identifying what version of GLFW your application was compiled against as well as what version it is currently running against. If you are loading GLFW dynamically (not just linking dynamically), you can use this to verify that the library binary is compatible with your application. @subsection intro_version_compile Compile-time version The compile-time version of GLFW is provided by the GLFW header with the `GLFW_VERSION_MAJOR`, `GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` macros. @code printf("Compiled against GLFW %i.%i.%i\n", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION); @endcode @subsection intro_version_runtime Run-time version The run-time version can be retrieved with @ref glfwGetVersion, a function that may be called regardless of whether GLFW is initialized. @code int major, minor, revision; glfwGetVersion(&major, &minor, &revision); printf("Running against GLFW %i.%i.%i\n", major, minor, revision); @endcode @subsection intro_version_string Version string GLFW 3 also provides a compile-time generated version string that describes the version, platform, compiler and any platform-specific compile-time options. This is primarily intended for submitting bug reports, to allow developers to see which code paths are enabled in a binary. The version string is returned by @ref glfwGetVersionString, a function that may be called regardless of whether GLFW is initialized. __Do not use the version string__ to parse the GLFW library version. The @ref glfwGetVersion function already provides the version of the running library binary. The format of the string is as follows: - The version of GLFW - The name of the window system API - The name of the context creation API - Any additional options or APIs For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL back ends, the version string may look something like this: @code 3.0.0 Win32 WGL MinGW @endcode */ ================================================ FILE: thirdparty/glfw/docs/main.dox ================================================ /*! @mainpage notitle @section main_intro Introduction GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc. @ref news_33 list new features, caveats and deprecations. @ref quick_guide is a guide for users new to GLFW. It takes you through how to write a small but complete program. There are guides for each section of the API: - @ref intro_guide – initialization, error handling and high-level design - @ref window_guide – creating and working with windows and framebuffers - @ref context_guide – working with OpenGL and OpenGL ES contexts - @ref vulkan_guide - working with Vulkan objects and extensions - @ref monitor_guide – enumerating and working with monitors and video modes - @ref input_guide – receiving events, polling and processing input Once you have written a program, see @ref compile_guide and @ref build_guide. The [reference documentation](modules.html) provides more detailed information about specific functions. @ref moving_guide explains what has changed and how to update existing code to use the new API. There is a section on @ref guarantees_limitations for pointer lifetimes, reentrancy, thread safety, event order and backward and forward compatibility. The [FAQ](https://www.glfw.org/faq.html) answers many common questions about the design, implementation and use of GLFW. Finally, @ref compat_guide explains what APIs, standards and protocols GLFW uses and what happens when they are not present on a given machine. This documentation was generated with Doxygen. The sources for it are available in both the [source distribution](https://www.glfw.org/download.html) and [GitHub repository](https://github.com/glfw/glfw). */ ================================================ FILE: thirdparty/glfw/docs/monitor.dox ================================================ /*! @page monitor_guide Monitor guide @tableofcontents This guide introduces the monitor related functions of GLFW. For details on a specific function in this category, see the @ref monitor. There are also guides for the other areas of GLFW. - @ref intro_guide - @ref window_guide - @ref context_guide - @ref vulkan_guide - @ref input_guide @section monitor_object Monitor objects A monitor object represents a currently connected monitor and is represented as a pointer to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWmonitor. Monitor objects cannot be created or destroyed by the application and retain their addresses until the monitors they represent are disconnected or until the library is [terminated](@ref intro_init_terminate). Each monitor has a current video mode, a list of supported video modes, a virtual position, a human-readable name, an estimated physical size and a gamma ramp. One of the monitors is the primary monitor. The virtual position of a monitor is in [screen coordinates](@ref coordinate_systems) and, together with the current video mode, describes the viewports that the connected monitors provide into the virtual desktop that spans them. To see how GLFW views your monitor setup and its available video modes, run the `monitors` test program. @subsection monitor_monitors Retrieving monitors The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is the user's preferred monitor and is usually the one with global UI elements like task bar or menu bar. @code GLFWmonitor* primary = glfwGetPrimaryMonitor(); @endcode You can retrieve all currently connected monitors with @ref glfwGetMonitors. See the reference documentation for the lifetime of the returned array. @code int count; GLFWmonitor** monitors = glfwGetMonitors(&count); @endcode The primary monitor is always the first monitor in the returned array, but other monitors may be moved to a different index when a monitor is connected or disconnected. @subsection monitor_event Monitor configuration changes If you wish to be notified when a monitor is connected or disconnected, set a monitor callback. @code glfwSetMonitorCallback(monitor_callback); @endcode The callback function receives the handle for the monitor that has been connected or disconnected and the event that occurred. @code void monitor_callback(GLFWmonitor* monitor, int event) { if (event == GLFW_CONNECTED) { // The monitor was connected } else if (event == GLFW_DISCONNECTED) { // The monitor was disconnected } } @endcode If a monitor is disconnected, all windows that are full screen on it will be switched to windowed mode before the callback is called. Only @ref glfwGetMonitorName and @ref glfwGetMonitorUserPointer will return useful values for a disconnected monitor and only before the monitor callback returns. @section monitor_properties Monitor properties Each monitor has a current video mode, a list of supported video modes, a virtual position, a content scale, a human-readable name, a user pointer, an estimated physical size and a gamma ramp. @subsection monitor_modes Video modes GLFW generally does a good job selecting a suitable video mode when you create a full screen window, change its video mode or make a windowed one full screen, but it is sometimes useful to know exactly which video modes are supported. Video modes are represented as @ref GLFWvidmode structures. You can get an array of the video modes supported by a monitor with @ref glfwGetVideoModes. See the reference documentation for the lifetime of the returned array. @code int count; GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); @endcode To get the current video mode of a monitor call @ref glfwGetVideoMode. See the reference documentation for the lifetime of the returned pointer. @code const GLFWvidmode* mode = glfwGetVideoMode(monitor); @endcode The resolution of a video mode is specified in [screen coordinates](@ref coordinate_systems), not pixels. @subsection monitor_size Physical size The physical size of a monitor in millimetres, or an estimation of it, can be retrieved with @ref glfwGetMonitorPhysicalSize. This has no relation to its current _resolution_, i.e. the width and height of its current [video mode](@ref monitor_modes). @code int width_mm, height_mm; glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm); @endcode While this can be used to calculate the raw DPI of a monitor, this is often not useful. Instead use the [monitor content scale](@ref monitor_scale) and [window content scale](@ref window_scale) to scale your content. @subsection monitor_scale Content scale The content scale for a monitor can be retrieved with @ref glfwGetMonitorContentScale. @code float xscale, yscale; glfwGetMonitorContentScale(monitor, &xscale, &yscale); @endcode The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct. The content scale may depend on both the monitor resolution and pixel density and on user settings. It may be very different from the raw DPI calculated from the physical size and current resolution. @subsection monitor_pos Virtual position The position of the monitor on the virtual desktop, in [screen coordinates](@ref coordinate_systems), can be retrieved with @ref glfwGetMonitorPos. @code int xpos, ypos; glfwGetMonitorPos(monitor, &xpos, &ypos); @endcode @subsection monitor_workarea Work area The area of a monitor not occupied by global task bars or menu bars is the work area. This is specified in [screen coordinates](@ref coordinate_systems) and can be retrieved with @ref glfwGetMonitorWorkarea. @code int xpos, ypos, width, height; glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height); @endcode @subsection monitor_name Human-readable name The human-readable, UTF-8 encoded name of a monitor is returned by @ref glfwGetMonitorName. See the reference documentation for the lifetime of the returned string. @code const char* name = glfwGetMonitorName(monitor); @endcode Monitor names are not guaranteed to be unique. Two monitors of the same model and make may have the same name. Only the monitor handle is guaranteed to be unique, and only until that monitor is disconnected. @subsection monitor_userptr User pointer Each monitor has a user pointer that can be set with @ref glfwSetMonitorUserPointer and queried with @ref glfwGetMonitorUserPointer. This can be used for any purpose you need and will not be modified by GLFW. The value will be kept until the monitor is disconnected or until the library is terminated. The initial value of the pointer is `NULL`. @subsection monitor_gamma Gamma ramp The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts a monitor handle and a pointer to a @ref GLFWgammaramp structure. @code GLFWgammaramp ramp; unsigned short red[256], green[256], blue[256]; ramp.size = 256; ramp.red = red; ramp.green = green; ramp.blue = blue; for (i = 0; i < ramp.size; i++) { // Fill out gamma ramp arrays as desired } glfwSetGammaRamp(monitor, &ramp); @endcode The gamma ramp data is copied before the function returns, so there is no need to keep it around once the ramp has been set. It is recommended that your gamma ramp have the same size as the current gamma ramp for that monitor. The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp. See the reference documentation for the lifetime of the returned structure. @code const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor); @endcode If you wish to set a regular gamma ramp, you can have GLFW calculate it for you from the desired exponent with @ref glfwSetGamma, which in turn calls @ref glfwSetGammaRamp with the resulting ramp. @code glfwSetGamma(monitor, 1.0); @endcode To experiment with gamma correction via the @ref glfwSetGamma function, run the `gamma` test program. @note The software controlled gamma ramp is applied _in addition_ to the hardware gamma correction, which today is usually an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior. */ ================================================ FILE: thirdparty/glfw/docs/moving.dox ================================================ /*! @page moving_guide Moving from GLFW 2 to 3 @tableofcontents This is a transition guide for moving from GLFW 2 to 3. It describes what has changed or been removed, but does _not_ include [new features](@ref news) unless they are required when moving an existing code base onto the new API. For example, the new multi-monitor functions are required to create full screen windows with GLFW 3. @section moving_removed Changed and removed features @subsection moving_renamed_files Renamed library and header file The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to avoid collisions with the headers of other major versions. Similarly, the GLFW 3 library is named `glfw3,` except when it's installed as a shared library on Unix-like systems, where it uses the [soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`. @par Old syntax @code #include @endcode @par New syntax @code #include @endcode @subsection moving_threads Removal of threading functions The threading functions have been removed, including the per-thread sleep function. They were fairly primitive, under-used, poorly integrated and took time away from the focus of GLFW (i.e. context, input and window). There are better threading libraries available and native threading support is available in both [C++11](https://en.cppreference.com/w/cpp/thread) and [C11](https://en.cppreference.com/w/c/thread), both of which are gaining traction. If you wish to use the C++11 or C11 facilities but your compiler doesn't yet support them, see the [TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and [TinyCThread](https://github.com/tinycthread/tinycthread) projects created by the original author of GLFW. These libraries implement a usable subset of the threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use TinyCThread. However, GLFW 3 has better support for _use from multiple threads_ than GLFW 2 had. Contexts can be made current on any thread, although only a single thread at a time, and the documentation explicitly states which functions may be used from any thread and which must only be used from the main thread. @par Removed functions `glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`, `glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`, `glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`, `glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`. @par Removed types `GLFWthreadfun` @subsection moving_image Removal of image and texture loading The image and texture loading functions have been removed. They only supported the Targa image format, making them mostly useful for beginner level examples. To become of sufficiently high quality to warrant keeping them in GLFW 3, they would need not only to support other formats, but also modern extensions to OpenGL texturing. This would either add a number of external dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions of these libraries. As there already are libraries doing this, it is unnecessary both to duplicate the work and to tie the duplicate to GLFW. The resulting library would also be platform-independent, as both OpenGL and stdio are available wherever GLFW is. @par Removed functions `glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`, `glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`. @subsection moving_stdcall Removal of GLFWCALL macro The `GLFWCALL` macro, which made callback functions use [__stdcall](https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows, has been removed. GLFW is written in C, not Pascal. Removing this macro means there's one less thing for application programmers to remember, i.e. the requirement to mark all callback functions with `GLFWCALL`. It also simplifies the creation of DLLs and DLL link libraries, as there's no need to explicitly disable `@n` entry point suffixes. @par Old syntax @code void GLFWCALL callback_function(...); @endcode @par New syntax @code void callback_function(...); @endcode @subsection moving_window_handles Window handle parameters Because GLFW 3 supports multiple windows, window handle parameters have been added to all window-related GLFW functions and callbacks. The handle of a newly created window is returned by @ref glfwCreateWindow (formerly `glfwOpenWindow`). Window handles are pointers to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWwindow. @par Old syntax @code glfwSetWindowTitle("New Window Title"); @endcode @par New syntax @code glfwSetWindowTitle(window, "New Window Title"); @endcode @subsection moving_monitor Explicit monitor selection GLFW 3 provides support for multiple monitors. To request a full screen mode window, instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the window to use. The @ref glfwGetPrimaryMonitor function returns the monitor that GLFW 2 would have selected, but there are many other [monitor functions](@ref monitor_guide). Monitor handles are pointers to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWmonitor. @par Old basic full screen @code glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_FULLSCREEN); @endcode @par New basic full screen @code window = glfwCreateWindow(640, 480, "My Window", glfwGetPrimaryMonitor(), NULL); @endcode @note The framebuffer bit depth parameters of `glfwOpenWindow` have been turned into [window hints](@ref window_hints), but as they have been given [sane defaults](@ref window_hints_values) you rarely need to set these hints. @subsection moving_autopoll Removal of automatic event polling GLFW 3 does not automatically poll for events in @ref glfwSwapBuffers, meaning you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself. Unlike buffer swap, which acts on a single window, the event processing functions act on all windows at once. @par Old basic main loop @code while (...) { // Process input // Render output glfwSwapBuffers(); } @endcode @par New basic main loop @code while (...) { // Process input // Render output glfwSwapBuffers(window); glfwPollEvents(); } @endcode @subsection moving_context Explicit context management Each GLFW 3 window has its own OpenGL context and only you, the application programmer, can know which context should be current on which thread at any given time. Therefore, GLFW 3 leaves that decision to you. This means that you need to call @ref glfwMakeContextCurrent after creating a window before you can call any OpenGL functions. @subsection moving_hidpi Separation of window and framebuffer sizes Window positions and sizes now use screen coordinates, which may not be the same as pixels on machines with high-DPI monitors. This is important as OpenGL uses pixels, not screen coordinates. For example, the rectangle specified with `glViewport` needs to use pixels. Therefore, framebuffer size functions have been added. You can retrieve the size of the framebuffer of a window with @ref glfwGetFramebufferSize function. A framebuffer size callback has also been added, which can be set with @ref glfwSetFramebufferSizeCallback. @par Old basic viewport setup @code glfwGetWindowSize(&width, &height); glViewport(0, 0, width, height); @endcode @par New basic viewport setup @code glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); @endcode @subsection moving_window_close Window closing changes The `GLFW_OPENED` window parameter has been removed. As long as the window has not been destroyed, whether through @ref glfwDestroyWindow or @ref glfwTerminate, the window is "open". A user attempting to close a window is now just an event like any other. Unlike GLFW 2, windows and contexts created with GLFW 3 will never be destroyed unless you choose them to be. Each window now has a close flag that is set to `GLFW_TRUE` when the user attempts to close that window. By default, nothing else happens and the window stays visible. It is then up to you to either destroy the window, take some other action or ignore the request. You can query the close flag at any time with @ref glfwWindowShouldClose and set it at any time with @ref glfwSetWindowShouldClose. @par Old basic main loop @code while (glfwGetWindowParam(GLFW_OPENED)) { ... } @endcode @par New basic main loop @code while (!glfwWindowShouldClose(window)) { ... } @endcode The close callback no longer returns a value. Instead, it is called after the close flag has been set so it can override its value, if it chooses to, before event processing completes. You may however not call @ref glfwDestroyWindow from the close callback (or any other window related callback). @par Old syntax @code int GLFWCALL window_close_callback(void); @endcode @par New syntax @code void window_close_callback(GLFWwindow* window); @endcode @note GLFW never clears the close flag to `GLFW_FALSE`, meaning you can use it for other reasons to close the window as well, for example the user choosing Quit from an in-game menu. @subsection moving_hints Persistent window hints The `glfwOpenWindowHint` function has been renamed to @ref glfwWindowHint. Window hints are no longer reset to their default values on window creation, but instead retain their values until modified by @ref glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is terminated and re-initialized. @subsection moving_video_modes Video mode enumeration Video mode enumeration is now per-monitor. The @ref glfwGetVideoModes function now returns all available modes for a specific monitor instead of requiring you to guess how large an array you need. The `glfwGetDesktopMode` function, which had poorly defined behavior, has been replaced by @ref glfwGetVideoMode, which returns the current mode of a monitor. @subsection moving_char_up Removal of character actions The action parameter of the [character callback](@ref GLFWcharfun) has been removed. This was an artefact of the origin of GLFW, i.e. being developed in English by a Swede. However, many keyboard layouts require more than one key to produce characters with diacritical marks. Even the Swedish keyboard layout requires this for uncommon cases like ü. @par Old syntax @code void GLFWCALL character_callback(int character, int action); @endcode @par New syntax @code void character_callback(GLFWwindow* window, int character); @endcode @subsection moving_cursorpos Cursor position changes The `glfwGetMousePos` function has been renamed to @ref glfwGetCursorPos, `glfwSetMousePos` to @ref glfwSetCursorPos and `glfwSetMousePosCallback` to @ref glfwSetCursorPosCallback. The cursor position is now `double` instead of `int`, both for the direct functions and for the callback. Some platforms can provide sub-pixel cursor movement and this data is now passed on to the application where available. On platforms where this is not provided, the decimal part is zero. GLFW 3 only allows you to position the cursor within a window using @ref glfwSetCursorPos (formerly `glfwSetMousePos`) when that window is active. Unless the window is active, the function fails silently. @subsection moving_wheel Wheel position replaced by scroll offsets The `glfwGetMouseWheel` function has been removed. Scrolling is the input of offsets and has no absolute position. The mouse wheel callback has been replaced by a [scroll callback](@ref GLFWscrollfun) that receives two-dimensional floating point scroll offsets. This allows you to receive precise scroll data from for example modern touchpads. @par Old syntax @code void GLFWCALL mouse_wheel_callback(int position); @endcode @par New syntax @code void scroll_callback(GLFWwindow* window, double xoffset, double yoffset); @endcode @par Removed functions `glfwGetMouseWheel` @subsection moving_repeat Key repeat action The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled for both keys and characters. A new key action, `GLFW_REPEAT`, has been added to allow the [key callback](@ref GLFWkeyfun) to distinguish an initial key press from a repeat. Note that @ref glfwGetKey still returns only `GLFW_PRESS` or `GLFW_RELEASE`. @subsection moving_keys Physical key input GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to the values generated by the current keyboard layout. The tokens are named according to the values they would have using the standard US layout, but this is only a convenience, as most programmers are assumed to know that layout. This means that (for example) `GLFW_KEY_LEFT_BRACKET` is always a single key and is the same key in the same place regardless of what keyboard layouts the users of your program has. The key input facility was never meant for text input, although using it that way worked slightly better in GLFW 2. If you were using it to input text, you should be using the character callback instead, on both GLFW 2 and 3. This will give you the characters being input, as opposed to the keys being pressed. GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of having to remember whether to check for `'a'` or `'A'`, you now check for `GLFW_KEY_A`. @subsection moving_joystick Joystick function changes The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes. The `glfwGetJoystickParam` function and the `GLFW_PRESENT`, `GLFW_AXES` and `GLFW_BUTTONS` tokens have been replaced by the @ref glfwJoystickPresent function as well as axis and button counts returned by the @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions. @subsection moving_mbcs Win32 MBCS support The Win32 port of GLFW 3 will not compile in [MBCS mode](https://msdn.microsoft.com/en-us/library/5z097dxa.aspx). However, because the use of the Unicode version of the Win32 API doesn't affect the process as a whole, but only those windows created using it, it's perfectly possible to call MBCS functions from other parts of the same application. Therefore, even if an application using GLFW has MBCS mode code, there's no need for GLFW itself to support it. @subsection moving_windows Support for versions of Windows older than XP All explicit support for version of Windows older than XP has been removed. There is no code that actively prevents GLFW 3 from running on these earlier versions, but it uses Win32 functions that those versions lack. Windows XP was released in 2001, and by now (January 2015) it has not only replaced almost all earlier versions of Windows, but is itself rapidly being replaced by Windows 7 and 8. The MSDN library doesn't even provide documentation for version older than Windows 2000, making it difficult to maintain compatibility with these versions even if it was deemed worth the effort. The Win32 API has also not stood still, and GLFW 3 uses many functions only present on Windows XP or later. Even supporting an OS as new as XP (new from the perspective of GLFW 2, which still supports Windows 95) requires runtime checking for a number of functions that are present only on modern version of Windows. @subsection moving_syskeys Capture of system-wide hotkeys The ability to disable and capture system-wide hotkeys like Alt+Tab has been removed. Modern applications, whether they're games, scientific visualisations or something else, are nowadays expected to be good desktop citizens and allow these hotkeys to function even when running in full screen mode. @subsection moving_terminate Automatic termination GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization, because `exit` calls registered functions from the calling thread and while it is permitted to call `exit` from any thread, @ref glfwTerminate must only be called from the main thread. To release all resources allocated by GLFW, you should call @ref glfwTerminate yourself, from the main thread, before the program terminates. Note that this destroys all windows not already destroyed with @ref glfwDestroyWindow, invalidating any window handles you may still have. @subsection moving_glu GLU header inclusion GLFW 3 does not by default include the GLU header and GLU itself has been deprecated by [Khronos](https://en.wikipedia.org/wiki/Khronos_Group). __New projects should not use GLU__, but if you need it for legacy code that has been moved to GLFW 3, you can request that the GLFW header includes it by defining @ref GLFW_INCLUDE_GLU before the inclusion of the GLFW header. @par Old syntax @code #include @endcode @par New syntax @code #define GLFW_INCLUDE_GLU #include @endcode There are many libraries that offer replacements for the functionality offered by GLU. For the matrix helper functions, see math libraries like [GLM](https://github.com/g-truc/glm) (for C++), [linmath.h](https://github.com/datenwolf/linmath.h) (for C) and others. For the tessellation functions, see for example [libtess2](https://github.com/memononen/libtess2). @section moving_tables Name change tables @subsection moving_renamed_functions Renamed functions | GLFW 2 | GLFW 3 | Notes | | --------------------------- | ----------------------------- | ----- | | `glfwOpenWindow` | @ref glfwCreateWindow | All channel bit depths are now hints | `glfwCloseWindow` | @ref glfwDestroyWindow | | | `glfwOpenWindowHint` | @ref glfwWindowHint | Now accepts all `GLFW_*_BITS` tokens | | `glfwEnable` | @ref glfwSetInputMode | | | `glfwDisable` | @ref glfwSetInputMode | | | `glfwGetMousePos` | @ref glfwGetCursorPos | | | `glfwSetMousePos` | @ref glfwSetCursorPos | | | `glfwSetMousePosCallback` | @ref glfwSetCursorPosCallback | | | `glfwSetMouseWheelCallback` | @ref glfwSetScrollCallback | Accepts two-dimensional scroll offsets as doubles | | `glfwGetJoystickPos` | @ref glfwGetJoystickAxes | | | `glfwGetWindowParam` | @ref glfwGetWindowAttrib | | | `glfwGetGLVersion` | @ref glfwGetWindowAttrib | Use `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and `GLFW_CONTEXT_REVISION` | | `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor | | `glfwGetJoystickParam` | @ref glfwJoystickPresent | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons | @subsection moving_renamed_types Renamed types | GLFW 2 | GLFW 3 | Notes | | ------------------- | --------------------- | | | `GLFWmousewheelfun` | @ref GLFWscrollfun | | | `GLFWmouseposfun` | @ref GLFWcursorposfun | | @subsection moving_renamed_tokens Renamed tokens | GLFW 2 | GLFW 3 | Notes | | --------------------------- | ---------------------------- | ----- | | `GLFW_OPENGL_VERSION_MAJOR` | `GLFW_CONTEXT_VERSION_MAJOR` | Renamed as it applies to OpenGL ES as well | | `GLFW_OPENGL_VERSION_MINOR` | `GLFW_CONTEXT_VERSION_MINOR` | Renamed as it applies to OpenGL ES as well | | `GLFW_FSAA_SAMPLES` | `GLFW_SAMPLES` | Renamed to match the OpenGL API | | `GLFW_ACTIVE` | `GLFW_FOCUSED` | Renamed to match the window focus callback | | `GLFW_WINDOW_NO_RESIZE` | `GLFW_RESIZABLE` | The default has been inverted | | `GLFW_MOUSE_CURSOR` | `GLFW_CURSOR` | Used with @ref glfwSetInputMode | | `GLFW_KEY_ESC` | `GLFW_KEY_ESCAPE` | | | `GLFW_KEY_DEL` | `GLFW_KEY_DELETE` | | | `GLFW_KEY_PAGEUP` | `GLFW_KEY_PAGE_UP` | | | `GLFW_KEY_PAGEDOWN` | `GLFW_KEY_PAGE_DOWN` | | | `GLFW_KEY_KP_NUM_LOCK` | `GLFW_KEY_NUM_LOCK` | | | `GLFW_KEY_LCTRL` | `GLFW_KEY_LEFT_CONTROL` | | | `GLFW_KEY_LSHIFT` | `GLFW_KEY_LEFT_SHIFT` | | | `GLFW_KEY_LALT` | `GLFW_KEY_LEFT_ALT` | | | `GLFW_KEY_LSUPER` | `GLFW_KEY_LEFT_SUPER` | | | `GLFW_KEY_RCTRL` | `GLFW_KEY_RIGHT_CONTROL` | | | `GLFW_KEY_RSHIFT` | `GLFW_KEY_RIGHT_SHIFT` | | | `GLFW_KEY_RALT` | `GLFW_KEY_RIGHT_ALT` | | | `GLFW_KEY_RSUPER` | `GLFW_KEY_RIGHT_SUPER` | | */ ================================================ FILE: thirdparty/glfw/docs/news.dox ================================================ /*! @page news Release notes @tableofcontents @section news_33 Release notes for version 3.3 These are the release notes for version 3.3. For a more detailed view including all fixed bugs see the [version history](https://www.glfw.org/changelog.html). Please review the caveats, deprecations and removals if your project was written against an earlier version of GLFW 3. @subsection features_33 New features in version 3.3 @subsubsection gamepad_33 Gamepad input via SDL_GameControllerDB GLFW can now remap game controllers to a standard Xbox-like layout using a built-in copy of SDL_GameControllerDB. Call @ref glfwJoystickIsGamepad to check if a joystick has a mapping, @ref glfwGetGamepadState to retrieve its input state, @ref glfwUpdateGamepadMappings to add newer mappings and @ref glfwGetGamepadName and @ref glfwGetJoystickGUID for mapping related information. For more information see @ref gamepad. @subsubsection moltenvk_33 Support for Vulkan on macOS via MoltenVK GLFW now supports [MoltenVK](https://moltengl.com/moltenvk/), a Vulkan implementation on top of the Metal API, and its `VK_MVK_macos_surface` window surface creation extension. MoltenVK is included in the [macOS Vulkan SDK](https://vulkan.lunarg.com/). For more information see @ref vulkan_guide. @subsubsection content_scale_33 Content scale queries for DPI-aware rendering GLFW now provides content scales for windows and monitors, i.e. the ratio between their current DPI and the platform's default DPI, with @ref glfwGetWindowContentScale and @ref glfwGetMonitorContentScale. Changes of the content scale of a window can be received with the window content scale callback, set with @ref glfwSetWindowContentScaleCallback. The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a window by the content scale of the monitor it is placed, on platforms like Windows where this is necessary. This takes effect both on creation and when the window is moved between monitors. It is related to but different from [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). For more information see @ref window_scale. @subsubsection setwindowattrib_33 Support for updating window attributes GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) attributes for existing windows with @ref glfwSetWindowAttrib. For more information see @ref window_attribs. @subsubsection raw_motion_33 Support for raw mouse motion GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled cursor mode with the [GLFW_RAW_MOUSE_MOTION](@ref GLFW_RAW_MOUSE_MOTION) input mode. Raw mouse motion input is not yet implemented on macOS. Call @ref glfwRawMouseMotionSupported to check if GLFW can provide raw mouse motion on the current system. For more information see @ref raw_mouse_motion. @subsubsection joysticks_33 Joystick hats GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with @ref glfwGetJoystickHats. For compatibility, hats are also exposed as buttons. This can be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS initialization hint. For more information see @ref joystick_hat. @subsubsection geterror_33 Error query GLFW now supports querying the last error code for the calling thread and its human-readable description with @ref glfwGetError. This can be used instead of or together with the error callback. For more information see @ref error_handling. @subsubsection init_hints_33 Support for initialization hints GLFW now supports setting library initialization hints with @ref glfwInitHint. These must be set before initialization to take effect. Some of these hints are platform specific but are safe to set on any platform. For more information see @ref init_hints. @subsubsection attention_33 User attention request GLFW now supports requesting user attention with @ref glfwRequestWindowAttention. Where possible this calls attention to the specified window. On platforms like macOS it calls attention to the whole application. For more information see @ref window_attention. @subsubsection maximize_33 Window maximization callback GLFW now supports notifying the application that the window has been maximized @ref glfwSetWindowMaximizeCallback. This is called both when the window was maximized by the user and when it was done with @ref glfwMaximizeWindow. For more information see @ref window_maximize. @subsubsection workarea_33 Query for the monitor work area GLFW now supports querying the work area of a monitor, i.e. the area not occupied by task bars or global menu bars, with @ref glfwGetMonitorWorkarea. On platforms that lack this concept, the whole area of the monitor is returned. For more information see @ref monitor_workarea. @subsubsection transparency_33 Transparent windows and framebuffers GLFW now supports the creation of windows with transparent framebuffers on systems with desktop compositing enabled with the @ref GLFW_TRANSPARENT_FRAMEBUFFER window hint and attribute. This hint must be set before window creation and leaves any window decorations opaque. GLFW now also supports whole window transparency with @ref glfwGetWindowOpacity and @ref glfwSetWindowOpacity. This value controls the opacity of the whole window including decorations and unlike framebuffer transparency can be changed at any time after window creation. For more information see @ref window_transparency. @subsubsection key_scancode_33 Query for the scancode of a key GLFW now supports querying the platform dependent scancode of any physical key with @ref glfwGetKeyScancode. For more information see @ref input_key. @subsubsection center_cursor_33 Cursor centering window hint GLFW now supports controlling whether the cursor is centered over newly created full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint) window hint. It is enabled by default. @subsubsection cursor_hover_33 Mouse cursor hover window attribute GLFW now supports polling whether the cursor is hovering over the window content area with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. This attribute corresponds to the [cursor enter/leave](@ref cursor_enter) event. @subsubsection focusonshow_33 Window hint and attribute for input focus on show GLFW now has the [GLFW_FOCUS_ON_SHOW](@ref GLFW_DECORATED_hint) window hint and attribute for controlling whether a window gets input focus when shown. It is enabled by default. It applies both when creating an visible window with @ref glfwCreateWindow and when showing it with @ref glfwShowWindow. This is a workaround for GLFW 3.0 lacking @ref glfwFocusWindow and will be corrected in the next major version. For more information see @ref window_hide. @subsubsection device_userptr_33 Monitor and joystick user pointers GLFW now supports setting and querying user pointers for connected monitors and joysticks with @ref glfwSetMonitorUserPointer, @ref glfwGetMonitorUserPointer, @ref glfwSetJoystickUserPointer and @ref glfwGetJoystickUserPointer. For more information see @ref monitor_userptr and @ref joystick_userptr. @subsubsection macos_nib_33 macOS menu bar from nib file GLFW will now load a `MainMenu.nib` file if found in the `Contents/Resources` directory of the application bundle, as a way to replace the GLFW menu bar without recompiling GLFW. This behavior can be disabled with the [GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) initialization hint. @subsubsection glext_33 Support for more context creation extensions The context hint @ref GLFW_SRGB_CAPABLE now supports OpenGL ES via `WGL_EXT_colorspace`, the context hint @ref GLFW_CONTEXT_NO_ERROR now supports `WGL_ARB_create_context_no_error` and `GLX_ARB_create_context_no_error`, the context hint @ref GLFW_CONTEXT_RELEASE_BEHAVIOR now supports `EGL_KHR_context_flush_control` and @ref glfwGetProcAddress now supports `EGL_KHR_get_all_proc_addresses`. @subsubsection osmesa_33 OSMesa off-screen context creation support GLFW now supports creating off-screen OpenGL contexts using [OSMesa](https://www.mesa3d.org/osmesa.html) by setting [GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) to `GLFW_OSMESA_CONTEXT_API`. Native access function have been added to retrieve the OSMesa color and depth buffers. There is also a new null backend that uses OSMesa as its native context creation API, intended for automated testing. This backend does not provide input. @subsection caveats_33 Caveats for version 3.3 @subsubsection joystick_layout_33 Layout of joysticks have changed The way joystick elements are arranged have changed to match SDL2 in order to support SDL_GameControllerDB mappings. The layout of joysticks may change again if required for compatibility with SDL2. If you need a known and stable layout for game controllers, see if you can switch to @ref gamepad. Existing code that depends on a specific joystick layout will likely have to be updated. @subsubsection wait_events_33 No window required to wait for events The @ref glfwWaitEvents and @ref glfwWaitEventsTimeout functions no longer need a window to be created to wait for events. Before version 3.3 these functions would return immediately if there were no user-created windows. On platforms where only windows can receive events, an internal helper window is used. Existing code that depends on the earlier behavior will likely have to be updated. @subsubsection gamma_ramp_size_33 Gamma ramp size of 256 may be rejected The documentation for versions before 3.3 stated that a gamma ramp size of 256 would always be accepted. This was never the case on X11 and could lead to artifacts on macOS. The @ref glfwSetGamma function has been updated to always generate a ramp of the correct size. Existing code that hardcodes a size of 256 should be updated to use the size of the current ramp of a monitor when setting a new ramp for that monitor. @subsubsection xinput_deadzone_33 Windows XInput deadzone removed GLFW no longer applies any deadzone to the input state received from the XInput API. This was never done for any other platform joystick API so this change makes the behavior more consistent but you will need to apply your own deadzone if desired. @subsubsection x11_clipboard_33 X11 clipboard transfer limits GLFW now supports reading clipboard text via the `INCR` method, which removes the limit on how much text can be read with @ref glfwGetClipboardString. However, writing via this method is not yet supported, so you may not be able to write a very large string with @ref glfwSetClipboardString even if you read it from the clipboard earlier. The exact size limit for writing to the clipboard is negotiated with each receiving application but is at least several tens of kilobytes. Note that only the read limit has changed. Any string that could be written before still can be. @subsubsection x11_linking_33 X11 extension libraries are loaded dynamically GLFW now loads all X11 extension libraries at initialization. The only X11 library you need to link against is `libX11`. The header files for the extension libraries are still required for compilation. Existing projects and makefiles that link GLFW directly against the extension libraries should still build correctly but will add these libraries as load-time dependencies. @subsubsection cmake_version_33 CMake 3.0 or later is required The minimum CMake version has been raised from 2.8.12 to 3.0. This is only a requirement of the GLFW CMake files. The GLFW source files do not depend on CMake. @subsection deprecations_33 Deprecations in version 3.3 @subsubsection charmods_callback_33 Character with modifiers callback The character with modifiers callback set with @ref glfwSetCharModsCallback has been deprecated and should if possible not be used. Existing code should still work but further bug fixes will likely not be made. The callback will be removed in the next major version. @subsubsection clipboard_window_33 Window parameter to clipboard functions The window parameter of the clipboard functions @ref glfwGetClipboardString and @ref glfwSetClipboardString has been deprecated and is no longer used on any platform. On platforms where the clipboard must be owned by a specific window, an internal helper window is used. Existing code should still work unless it depends on a specific window owning the clipboard. New code may pass `NULL` as the window argument. The parameter will be removed in a future release. @subsection removals_33 Removals in 3.3 @subsubsection macos_options_33 macOS specific CMake options and macros The `GLFW_USE_RETINA`, `GLFW_USE_CHDIR` and `GLFW_USE_MENUBAR` CMake options and the `_GLFW_USE_RETINA`, `_GLFW_USE_CHDIR` and `_GLFW_USE_MENUBAR` compile-time macros have been removed. These options and macros are replaced by the window hint [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) and the init hints [GLFW_COCOA_CHDIR_RESOURCES](@ref GLFW_COCOA_CHDIR_RESOURCES_hint) and [GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint). Existing projects and makefiles that set these options or define these macros during compilation of GLFW will still build but it will have no effect and the default behaviors will be used. @subsubsection vulkan_sdk_33 LunarG Vulkan SDK dependency The GLFW test programs that previously depended on the LunarG Vulkan SDK now instead uses a Vulkan loader generated by [glad2](https://github.com/Dav1dde/glad). This means the GLFW CMake files no longer look for the Vulkan SDK. Existing CMake projects that depended on the Vulkan SDK cache variables from GLFW will need to call `find_package(Vulkan)` themselves. CMake 3.7 and later already comes with a [Vulkan find module](https://cmake.org/cmake/help/latest/module/FindVulkan.html) similar to the one GLFW previously included. @subsubsection lib_suffix_33 CMake option LIB_SUFFIX The `LIB_SUFFIX` CMake option has been removed. GLFW now uses the GNUInstallDirs CMake package to handle platform specific details like the library directory suffix and the `LIB_SUFFIX` CMake option has been removed. Existing projects and makefiles that set the `LIB_SUFFIX` option will use the suffix chosen by the GNUInstallDirs package and the option will be ignored. @subsubsection mir_removed_33 Mir support The experimental Mir support has been completely removed as the Mir project has implemented support for the Wayland protocol and is recommending that applications use that instead. Existing projects and makefiles that select Mir when compiling GLFW will fail. Use Wayland or X11 instead. @subsection symbols_33 New symbols in version 3.3 @subsubsection functions_33 New functions in version 3.3 - @ref glfwInitHint - @ref glfwGetError - @ref glfwGetMonitorWorkarea - @ref glfwGetMonitorContentScale - @ref glfwGetMonitorUserPointer - @ref glfwSetMonitorUserPointer - @ref glfwWindowHintString - @ref glfwGetWindowContentScale - @ref glfwGetWindowOpacity - @ref glfwSetWindowOpacity - @ref glfwRequestWindowAttention - @ref glfwSetWindowAttrib - @ref glfwSetWindowMaximizeCallback - @ref glfwSetWindowContentScaleCallback - @ref glfwRawMouseMotionSupported - @ref glfwGetKeyScancode - @ref glfwGetJoystickHats - @ref glfwGetJoystickGUID - @ref glfwGetJoystickUserPointer - @ref glfwSetJoystickUserPointer - @ref glfwJoystickIsGamepad - @ref glfwUpdateGamepadMappings - @ref glfwGetGamepadName - @ref glfwGetGamepadState @subsubsection types_33 New types in version 3.3 - @ref GLFWwindowmaximizefun - @ref GLFWwindowcontentscalefun - @ref GLFWgamepadstate @subsubsection constants_33 New constants in version 3.3 - @ref GLFW_NO_ERROR - @ref GLFW_JOYSTICK_HAT_BUTTONS - @ref GLFW_COCOA_CHDIR_RESOURCES - @ref GLFW_COCOA_MENUBAR - @ref GLFW_CENTER_CURSOR - @ref GLFW_TRANSPARENT_FRAMEBUFFER - @ref GLFW_HOVERED - @ref GLFW_FOCUS_ON_SHOW - @ref GLFW_SCALE_TO_MONITOR - @ref GLFW_COCOA_RETINA_FRAMEBUFFER - @ref GLFW_COCOA_FRAME_NAME - @ref GLFW_COCOA_GRAPHICS_SWITCHING - @ref GLFW_X11_CLASS_NAME - @ref GLFW_X11_INSTANCE_NAME - @ref GLFW_OSMESA_CONTEXT_API - @ref GLFW_HAT_CENTERED - @ref GLFW_HAT_UP - @ref GLFW_HAT_RIGHT - @ref GLFW_HAT_DOWN - @ref GLFW_HAT_LEFT - @ref GLFW_HAT_RIGHT_UP - @ref GLFW_HAT_RIGHT_DOWN - @ref GLFW_HAT_LEFT_UP - @ref GLFW_HAT_LEFT_DOWN - @ref GLFW_MOD_CAPS_LOCK - @ref GLFW_MOD_NUM_LOCK - @ref GLFW_LOCK_KEY_MODS - @ref GLFW_RAW_MOUSE_MOTION - @ref GLFW_GAMEPAD_BUTTON_A - @ref GLFW_GAMEPAD_BUTTON_B - @ref GLFW_GAMEPAD_BUTTON_X - @ref GLFW_GAMEPAD_BUTTON_Y - @ref GLFW_GAMEPAD_BUTTON_LEFT_BUMPER - @ref GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER - @ref GLFW_GAMEPAD_BUTTON_BACK - @ref GLFW_GAMEPAD_BUTTON_START - @ref GLFW_GAMEPAD_BUTTON_GUIDE - @ref GLFW_GAMEPAD_BUTTON_LEFT_THUMB - @ref GLFW_GAMEPAD_BUTTON_RIGHT_THUMB - @ref GLFW_GAMEPAD_BUTTON_DPAD_UP - @ref GLFW_GAMEPAD_BUTTON_DPAD_RIGHT - @ref GLFW_GAMEPAD_BUTTON_DPAD_DOWN - @ref GLFW_GAMEPAD_BUTTON_DPAD_LEFT - @ref GLFW_GAMEPAD_BUTTON_LAST - @ref GLFW_GAMEPAD_BUTTON_CROSS - @ref GLFW_GAMEPAD_BUTTON_CIRCLE - @ref GLFW_GAMEPAD_BUTTON_SQUARE - @ref GLFW_GAMEPAD_BUTTON_TRIANGLE - @ref GLFW_GAMEPAD_AXIS_LEFT_X - @ref GLFW_GAMEPAD_AXIS_LEFT_Y - @ref GLFW_GAMEPAD_AXIS_RIGHT_X - @ref GLFW_GAMEPAD_AXIS_RIGHT_Y - @ref GLFW_GAMEPAD_AXIS_LEFT_TRIGGER - @ref GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER - @ref GLFW_GAMEPAD_AXIS_LAST @section news_32 Release notes for 3.2 These are the release notes for version 3.2. For a more detailed view including all fixed bugs see the [version history](https://www.glfw.org/changelog.html). @subsection features_32 New features in version 3.2 @subsubsection news_32_vulkan Support for Vulkan GLFW now supports basic integration with Vulkan with @ref glfwVulkanSupported, @ref glfwGetRequiredInstanceExtensions, @ref glfwGetInstanceProcAddress, @ref glfwGetPhysicalDevicePresentationSupport and @ref glfwCreateWindowSurface. Vulkan header inclusion can be selected with @ref GLFW_INCLUDE_VULKAN. @subsubsection news_32_setwindowmonitor Window mode switching GLFW now supports switching between windowed and full screen modes and updating the monitor and desired resolution and refresh rate of full screen windows with @ref glfwSetWindowMonitor. @subsubsection news_32_maximize Window maxmimization support GLFW now supports window maximization with @ref glfwMaximizeWindow and the @ref GLFW_MAXIMIZED window hint and attribute. @subsubsection news_32_focus Window input focus control GLFW now supports giving windows input focus with @ref glfwFocusWindow. @subsubsection news_32_sizelimits Window size limit support GLFW now supports setting both absolute and relative window size limits with @ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio. @subsubsection news_32_keyname Localized key names GLFW now supports querying the localized name of printable keys with @ref glfwGetKeyName, either by key token or by scancode. @subsubsection news_32_waittimeout Wait for events with timeout GLFW now supports waiting for events for a set amount of time with @ref glfwWaitEventsTimeout. @subsubsection news_32_icon Window icon support GLFW now supports setting the icon of windows with @ref glfwSetWindowIcon. @subsubsection news_32_timer Raw timer access GLFW now supports raw timer values with @ref glfwGetTimerValue and @ref glfwGetTimerFrequency. @subsubsection news_32_joystick Joystick connection callback GLFW now supports notifying when a joystick has been connected or disconnected with @ref glfwSetJoystickCallback. @subsubsection news_32_noapi Context-less windows GLFW now supports creating windows without a OpenGL or OpenGL ES context by setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. @subsubsection news_32_contextapi Run-time context creation API selection GLFW now supports selecting and querying the context creation API at run-time with the @ref GLFW_CONTEXT_CREATION_API hint and attribute. @subsubsection news_32_noerror Error-free context creation GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do not emit errors with the @ref GLFW_CONTEXT_NO_ERROR hint, provided the machine supports the `GL_KHR_no_error` extension. @subsubsection news_32_cmake CMake config-file package support GLFW now supports being used as a [config-file package](@ref build_link_cmake_package) from other projects for easy linking with the library and its dependencies. @section news_31 Release notes for 3.1 These are the release notes for version 3.1. For a more detailed view including all fixed bugs see the [version history](https://www.glfw.org/changelog.html). @subsection features_31 New features in version 3.1 @subsubsection news_31_cursor Custom mouse cursor images GLFW now supports creating and setting both custom cursor images and standard cursor shapes. They are created with @ref glfwCreateCursor or @ref glfwCreateStandardCursor, set with @ref glfwSetCursor and destroyed with @ref glfwDestroyCursor. @see @ref cursor_object @subsubsection news_31_drop Path drop event GLFW now provides a callback for receiving the paths of files and directories dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback. @see @ref path_drop @subsubsection news_31_emptyevent Main thread wake-up GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty event from another thread to the main thread event queue, causing @ref glfwWaitEvents to return. @see @ref events @subsubsection news_31_framesize Window frame size query GLFW now supports querying the size, on each side, of the frame around the content area of a window, with @ref glfwGetWindowFrameSize. @see [Window size](@ref window_size) @subsubsection news_31_autoiconify Simultaneous multi-monitor rendering GLFW now supports disabling auto-iconification of full screen windows with the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint. This is intended for people building multi-monitor installations, where you need windows to stay in full screen despite losing input focus. @subsubsection news_31_floating Floating windows GLFW now supports floating windows, also called topmost or always on top, for easier debugging with the @ref GLFW_FLOATING window hint and attribute. @subsubsection news_31_focused Initially unfocused windows GLFW now supports preventing a windowed mode window from gaining input focus on creation, with the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint. @subsubsection news_31_direct Direct access for window attributes and cursor position GLFW now queries the window input focus, visibility and iconification attributes and the cursor position directly instead of returning cached data. @subsubsection news_31_charmods Character with modifiers callback GLFW now provides a callback for character events with modifier key bits. The callback is set with @ref glfwSetCharModsCallback. Unlike the regular character callback, this will report character events that will not result in a character being input, for example if the Control key is held down. @see @ref input_char @subsubsection news_31_single Single buffered framebuffers GLFW now supports the creation of single buffered windows, with the @ref GLFW_DOUBLEBUFFER hint. @subsubsection news_31_glext Macro for including extension header GLFW now includes the extension header appropriate for the chosen OpenGL or OpenGL ES header when @ref GLFW_INCLUDE_GLEXT is defined. GLFW does not provide these headers. They must be provided by your development environment or your OpenGL or OpenGL ES SDK. @subsubsection news_31_release Context release behaviors GLFW now supports controlling and querying whether the pipeline is flushed when a context is made non-current, with the @ref GLFW_CONTEXT_RELEASE_BEHAVIOR hint and attribute, provided the machine supports the `GL_KHR_context_flush_control` extension. @subsubsection news_31_wayland (Experimental) Wayland support GLFW now has an _experimental_ Wayland display protocol backend that can be selected on Linux with a CMake option. @subsubsection news_31_mir (Experimental) Mir support GLFW now has an _experimental_ Mir display server backend that can be selected on Linux with a CMake option. @section news_30 Release notes for 3.0 These are the release notes for version 3.0. For a more detailed view including all fixed bugs see the [version history](https://www.glfw.org/changelog.html). @subsection features_30 New features in version 3.0 @subsubsection news_30_cmake CMake build system GLFW now uses the CMake build system instead of the various makefiles and project files used by earlier versions. CMake is available for all platforms supported by GLFW, is present in most package systems and can generate makefiles and/or project files for most popular development environments. For more information on how to use CMake, see the [CMake manual](https://cmake.org/cmake/help/documentation.html). @subsubsection news_30_multiwnd Multi-window support GLFW now supports the creation of multiple windows, each with their own OpenGL or OpenGL ES context, and all window functions now take a window handle. Event callbacks are now per-window and are provided with the handle of the window that received the event. The @ref glfwMakeContextCurrent function has been added to select which context is current on a given thread. @subsubsection news_30_multimon Multi-monitor support GLFW now explicitly supports multiple monitors. They can be enumerated with @ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize, and specified at window creation to make the newly created window full screen on that specific monitor. @subsubsection news_30_unicode Unicode support All string arguments to GLFW functions and all strings returned by GLFW now use the UTF-8 encoding. This includes the window title, error string, clipboard text, monitor and joystick names as well as the extension function arguments (as ASCII is a subset of UTF-8). @subsubsection news_30_clipboard Clipboard text I/O GLFW now supports reading and writing plain text to and from the system clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString functions. @subsubsection news_30_gamma Gamma ramp support GLFW now supports setting and reading back the gamma ramp of monitors, with the @ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref glfwSetGamma, which generates a ramp from a gamma value and then sets it. @subsubsection news_30_gles OpenGL ES support GLFW now supports the creation of OpenGL ES contexts, by setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_OPENGL_ES_API`, where creation of such contexts are supported. Note that GLFW _does not implement_ OpenGL ES, so your driver must provide support in a way usable by GLFW. Modern Nvidia and Intel drivers support creation of OpenGL ES context using the GLX and WGL APIs, while AMD provides an EGL implementation instead. @subsubsection news_30_egl (Experimental) EGL support GLFW now has an experimental EGL context creation back end that can be selected through CMake options. @subsubsection news_30_hidpi High-DPI support GLFW now supports high-DPI monitors on both Windows and macOS, giving windows full resolution framebuffers where other UI elements are scaled up. To achieve this, @ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been added. These work with pixels, while the rest of the GLFW API works with screen coordinates. This is important as OpenGL uses pixels, not screen coordinates. @subsubsection news_30_error Error callback GLFW now has an error callback, which can provide your application with much more detailed diagnostics than was previously possible. The callback is passed an error code and a description string. @subsubsection news_30_wndptr Per-window user pointer Each window now has a user-defined pointer, retrieved with @ref glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it easier to integrate GLFW into C++ code. @subsubsection news_30_iconifyfun Window iconification callback Each window now has a callback for iconification and restoration events, which is set with @ref glfwSetWindowIconifyCallback. @subsubsection news_30_wndposfun Window position callback Each window now has a callback for position events, which is set with @ref glfwSetWindowPosCallback. @subsubsection news_30_wndpos Window position query The position of a window can now be retrieved using @ref glfwGetWindowPos. @subsubsection news_30_focusfun Window focus callback Each windows now has a callback for focus events, which is set with @ref glfwSetWindowFocusCallback. @subsubsection news_30_enterleave Cursor enter/leave callback Each window now has a callback for when the mouse cursor enters or leaves its content area, which is set with @ref glfwSetCursorEnterCallback. @subsubsection news_30_wndtitle Initial window title The title of a window is now specified at creation time, as one of the arguments to @ref glfwCreateWindow. @subsubsection news_30_hidden Hidden windows Windows can now be hidden with @ref glfwHideWindow, shown using @ref glfwShowWindow and created initially hidden with the @ref GLFW_VISIBLE window hint and attribute. This allows for off-screen rendering in a way compatible with most drivers, as well as moving a window to a specific position before showing it. @subsubsection news_30_undecorated Undecorated windows Windowed mode windows can now be created without decorations, e.g. things like a frame, a title bar, with the @ref GLFW_DECORATED window hint and attribute. This allows for the creation of things like splash screens. @subsubsection news_30_keymods Modifier key bit masks [Modifier key bit mask](@ref mods) parameters have been added to the [mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks. @subsubsection news_30_scancode Platform-specific scancodes A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys that don't have a [key token](@ref keys) still get passed on with the key parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines and are intended to be used for key bindings. @subsubsection news_30_jsname Joystick names The name of a joystick can now be retrieved using @ref glfwGetJoystickName. @subsubsection news_30_doxygen Doxygen documentation You are reading it. */ ================================================ FILE: thirdparty/glfw/docs/quick.dox ================================================ /*! @page quick_guide Getting started @tableofcontents This guide takes you through writing a simple application using GLFW 3. The application will create a window and OpenGL context, render a rotating triangle and exit when the user closes the window or presses _Escape_. This guide will introduce a few of the most commonly used functions, but there are many more. This guide assumes no experience with earlier versions of GLFW. If you have used GLFW 2 in the past, read @ref moving_guide, as some functions behave differently in GLFW 3. @section quick_steps Step by step @subsection quick_include Including the GLFW header In the source files of your application where you use OpenGL or GLFW, you need to include the GLFW 3 header file. @code #include @endcode This defines all the constants, types and function prototypes of the GLFW API. It also includes the OpenGL header from your development environment and defines all the constants and types necessary for it to work on your platform without including any platform-specific headers. In other words: - Do _not_ include the OpenGL header yourself, as GLFW does this for you in a platform-independent way - Do _not_ include `windows.h` or other platform-specific headers unless you plan on using those APIs yourself - If you _do_ need to include such headers, include them _before_ the GLFW header and it will detect this On some platforms supported by GLFW the OpenGL header and link library only expose older versions of OpenGL. The most extreme case is Windows, which only exposes OpenGL 1.2. The easiest way to work around this is to use an [extension loader library](@ref context_glext_auto). If you are using such a library then you should include its header _before_ the GLFW header. This lets it replace the OpenGL header included by GLFW without conflicts. This example uses [glad2](https://github.com/Dav1dde/glad), but the same rule applies to all such libraries. @code #include #include @endcode @subsection quick_init_term Initializing and terminating GLFW Before you can use most GLFW functions, the library must be initialized. On successful initialization, `GLFW_TRUE` is returned. If an error occurred, `GLFW_FALSE` is returned. @code if (!glfwInit()) { // Initialization failed } @endcode Note that `GLFW_TRUE` and `GLFW_FALSE` are and will always be one and zero. When you are done using GLFW, typically just before the application exits, you need to terminate GLFW. @code glfwTerminate(); @endcode This destroys any remaining windows and releases any other resources allocated by GLFW. After this call, you must initialize GLFW again before using any GLFW functions that require it. @subsection quick_capture_error Setting an error callback Most events are reported through callbacks, whether it's a key being pressed, a GLFW window being moved, or an error occurring. Callbacks are C functions (or C++ static methods) that are called by GLFW with arguments describing the event. In case a GLFW function fails, an error is reported to the GLFW error callback. You can receive these reports with an error callback. This function must have the signature below but may do anything permitted in other callbacks. @code void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } @endcode Callback functions must be set, so GLFW knows to call them. The function to set the error callback is one of the few GLFW functions that may be called before initialization, which lets you be notified of errors both during and after initialization. @code glfwSetErrorCallback(error_callback); @endcode @subsection quick_create_window Creating a window and context The window and its OpenGL context are created with a single call to @ref glfwCreateWindow, which returns a handle to the created combined window and context object @code GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); if (!window) { // Window or OpenGL context creation failed } @endcode This creates a 640 by 480 windowed mode window with an OpenGL context. If window or OpenGL context creation fails, `NULL` will be returned. You should always check the return value. While window creation rarely fails, context creation depends on properly installed drivers and may fail even on machines with the necessary hardware. By default, the OpenGL context GLFW creates may have any version. You can require a minimum OpenGL version by setting the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation. If the required minimum version is not supported on the machine, context (and window) creation fails. @code glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); if (!window) { // Window or context creation failed } @endcode The window handle is passed to all window related functions and is provided to along to all window related callbacks, so they can tell which window received the event. When a window and context is no longer needed, destroy it. @code glfwDestroyWindow(window); @endcode Once this function is called, no more events will be delivered for that window and its handle becomes invalid. @subsection quick_context_current Making the OpenGL context current Before you can use the OpenGL API, you must have a current OpenGL context. @code glfwMakeContextCurrent(window); @endcode The context will remain current until you make another context current or until the window owning the current context is destroyed. If you are using an [extension loader library](@ref context_glext_auto) to access modern OpenGL then this is when to initialize it, as the loader needs a current context to load from. This example uses [glad](https://github.com/Dav1dde/glad), but the same rule applies to all such libraries. @code gladLoadGL(glfwGetProcAddress); @endcode @subsection quick_window_close Checking the window close flag Each window has a flag indicating whether the window should be closed. When the user attempts to close the window, either by pressing the close widget in the title bar or using a key combination like Alt+F4, this flag is set to 1. Note that __the window isn't actually closed__, so you are expected to monitor this flag and either destroy the window or give some kind of feedback to the user. @code while (!glfwWindowShouldClose(window)) { // Keep running } @endcode You can be notified when the user is attempting to close the window by setting a close callback with @ref glfwSetWindowCloseCallback. The callback will be called immediately after the close flag has been set. You can also set it yourself with @ref glfwSetWindowShouldClose. This can be useful if you want to interpret other kinds of input as closing the window, like for example pressing the _Escape_ key. @subsection quick_key_input Receiving input events Each window has a large number of callbacks that can be set to receive all the various kinds of events. To receive key press and release events, create a key callback function. @code static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } @endcode The key callback, like other window related callbacks, are set per-window. @code glfwSetKeyCallback(window, key_callback); @endcode In order for event callbacks to be called when events occur, you need to process events as described below. @subsection quick_render Rendering with OpenGL Once you have a current OpenGL context, you can use OpenGL normally. In this tutorial, a multi-colored rotating triangle will be rendered. The framebuffer size needs to be retrieved for `glViewport`. @code int width, height; glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); @endcode You can also set a framebuffer size callback using @ref glfwSetFramebufferSizeCallback and be notified when the size changes. Actual rendering with OpenGL is outside the scope of this tutorial, but there are [many](https://open.gl/) [excellent](https://learnopengl.com/) [tutorial](http://openglbook.com/) [sites](http://ogldev.atspace.co.uk/) that teach modern OpenGL. Some of them use GLFW to create the context and window while others use GLUT or SDL, but remember that OpenGL itself always works the same. @subsection quick_timer Reading the timer To create smooth animation, a time source is needed. GLFW provides a timer that returns the number of seconds since initialization. The time source used is the most accurate on each platform and generally has micro- or nanosecond resolution. @code double time = glfwGetTime(); @endcode @subsection quick_swap_buffers Swapping buffers GLFW windows by default use double buffering. That means that each window has two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to. When the entire frame has been rendered, the buffers need to be swapped with one another, so the back buffer becomes the front buffer and vice versa. @code glfwSwapBuffers(window); @endcode The swap interval indicates how many frames to wait until swapping the buffers, commonly known as _vsync_. By default, the swap interval is zero, meaning buffer swapping will occur immediately. On fast machines, many of those frames will never be seen, as the screen is still only updated typically 60-75 times per second, so this wastes a lot of CPU and GPU cycles. Also, because the buffers will be swapped in the middle the screen update, leading to [screen tearing](https://en.wikipedia.org/wiki/Screen_tearing). For these reasons, applications will typically want to set the swap interval to one. It can be set to higher values, but this is usually not recommended, because of the input latency it leads to. @code glfwSwapInterval(1); @endcode This function acts on the current context and will fail unless a context is current. @subsection quick_process_events Processing events GLFW needs to communicate regularly with the window system both in order to receive events and to show that the application hasn't locked up. Event processing must be done regularly while you have visible windows and is normally done each frame after buffer swapping. There are two methods for processing pending events; polling and waiting. This example will use event polling, which processes only those events that have already been received and then returns immediately. @code glfwPollEvents(); @endcode This is the best choice when rendering continually, like most games do. If instead you only need to update your rendering once you have received new input, @ref glfwWaitEvents is a better choice. It waits until at least one event has been received, putting the thread to sleep in the meantime, and then processes all received events. This saves a great deal of CPU cycles and is useful for, for example, many kinds of editing tools. @section quick_example Putting it together Now that you know how to initialize GLFW, create a window and poll for keyboard input, it's possible to create a simple program. This program creates a 640 by 480 windowed mode window and starts a loop that clears the screen, renders a triangle and processes events until the user either presses _Escape_ or closes the window. @snippet simple.c code The program above can be found in the [source package](https://www.glfw.org/download.html) as `examples/simple.c` and is compiled along with all other examples when you build GLFW. If you built GLFW from the source package then you already have this as `simple.exe` on Windows, `simple` on Linux or `simple.app` on macOS. This tutorial used only a few of the many functions GLFW provides. There are guides for each of the areas covered by GLFW. Each guide will introduce all the functions for that category. - @ref intro_guide - @ref window_guide - @ref context_guide - @ref monitor_guide - @ref input_guide You can access reference documentation for any GLFW function by clicking it and the reference for each function links to related functions and guide sections. The tutorial ends here. Once you have written a program that uses GLFW, you will need to compile and link it. How to do that depends on the development environment you are using and is best explained by the documentation for that environment. To learn about the details that are specific to GLFW, see @ref build_guide. */ ================================================ FILE: thirdparty/glfw/docs/vulkan.dox ================================================ /*! @page vulkan_guide Vulkan guide @tableofcontents This guide is intended to fill the gaps between the [Vulkan documentation](https://www.khronos.org/vulkan/) and the rest of the GLFW documentation and is not a replacement for either. It assumes some familiarity with Vulkan concepts like loaders, devices, queues and surfaces and leaves it to the Vulkan documentation to explain the details of Vulkan functions. To develop for Vulkan you should download the [LunarG Vulkan SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link libraries, they also provide the validation layers necessary for development. For details on a specific function in this category, see the @ref vulkan. There are also guides for the other areas of the GLFW API. - @ref intro_guide - @ref window_guide - @ref context_guide - @ref monitor_guide - @ref input_guide @section vulkan_loader Linking against the Vulkan loader By default, GLFW will look for the Vulkan loader on demand at runtime via its standard name (`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS). This means that GLFW does not need to be linked against the loader. However, it also means that if you are using the static library form of the Vulkan loader GLFW will either fail to find it or (worse) use the wrong one. The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader directly instead of dynamically loading it at runtime. Not linking against the Vulkan loader will then be a compile-time error. @macos Because the Vulkan loader and ICD are not installed globally on macOS, you need to set up the application bundle according to the LunarG SDK documentation. This is explained in more detail in the [SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html). @section vulkan_include Including the Vulkan and GLFW header files To include the Vulkan header, define @ref GLFW_INCLUDE_VULKAN before including the GLFW header. @code #define GLFW_INCLUDE_VULKAN #include @endcode If you instead want to include the Vulkan header from a custom location or use your own custom Vulkan header then do this before the GLFW header. @code #include #include @endcode Unless a Vulkan header is included, either by the GLFW header or above it, any GLFW functions that take or return Vulkan types will not be declared. The `VK_USE_PLATFORM_*_KHR` macros do not need to be defined for the Vulkan part of GLFW to work. Define them only if you are using these extensions directly. @section vulkan_support Querying for Vulkan support If you are linking directly against the Vulkan loader then you can skip this section. The canonical desktop loader library exports all Vulkan core and Khronos extension functions, allowing them to be called directly. If you are loading the Vulkan loader dynamically instead of linking directly against it, you can check for the availability of a loader and ICD with @ref glfwVulkanSupported. @code if (glfwVulkanSupported()) { // Vulkan is available, at least for compute } @endcode This function returns `GLFW_TRUE` if the Vulkan loader and any minimally functional ICD was found. If if one or both were not found, calling any other Vulkan related GLFW function will generate a @ref GLFW_API_UNAVAILABLE error. @subsection vulkan_proc Querying Vulkan function pointers To load any Vulkan core or extension function from the found loader, call @ref glfwGetInstanceProcAddress. To load functions needed for instance creation, pass `NULL` as the instance. @code PFN_vkCreateInstance pfnCreateInstance = (PFN_vkCreateInstance) glfwGetInstanceProcAddress(NULL, "vkCreateInstance"); @endcode Once you have created an instance, you can load from it all other Vulkan core functions and functions from any instance extensions you enabled. @code PFN_vkCreateDevice pfnCreateDevice = (PFN_vkCreateDevice) glfwGetInstanceProcAddress(instance, "vkCreateDevice"); @endcode This function in turn calls `vkGetInstanceProcAddr`. If that fails, the function falls back to a platform-specific query of the Vulkan loader (i.e. `dlsym` or `GetProcAddress`). If that also fails, the function returns `NULL`. For more information about `vkGetInstanceProcAddr`, see the Vulkan documentation. Vulkan also provides `vkGetDeviceProcAddr` for loading device-specific versions of Vulkan function. This function can be retrieved from an instance with @ref glfwGetInstanceProcAddress. @code PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr"); @endcode Device-specific functions may execute a little bit faster, due to not having to dispatch internally based on the device passed to them. For more information about `vkGetDeviceProcAddr`, see the Vulkan documentation. @section vulkan_ext Querying required Vulkan extensions To do anything useful with Vulkan you need to create an instance. If you want to use Vulkan to render to a window, you must enable the instance extensions GLFW requires to create Vulkan surfaces. To query the instance extensions required, call @ref glfwGetRequiredInstanceExtensions. @code uint32_t count; const char** extensions = glfwGetRequiredInstanceExtensions(&count); @endcode These extensions must all be enabled when creating instances that are going to be passed to @ref glfwGetPhysicalDevicePresentationSupport and @ref glfwCreateWindowSurface. The set of extensions will vary depending on platform and may also vary depending on graphics drivers and other factors. If it fails it will return `NULL` and GLFW will not be able to create Vulkan window surfaces. You can still use Vulkan for off-screen rendering and compute work. If successful the returned array will always include `VK_KHR_surface`, so if you don't require any additional extensions you can pass this list directly to the `VkInstanceCreateInfo` struct. @code VkInstanceCreateInfo ici; memset(&ici, 0, sizeof(ici)); ici.enabledExtensionCount = count; ici.ppEnabledExtensionNames = extensions; ... @endcode Additional extensions may be required by future versions of GLFW. You should check whether any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the `VkInstanceCreateInfo` struct. @section vulkan_present Querying for Vulkan presentation support Not every queue family of every Vulkan device can present images to surfaces. To check whether a specific queue family of a physical device supports image presentation without first having to create a window and surface, call @ref glfwGetPhysicalDevicePresentationSupport. @code if (glfwGetPhysicalDevicePresentationSupport(instance, physical_device, queue_family_index)) { // Queue family supports image presentation } @endcode The `VK_KHR_surface` extension additionally provides the `vkGetPhysicalDeviceSurfaceSupportKHR` function, which performs the same test on an existing Vulkan surface. @section vulkan_window Creating the window Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan, there is no need to create a context. You can disable context creation with the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint. @code glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); GLFWwindow* window = glfwCreateWindow(640, 480, "Window Title", NULL, NULL); @endcode See @ref context_less for more information. @section vulkan_surface Creating a Vulkan window surface You can create a Vulkan surface (as defined by the `VK_KHR_surface` extension) for a GLFW window with @ref glfwCreateWindowSurface. @code VkSurfaceKHR surface; VkResult err = glfwCreateWindowSurface(instance, window, NULL, &surface); if (err) { // Window surface creation failed } @endcode If an OpenGL or OpenGL ES context was created on the window, the context has ownership of the presentation on the window and a Vulkan surface cannot be created. It is your responsibility to destroy the surface. GLFW does not destroy it for you. Call `vkDestroySurfaceKHR` function from the same extension to destroy it. */ ================================================ FILE: thirdparty/glfw/docs/window.dox ================================================ /*! @page window_guide Window guide @tableofcontents This guide introduces the window related functions of GLFW. For details on a specific function in this category, see the @ref window. There are also guides for the other areas of GLFW. - @ref intro_guide - @ref context_guide - @ref vulkan_guide - @ref monitor_guide - @ref input_guide @section window_object Window objects The @ref GLFWwindow object encapsulates both a window and a context. They are created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow, or @ref glfwTerminate, if any remain. As the window and context are inseparably linked, the object pointer is used as both a context and window handle. To see the event stream provided to the various window related callbacks, run the `events` test program. @subsection window_creation Window creation A window and its OpenGL or OpenGL ES context are created with @ref glfwCreateWindow, which returns a handle to the created window object. For example, this creates a 640 by 480 windowed mode window: @code GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); @endcode If window creation fails, `NULL` will be returned, so it is necessary to check the return value. The window handle is passed to all window related functions and is provided to along with all input events, so event handlers can tell which window received the event. @subsubsection window_full_screen Full screen windows To create a full screen window, you need to specify which monitor the window should use. In most cases, the user's primary monitor is a good choice. For more information about retrieving monitors, see @ref monitor_monitors. @code GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL); @endcode Full screen windows cover the entire display area of a monitor, have no border or decorations. Windowed mode windows can be made full screen by setting a monitor with @ref glfwSetWindowMonitor, and full screen ones can be made windowed by unsetting it with the same function. Each field of the @ref GLFWvidmode structure corresponds to a function parameter or window hint and combine to form the _desired video mode_ for that window. The supported video mode most closely matching the desired video mode will be set for the chosen monitor as long as the window has input focus. For more information about retrieving video modes, see @ref monitor_modes. Video mode field | Corresponds to ---------------- | -------------- GLFWvidmode.width | `width` parameter of @ref glfwCreateWindow GLFWvidmode.height | `height` parameter of @ref glfwCreateWindow GLFWvidmode.redBits | @ref GLFW_RED_BITS hint GLFWvidmode.greenBits | @ref GLFW_GREEN_BITS hint GLFWvidmode.blueBits | @ref GLFW_BLUE_BITS hint GLFWvidmode.refreshRate | @ref GLFW_REFRESH_RATE hint Once you have a full screen window, you can change its resolution, refresh rate and monitor with @ref glfwSetWindowMonitor. If you only need change its resolution you can also call @ref glfwSetWindowSize. In all cases, the new video mode will be selected the same way as the video mode chosen by @ref glfwCreateWindow. If the window has an OpenGL or OpenGL ES context, it will be unaffected. By default, the original video mode of the monitor will be restored and the window iconified if it loses input focus, to allow the user to switch back to the desktop. This behavior can be disabled with the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint, for example if you wish to simultaneously cover multiple monitors with full screen windows. If a monitor is disconnected, all windows that are full screen on that monitor will be switched to windowed mode. See @ref monitor_event for more information. @subsubsection window_windowed_full_screen "Windowed full screen" windows If the closest match for the desired video mode is the current one, the video mode will not be changed, making window creation faster and application switching much smoother. This is sometimes called _windowed full screen_ or _borderless full screen_ window and counts as a full screen window. To create such a window, request the current video mode. @code const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); GLFWwindow* window = glfwCreateWindow(mode->width, mode->height, "My Title", monitor, NULL); @endcode This also works for windowed mode windows that are made full screen. @code const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); @endcode Note that @ref glfwGetVideoMode returns the _current_ video mode of a monitor, so if you already have a full screen window on that monitor that you want to make windowed full screen, you need to have saved the desktop resolution before. @subsection window_destruction Window destruction When a window is no longer needed, destroy it with @ref glfwDestroyWindow. @code glfwDestroyWindow(window); @endcode Window destruction always succeeds. Before the actual destruction, all callbacks are removed so no further events will be delivered for the window. All windows remaining when @ref glfwTerminate is called are destroyed as well. When a full screen window is destroyed, the original video mode of its monitor is restored, but the gamma ramp is left untouched. @subsection window_hints Window creation hints There are a number of hints that can be set before the creation of a window and context. Some affect the window itself, others affect the framebuffer or context. These hints are set to their default values each time the library is initialized with @ref glfwInit. Integer value hints can be set individually with @ref glfwWindowHint and string value hints with @ref glfwWindowHintString. You can reset all at once to their defaults with @ref glfwDefaultWindowHints. Some hints are platform specific. These are always valid to set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or calls. @note Window hints need to be set before the creation of the window and context you wish to have the specified attributes. They function as additional arguments to @ref glfwCreateWindow. @subsubsection window_hints_hard Hard and soft constraints Some window hints are hard constraints. These must match the available capabilities _exactly_ for window and context creation to succeed. Hints that are not hard constraints are matched as closely as possible, but the resulting context and framebuffer may differ from what these hints requested. The following hints are always hard constraints: - @ref GLFW_STEREO - @ref GLFW_DOUBLEBUFFER - [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) - [GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) The following additional hints are hard constraints when requesting an OpenGL context, but are ignored when requesting an OpenGL ES context: - [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) - [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) @subsubsection window_hints_wnd Window related hints @anchor GLFW_RESIZABLE_hint __GLFW_RESIZABLE__ specifies whether the windowed mode window will be resizable _by the user_. The window will still be resizable using the @ref glfwSetWindowSize function. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for full screen and undecorated windows. @anchor GLFW_VISIBLE_hint __GLFW_VISIBLE__ specifies whether the windowed mode window will be initially visible. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for full screen windows. @anchor GLFW_DECORATED_hint __GLFW_DECORATED__ specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for full screen windows. @anchor GLFW_FOCUSED_hint __GLFW_FOCUSED__ specifies whether the windowed mode window will be given input focus when created. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for full screen and initially hidden windows. @anchor GLFW_AUTO_ICONIFY_hint __GLFW_AUTO_ICONIFY__ specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for windowed mode windows. @anchor GLFW_FLOATING_hint __GLFW_FLOATING__ specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for full screen windows. @anchor GLFW_MAXIMIZED_hint __GLFW_MAXIMIZED__ specifies whether the windowed mode window will be maximized when created. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for full screen windows. @anchor GLFW_CENTER_CURSOR_hint __GLFW_CENTER_CURSOR__ specifies whether the cursor should be centered over newly created full screen windows. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for windowed mode windows. @anchor GLFW_TRANSPARENT_FRAMEBUFFER_hint __GLFW_TRANSPARENT_FRAMEBUFFER__ specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @par @win32 GLFW sets a color key for the window to work around repainting issues with a transparent framebuffer. The chosen color value is RGB 255,0,255 (magenta). This will make pixels with that exact color fully transparent regardless of their alpha values. If this is a problem, make these pixels any other color before buffer swap. @anchor GLFW_FOCUS_ON_SHOW_hint __GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @anchor GLFW_SCALE_TO_MONITOR __GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be resized based on the [monitor content scale](@ref monitor_scale) of any monitor it is placed on. This includes the initial placement when the window is created. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size. @subsubsection window_hints_fb Framebuffer related hints @anchor GLFW_RED_BITS @anchor GLFW_GREEN_BITS @anchor GLFW_BLUE_BITS @anchor GLFW_ALPHA_BITS @anchor GLFW_DEPTH_BITS @anchor GLFW_STENCIL_BITS __GLFW_RED_BITS__, __GLFW_GREEN_BITS__, __GLFW_BLUE_BITS__, __GLFW_ALPHA_BITS__, __GLFW_DEPTH_BITS__ and __GLFW_STENCIL_BITS__ specify the desired bit depths of the various components of the default framebuffer. A value of `GLFW_DONT_CARE` means the application has no preference. @anchor GLFW_ACCUM_RED_BITS @anchor GLFW_ACCUM_GREEN_BITS @anchor GLFW_ACCUM_BLUE_BITS @anchor GLFW_ACCUM_ALPHA_BITS __GLFW_ACCUM_RED_BITS__, __GLFW_ACCUM_GREEN_BITS__, __GLFW_ACCUM_BLUE_BITS__ and __GLFW_ACCUM_ALPHA_BITS__ specify the desired bit depths of the various components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the application has no preference. @par Accumulation buffers are a legacy OpenGL feature and should not be used in new code. @anchor GLFW_AUX_BUFFERS __GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value of `GLFW_DONT_CARE` means the application has no preference. @par Auxiliary buffers are a legacy OpenGL feature and should not be used in new code. @anchor GLFW_STEREO __GLFW_STEREO__ specifies whether to use OpenGL stereoscopic rendering. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is a hard constraint. @anchor GLFW_SAMPLES __GLFW_SAMPLES__ specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value of `GLFW_DONT_CARE` means the application has no preference. @anchor GLFW_SRGB_CAPABLE __GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @par __OpenGL:__ If enabled and supported by the system, the `GL_FRAMEBUFFER_SRGB` enable will control sRGB rendering. By default, sRGB rendering will be disabled. @par __OpenGL ES:__ If enabled and supported by the system, the context will always have sRGB rendering enabled. @anchor GLFW_DOUBLEBUFFER __GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @subsubsection window_hints_mtr Monitor related hints @anchor GLFW_REFRESH_RATE __GLFW_REFRESH_RATE__ specifies the desired refresh rate for full screen windows. A value of `GLFW_DONT_CARE` means the highest available refresh rate will be used. This hint is ignored for windowed mode windows. @subsubsection window_hints_ctx Context related hints @anchor GLFW_CLIENT_API_hint __GLFW_CLIENT_API__ specifies which client API to create the context for. Possible values are `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` and `GLFW_NO_API`. This is a hard constraint. @anchor GLFW_CONTEXT_CREATION_API_hint __GLFW_CONTEXT_CREATION_API__ specifies which context creation API to use to create the context. Possible values are `GLFW_NATIVE_CONTEXT_API`, `GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard constraint. If no client API is requested, this hint is ignored. @par @macos The EGL API is not available on this platform and requests to use it will fail. @par __Wayland:__ The EGL API _is_ the native context creation API, so this hint will have no effect. @par __OSMesa:__ As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer and @ref glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents. @note An OpenGL extension loader library that assumes it knows which context creation API is used on a given platform may fail if you change this hint. This can be resolved by having it load via @ref glfwGetProcAddress, which always uses the selected API. @bug On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now. @anchor GLFW_CONTEXT_VERSION_MAJOR_hint @anchor GLFW_CONTEXT_VERSION_MINOR_hint __GLFW_CONTEXT_VERSION_MAJOR__ and __GLFW_CONTEXT_VERSION_MINOR__ specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API. @note Do not confuse these hints with `GLFW_VERSION_MAJOR` and `GLFW_VERSION_MINOR`, which provide the API version of the GLFW header. @par __OpenGL:__ These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available. @par While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints. @par __OpenGL ES:__ These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x. @note @macos The OS only supports forward-compatible core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS. @anchor GLFW_OPENGL_FORWARD_COMPAT_hint __GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored. @par Forward-compatibility is described in detail in the [OpenGL Reference Manual](https://www.opengl.org/registry/). @anchor GLFW_OPENGL_DEBUG_CONTEXT_hint __GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether to create a debug OpenGL context, which may have additional error and performance issue reporting functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If OpenGL ES is requested, this hint is ignored. @anchor GLFW_OPENGL_PROFILE_hint __GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context for. Possible values are one of `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`, or `GLFW_OPENGL_ANY_PROFILE` to not request a specific profile. If requesting an OpenGL version below 3.2, `GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint is ignored. @par OpenGL profiles are described in detail in the [OpenGL Reference Manual](https://www.opengl.org/registry/). @anchor GLFW_CONTEXT_ROBUSTNESS_hint __GLFW_CONTEXT_ROBUSTNESS__ specifies the robustness strategy to be used by the context. This can be one of `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET`, or `GLFW_NO_ROBUSTNESS` to not request a robustness strategy. @anchor GLFW_CONTEXT_RELEASE_BEHAVIOR_hint __GLFW_CONTEXT_RELEASE_BEHAVIOR__ specifies the release behavior to be used by the context. Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`, the pipeline will be flushed whenever the context is released from being the current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will not be flushed on release. @par Context release behaviors are described in detail by the [GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt) extension. @anchor GLFW_CONTEXT_NO_ERROR_hint __GLFW_CONTEXT_NO_ERROR__ specifies whether errors should be generated by the context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, situations that would have generated errors instead cause undefined behavior. @par The no error mode for OpenGL and OpenGL ES is described in detail by the [GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt) extension. @subsubsection window_hints_osx macOS specific window hints @anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint __GLFW_COCOA_RETINA_FRAMEBUFFER__ specifies whether to use full resolution framebuffers on Retina displays. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is ignored on other platforms. @anchor GLFW_COCOA_FRAME_NAME_hint __GLFW_COCOA_FRAME_NAME__ specifies the UTF-8 encoded name to use for autosaving the window frame, or if empty disables frame autosaving for the window. This is ignored on other platforms. This is set with @ref glfwWindowHintString. @anchor GLFW_COCOA_GRAPHICS_SWITCHING_hint __GLFW_COCOA_GRAPHICS_SWITCHING__ specifies whether to in Automatic Graphics Switching, i.e. to allow the system to choose the integrated GPU for the OpenGL context and move it between GPUs if necessary or whether to force it to always run on the discrete GPU. This only affects systems with both integrated and discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is ignored on other platforms. @par Simpler programs and tools may want to enable this to save power, while games and other applications performing advanced rendering will want to leave it disabled. @par A bundled application that wishes to participate in Automatic Graphics Switching should also declare this in its `Info.plist` by setting the `NSSupportsAutomaticGraphicsSwitching` key to `true`. @subsubsection window_hints_x11 X11 specific window hints @anchor GLFW_X11_CLASS_NAME_hint @anchor GLFW_X11_INSTANCE_NAME_hint __GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. These are set with @ref glfwWindowHintString. @subsubsection window_hints_values Supported and default values Window hint | Default value | Supported values ----------------------------- | --------------------------- | ---------------- GLFW_RESIZABLE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_VISIBLE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_DECORATED | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_FOCUSED | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_AUTO_ICONIFY | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_FLOATING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_MAXIMIZED | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_CENTER_CURSOR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_TRANSPARENT_FRAMEBUFFER | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_FOCUS_ON_SHOW | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_SCALE_TO_MONITOR | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_RED_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_GREEN_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_BLUE_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_ALPHA_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_DEPTH_BITS | 24 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_STENCIL_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_ACCUM_RED_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_ACCUM_GREEN_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_ACCUM_BLUE_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_ACCUM_ALPHA_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_AUX_BUFFERS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_SAMPLES | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_REFRESH_RATE | `GLFW_DONT_CARE` | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_STEREO | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_SRGB_CAPABLE | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_DOUBLEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_CLIENT_API | `GLFW_OPENGL_API` | `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` or `GLFW_NO_API` GLFW_CONTEXT_CREATION_API | `GLFW_NATIVE_CONTEXT_API` | `GLFW_NATIVE_CONTEXT_API`, `GLFW_EGL_CONTEXT_API` or `GLFW_OSMESA_CONTEXT_API` GLFW_CONTEXT_VERSION_MAJOR | 1 | Any valid major version number of the chosen client API GLFW_CONTEXT_VERSION_MINOR | 0 | Any valid minor version number of the chosen client API GLFW_CONTEXT_ROBUSTNESS | `GLFW_NO_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET` GLFW_CONTEXT_RELEASE_BEHAVIOR | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE` GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_OPENGL_DEBUG_CONTEXT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_OPENGL_PROFILE | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE` GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_X11_CLASS_NAME | `""` | An ASCII encoded `WM_CLASS` class name GLFW_X11_INSTANCE_NAME | `""` | An ASCII encoded `WM_CLASS` instance name @section window_events Window event processing See @ref events. @section window_properties Window properties and events @subsection window_userptr User pointer Each window has a user pointer that can be set with @ref glfwSetWindowUserPointer and queried with @ref glfwGetWindowUserPointer. This can be used for any purpose you need and will not be modified by GLFW throughout the life-time of the window. The initial value of the pointer is `NULL`. @subsection window_close Window closing and close flag When the user attempts to close the window, for example by clicking the close widget or using a key chord like Alt+F4, the _close flag_ of the window is set. The window is however not actually destroyed and, unless you watch for this state change, nothing further happens. The current state of the close flag is returned by @ref glfwWindowShouldClose and can be set or cleared directly with @ref glfwSetWindowShouldClose. A common pattern is to use the close flag as a main loop condition. @code while (!glfwWindowShouldClose(window)) { render(window); glfwSwapBuffers(window); glfwPollEvents(); } @endcode If you wish to be notified when the user attempts to close a window, set a close callback. @code glfwSetWindowCloseCallback(window, window_close_callback); @endcode The callback function is called directly _after_ the close flag has been set. It can be used for example to filter close requests and clear the close flag again unless certain conditions are met. @code void window_close_callback(GLFWwindow* window) { if (!time_to_close) glfwSetWindowShouldClose(window, GLFW_FALSE); } @endcode @subsection window_size Window size The size of a window can be changed with @ref glfwSetWindowSize. For windowed mode windows, this sets the size, in [screen coordinates](@ref coordinate_systems) of the _content area_ or _content area_ of the window. The window system may impose limits on window size. @code glfwSetWindowSize(window, 640, 480); @endcode For full screen windows, the specified size becomes the new resolution of the window's desired video mode. The video mode most closely matching the new desired video mode is set immediately. The window is resized to fit the resolution of the set video mode. If you wish to be notified when a window is resized, whether by the user, the system or your own code, set a size callback. @code glfwSetWindowSizeCallback(window, window_size_callback); @endcode The callback function receives the new size, in screen coordinates, of the content area of the window when the window is resized. @code void window_size_callback(GLFWwindow* window, int width, int height) { } @endcode There is also @ref glfwGetWindowSize for directly retrieving the current size of a window. @code int width, height; glfwGetWindowSize(window, &width, &height); @endcode @note Do not pass the window size to `glViewport` or other pixel-based OpenGL calls. The window size is in screen coordinates, not pixels. Use the [framebuffer size](@ref window_fbsize), which is in pixels, for pixel-based calls. The above functions work with the size of the content area, but decorated windows typically have title bars and window frames around this rectangle. You can retrieve the extents of these with @ref glfwGetWindowFrameSize. @code int left, top, right, bottom; glfwGetWindowFrameSize(window, &left, &top, &right, &bottom); @endcode The returned values are the distances, in screen coordinates, from the edges of the content area to the corresponding edges of the full window. As they are distances and not coordinates, they are always zero or positive. @subsection window_fbsize Framebuffer size While the size of a window is measured in screen coordinates, OpenGL works with pixels. The size you pass into `glViewport`, for example, should be in pixels. On some machines screen coordinates and pixels are the same, but on others they will not be. There is a second set of functions to retrieve the size, in pixels, of the framebuffer of a window. If you wish to be notified when the framebuffer of a window is resized, whether by the user or the system, set a size callback. @code glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); @endcode The callback function receives the new size of the framebuffer when it is resized, which can for example be used to update the OpenGL viewport. @code void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @endcode There is also @ref glfwGetFramebufferSize for directly retrieving the current size of the framebuffer of a window. @code int width, height; glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); @endcode The size of a framebuffer may change independently of the size of a window, for example if the window is dragged between a regular monitor and a high-DPI one. @subsection window_scale Window content scale The content scale for a window can be retrieved with @ref glfwGetWindowContentScale. @code float xscale, yscale; glfwGetWindowContentScale(window, &xscale, &yscale); @endcode The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct. On systems where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on. If you wish to be notified when the content scale of a window changes, whether because of a system setting change or because it was moved to a monitor with a different scale, set a content scale callback. @code glfwSetWindowContentScaleCallback(window, window_content_scale_callback); @endcode The callback function receives the new content scale of the window. @code void window_content_scale_callback(GLFWwindow* window, float xscale, float yscale) { set_interface_scale(xscale, yscale); } @endcode On platforms where pixels and screen coordinates always map 1:1, the window will need to be resized to appear the same size when it is moved to a monitor with a different content scale. To have this done automatically both when the window is created and when its content scale later changes, set the @ref GLFW_SCALE_TO_MONITOR window hint. @subsection window_sizelimits Window size limits The minimum and maximum size of the content area of a windowed mode window can be enforced with @ref glfwSetWindowSizeLimits. The user may resize the window to any size and aspect ratio within the specified limits, unless the aspect ratio is also set. @code glfwSetWindowSizeLimits(window, 200, 200, 400, 400); @endcode To specify only a minimum size or only a maximum one, set the other pair to `GLFW_DONT_CARE`. @code glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE); @endcode To disable size limits for a window, set them all to `GLFW_DONT_CARE`. The aspect ratio of the content area of a windowed mode window can be enforced with @ref glfwSetWindowAspectRatio. The user may resize the window freely unless size limits are also set, but the size will be constrained to maintain the aspect ratio. @code glfwSetWindowAspectRatio(window, 16, 9); @endcode The aspect ratio is specified as a numerator and denominator, corresponding to the width and height, respectively. If you want a window to maintain its current aspect ratio, use its current size as the ratio. @code int width, height; glfwGetWindowSize(window, &width, &height); glfwSetWindowAspectRatio(window, width, height); @endcode To disable the aspect ratio limit for a window, set both terms to `GLFW_DONT_CARE`. You can have both size limits and aspect ratio set for a window, but the results are undefined if they conflict. @subsection window_pos Window position The position of a windowed-mode window can be changed with @ref glfwSetWindowPos. This moves the window so that the upper-left corner of its content area has the specified [screen coordinates](@ref coordinate_systems). The window system may put limitations on window placement. @code glfwSetWindowPos(window, 100, 100); @endcode If you wish to be notified when a window is moved, whether by the user, the system or your own code, set a position callback. @code glfwSetWindowPosCallback(window, window_pos_callback); @endcode The callback function receives the new position, in screen coordinates, of the upper-left corner of the content area when the window is moved. @code void window_pos_callback(GLFWwindow* window, int xpos, int ypos) { } @endcode There is also @ref glfwGetWindowPos for directly retrieving the current position of the content area of the window. @code int xpos, ypos; glfwGetWindowPos(window, &xpos, &ypos); @endcode @subsection window_title Window title All GLFW windows have a title, although undecorated or full screen windows may not display it or only display it in a task bar or similar interface. You can set a UTF-8 encoded window title with @ref glfwSetWindowTitle. @code glfwSetWindowTitle(window, "My Window"); @endcode The specified string is copied before the function returns, so there is no need to keep it around. As long as your source file is encoded as UTF-8, you can use any Unicode characters directly in the source. @code glfwSetWindowTitle(window, "ラストエグザイル"); @endcode If you are using C++11 or C11, you can use a UTF-8 string literal. @code glfwSetWindowTitle(window, u8"This is always a UTF-8 string"); @endcode @subsection window_icon Window icon Decorated windows have icons on some platforms. You can set this icon by specifying a list of candidate images with @ref glfwSetWindowIcon. @code GLFWimage images[2]; images[0] = load_icon("my_icon.png"); images[1] = load_icon("my_icon_small.png"); glfwSetWindowIcon(window, 2, images); @endcode The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. The pixels are arranged canonically as sequential rows, starting from the top-left corner. To revert to the default window icon, pass in an empty image array. @code glfwSetWindowIcon(window, 0, NULL); @endcode @subsection window_monitor Window monitor Full screen windows are associated with a specific monitor. You can get the handle for this monitor with @ref glfwGetWindowMonitor. @code GLFWmonitor* monitor = glfwGetWindowMonitor(window); @endcode This monitor handle is one of those returned by @ref glfwGetMonitors. For windowed mode windows, this function returns `NULL`. This is how to tell full screen windows from windowed mode windows. You can move windows between monitors or between full screen and windowed mode with @ref glfwSetWindowMonitor. When making a window full screen on the same or on a different monitor, specify the desired monitor, resolution and refresh rate. The position arguments are ignored. @code const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); @endcode When making the window windowed, specify the desired position and size. The refresh rate argument is ignored. @code glfwSetWindowMonitor(window, NULL, xpos, ypos, width, height, 0); @endcode This restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.. To restore a window that was originally windowed to its original size and position, save these before making it full screen and then pass them in as above. @subsection window_iconify Window iconification Windows can be iconified (i.e. minimized) with @ref glfwIconifyWindow. @code glfwIconifyWindow(window); @endcode When a full screen window is iconified, the original video mode of its monitor is restored until the user or application restores the window. Iconified windows can be restored with @ref glfwRestoreWindow. This function also restores windows from maximization. @code glfwRestoreWindow(window); @endcode When a full screen window is restored, the desired video mode is restored to its monitor as well. If you wish to be notified when a window is iconified or restored, whether by the user, system or your own code, set an iconify callback. @code glfwSetWindowIconifyCallback(window, window_iconify_callback); @endcode The callback function receives changes in the iconification state of the window. @code void window_iconify_callback(GLFWwindow* window, int iconified) { if (iconified) { // The window was iconified } else { // The window was restored } } @endcode You can also get the current iconification state with @ref glfwGetWindowAttrib. @code int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED); @endcode @subsection window_maximize Window maximization Windows can be maximized (i.e. zoomed) with @ref glfwMaximizeWindow. @code glfwMaximizeWindow(window); @endcode Full screen windows cannot be maximized and passing a full screen window to this function does nothing. Maximized windows can be restored with @ref glfwRestoreWindow. This function also restores windows from iconification. @code glfwRestoreWindow(window); @endcode If you wish to be notified when a window is maximized or restored, whether by the user, system or your own code, set a maximize callback. @code glfwSetWindowMaximizeCallback(window, window_maximize_callback); @endcode The callback function receives changes in the maximization state of the window. @code void window_maximize_callback(GLFWwindow* window, int maximized) { if (maximized) { // The window was maximized } else { // The window was restored } } @endcode You can also get the current maximization state with @ref glfwGetWindowAttrib. @code int maximized = glfwGetWindowAttrib(window, GLFW_MAXIMIZED); @endcode By default, newly created windows are not maximized. You can change this behavior by setting the [GLFW_MAXIMIZED](@ref GLFW_MAXIMIZED_hint) window hint before creating the window. @code glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); @endcode @subsection window_hide Window visibility Windowed mode windows can be hidden with @ref glfwHideWindow. @code glfwHideWindow(window); @endcode This makes the window completely invisible to the user, including removing it from the task bar, dock or window list. Full screen windows cannot be hidden and calling @ref glfwHideWindow on a full screen window does nothing. Hidden windows can be shown with @ref glfwShowWindow. @code glfwShowWindow(window); @endcode By default, this function will also set the input focus to that window. Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint to change this behavior for all newly created windows, or change the behavior for an existing window with @ref glfwSetWindowAttrib. You can also get the current visibility state with @ref glfwGetWindowAttrib. @code int visible = glfwGetWindowAttrib(window, GLFW_VISIBLE); @endcode By default, newly created windows are visible. You can change this behavior by setting the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint before creating the window. @code glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); @endcode Windows created hidden are completely invisible to the user until shown. This can be useful if you need to set up your window further before showing it, for example moving it to a specific location. @subsection window_focus Window input focus Windows can be given input focus and brought to the front with @ref glfwFocusWindow. @code glfwFocusWindow(window); @endcode Keep in mind that it can be very disruptive to the user when a window is forced to the top. For a less disruptive way of getting the user's attention, see [attention requests](@ref window_attention). If you wish to be notified when a window gains or loses input focus, whether by the user, system or your own code, set a focus callback. @code glfwSetWindowFocusCallback(window, window_focus_callback); @endcode The callback function receives changes in the input focus state of the window. @code void window_focus_callback(GLFWwindow* window, int focused) { if (focused) { // The window gained input focus } else { // The window lost input focus } } @endcode You can also get the current input focus state with @ref glfwGetWindowAttrib. @code int focused = glfwGetWindowAttrib(window, GLFW_FOCUSED); @endcode By default, newly created windows are given input focus. You can change this behavior by setting the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint before creating the window. @code glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE); @endcode @subsection window_attention Window attention request If you wish to notify the user of an event without interrupting, you can request attention with @ref glfwRequestWindowAttention. @code glfwRequestWindowAttention(window); @endcode The system will highlight the specified window, or on platforms where this is not supported, the application as a whole. Once the user has given it attention, the system will automatically end the request. @subsection window_refresh Window damage and refresh If you wish to be notified when the contents of a window is damaged and needs to be refreshed, set a window refresh callback. @code glfwSetWindowRefreshCallback(m_handle, window_refresh_callback); @endcode The callback function is called when the contents of the window needs to be refreshed. @code void window_refresh_callback(GLFWwindow* window) { draw_editor_ui(window); glfwSwapBuffers(window); } @endcode @note On compositing window systems such as Aero, Compiz or Aqua, where the window contents are saved off-screen, this callback might only be called when the window or framebuffer is resized. @subsection window_transparency Window transparency GLFW supports two kinds of transparency for windows; framebuffer transparency and whole window transparency. A single window may not use both methods. The results of doing this are undefined. Both methods require the platform to support it and not every version of every platform GLFW supports does this, so there are mechanisms to check whether the window really is transparent. Window framebuffers can be made transparent on a per-pixel per-frame basis with the [GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) window hint. @code glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); @endcode If supported by the system, the window content area will be composited with the background using the framebuffer per-pixel alpha channel. This requires desktop compositing to be enabled on the system. It does not affect window decorations. You can check whether the window framebuffer was successfully made transparent with the [GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib) window attribute. @code if (glfwGetWindowAttrib(window, GLFW_TRANSPARENT_FRAMEBUFFER)) { // window framebuffer is currently transparent } @endcode GLFW comes with an example that enabled framebuffer transparency called `gears`. The opacity of the whole window, including any decorations, can be set with @ref glfwSetWindowOpacity. @code glfwSetWindowOpacity(window, 0.5f); @endcode The opacity (or alpha) value is a positive finite number between zero and one, where 0 (zero) is fully transparent and 1 (one) is fully opaque. The initial opacity value for newly created windows is 1. The current opacity of a window can be queried with @ref glfwGetWindowOpacity. @code float opacity = glfwGetWindowOpacity(window); @endcode If the system does not support whole window transparency, this function always returns one. GLFW comes with a test program that lets you control whole window transparency at run-time called `opacity`. @subsection window_attribs Window attributes Windows have a number of attributes that can be returned using @ref glfwGetWindowAttrib. Some reflect state that may change as a result of user interaction, (e.g. whether it has input focus), while others reflect inherent properties of the window (e.g. what kind of border it has). Some are related to the window and others to its OpenGL or OpenGL ES context. @code if (glfwGetWindowAttrib(window, GLFW_FOCUSED)) { // window has input focus } @endcode The [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) window attributes can be changed with @ref glfwSetWindowAttrib. @code glfwSetWindowAttrib(window, GLFW_RESIZABLE, GLFW_FALSE); @endcode @subsubsection window_attribs_wnd Window related attributes @anchor GLFW_FOCUSED_attrib __GLFW_FOCUSED__ indicates whether the specified window has input focus. See @ref window_focus for details. @anchor GLFW_ICONIFIED_attrib __GLFW_ICONIFIED__ indicates whether the specified window is iconified. See @ref window_iconify for details. @anchor GLFW_MAXIMIZED_attrib __GLFW_MAXIMIZED__ indicates whether the specified window is maximized. See @ref window_maximize for details. @anchor GLFW_HOVERED_attrib __GLFW_HOVERED__ indicates whether the cursor is currently directly over the content area of the window, with no other windows between. See @ref cursor_enter for details. @anchor GLFW_VISIBLE_attrib __GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref window_hide for details. @anchor GLFW_RESIZABLE_attrib __GLFW_RESIZABLE__ indicates whether the specified window is resizable _by the user_. This can be set before creation with the [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_hint) window hint or after with @ref glfwSetWindowAttrib. @anchor GLFW_DECORATED_attrib __GLFW_DECORATED__ indicates whether the specified window has decorations such as a border, a close widget, etc. This can be set before creation with the [GLFW_DECORATED](@ref GLFW_DECORATED_hint) window hint or after with @ref glfwSetWindowAttrib. @anchor GLFW_AUTO_ICONIFY_attrib __GLFW_AUTO_ICONIFY__ indicates whether the specified full screen window is iconified on focus loss, a close widget, etc. This can be set before creation with the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint or after with @ref glfwSetWindowAttrib. @anchor GLFW_FLOATING_attrib __GLFW_FLOATING__ indicates whether the specified window is floating, also called topmost or always-on-top. This can be set before creation with the [GLFW_FLOATING](@ref GLFW_FLOATING_hint) window hint or after with @ref glfwSetWindowAttrib. @anchor GLFW_TRANSPARENT_FRAMEBUFFER_attrib __GLFW_TRANSPARENT_FRAMEBUFFER__ indicates whether the specified window has a transparent framebuffer, i.e. the window contents is composited with the background using the window framebuffer alpha channel. See @ref window_transparency for details. @anchor GLFW_FOCUS_ON_SHOW_attrib __GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input focus when @ref glfwShowWindow is called. This can be set before creation with the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint or after with @ref glfwSetWindowAttrib. @subsubsection window_attribs_ctx Context related attributes @anchor GLFW_CLIENT_API_attrib __GLFW_CLIENT_API__ indicates the client API provided by the window's context; either `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` or `GLFW_NO_API`. @anchor GLFW_CONTEXT_CREATION_API_attrib __GLFW_CONTEXT_CREATION_API__ indicates the context creation API used to create the window's context; either `GLFW_NATIVE_CONTEXT_API`, `GLFW_EGL_CONTEXT_API` or `GLFW_OSMESA_CONTEXT_API`. @anchor GLFW_CONTEXT_VERSION_MAJOR_attrib @anchor GLFW_CONTEXT_VERSION_MINOR_attrib @anchor GLFW_CONTEXT_REVISION_attrib __GLFW_CONTEXT_VERSION_MAJOR__, __GLFW_CONTEXT_VERSION_MINOR__ and __GLFW_CONTEXT_REVISION__ indicate the client API version of the window's context. @note Do not confuse these attributes with `GLFW_VERSION_MAJOR`, `GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` which provide the API version of the GLFW header. @anchor GLFW_OPENGL_FORWARD_COMPAT_attrib __GLFW_OPENGL_FORWARD_COMPAT__ is `GLFW_TRUE` if the window's context is an OpenGL forward-compatible one, or `GLFW_FALSE` otherwise. @anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib __GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is an OpenGL debug context, or `GLFW_FALSE` otherwise. @anchor GLFW_OPENGL_PROFILE_attrib __GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` if the context uses a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the OpenGL profile is unknown or the context is an OpenGL ES context. Note that the returned profile may not match the profile bits of the context flags, as GLFW will try other means of detecting the profile when no bits are set. @anchor GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib __GLFW_CONTEXT_RELEASE_BEHAVIOR__ indicates the release used by the context. Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`, the pipeline will be flushed whenever the context is released from being the current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will not be flushed on release. @anchor GLFW_CONTEXT_NO_ERROR_attrib __GLFW_CONTEXT_NO_ERROR__ indicates whether errors are generated by the context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, situations that would have generated errors instead cause undefined behavior. @anchor GLFW_CONTEXT_ROBUSTNESS_attrib __GLFW_CONTEXT_ROBUSTNESS__ indicates the robustness strategy used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or `GLFW_NO_RESET_NOTIFICATION` if the window's context supports robustness, or `GLFW_NO_ROBUSTNESS` otherwise. @subsubsection window_attribs_fb Framebuffer related attributes GLFW does not expose attributes of the default framebuffer (i.e. the framebuffer attached to the window) as these can be queried directly with either OpenGL, OpenGL ES or Vulkan. If you are using version 3.0 or later of OpenGL or OpenGL ES, the `glGetFramebufferAttachmentParameteriv` function can be used to retrieve the number of bits for the red, green, blue, alpha, depth and stencil buffer channels. Otherwise, the `glGetIntegerv` function can be used. The number of MSAA samples are always retrieved with `glGetIntegerv`. For contexts supporting framebuffer objects, the number of samples of the currently bound framebuffer is returned. Attribute | glGetIntegerv | glGetFramebufferAttachmentParameteriv ------------ | ----------------- | ------------------------------------- Red bits | `GL_RED_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE` Green bits | `GL_GREEN_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE` Blue bits | `GL_BLUE_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE` Alpha bits | `GL_ALPHA_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE` Depth bits | `GL_DEPTH_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE` Stencil bits | `GL_STENCIL_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE` MSAA samples | `GL_SAMPLES` | _Not provided by this function_ When calling `glGetFramebufferAttachmentParameteriv`, the red, green, blue and alpha sizes are queried from the `GL_BACK_LEFT`, while the depth and stencil sizes are queried from the `GL_DEPTH` and `GL_STENCIL` attachments, respectively. @section buffer_swap Buffer swapping GLFW windows are by default double buffered. That means that you have two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to. When the entire frame has been rendered, it is time to swap the back and the front buffers in order to display what has been rendered and begin rendering a new frame. This is done with @ref glfwSwapBuffers. @code glfwSwapBuffers(window); @endcode Sometimes it can be useful to select when the buffer swap will occur. With the function @ref glfwSwapInterval it is possible to select the minimum number of monitor refreshes the driver should wait from the time @ref glfwSwapBuffers was called before swapping the buffers: @code glfwSwapInterval(1); @endcode If the interval is zero, the swap will take place immediately when @ref glfwSwapBuffers is called without waiting for a refresh. Otherwise at least interval retraces will pass between each buffer swap. Using a swap interval of zero can be useful for benchmarking purposes, when it is not desirable to measure the time it takes to wait for the vertical retrace. However, a swap interval of one lets you avoid tearing. Note that this may not work on all machines, as some drivers have user-controlled settings that override any swap interval the application requests. A context that supports either the `WGL_EXT_swap_control_tear` or the `GLX_EXT_swap_control_tear` extension also accepts _negative_ swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. This trades the risk of visible tears for greater framerate stability. You can check for these extensions with @ref glfwExtensionSupported. */ ================================================ FILE: thirdparty/glfw/examples/CMakeLists.txt ================================================ link_libraries(glfw) include_directories("${GLFW_SOURCE_DIR}/deps") if (MATH_LIBRARY) link_libraries("${MATH_LIBRARY}") endif() if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() if (WIN32) set(ICON glfw.rc) elseif (APPLE) set(ICON glfw.icns) endif() if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.1.0") set(CMAKE_C_STANDARD 99) else() # Remove this fallback when removing support for CMake version less than 3.1 add_compile_options("$<$:-std=c99>" "$<$:-std=c99>" "$<$:-std=c99>") endif() set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h" "${GLFW_SOURCE_DIR}/deps/glad_gl.c") set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" "${GLFW_SOURCE_DIR}/deps/getopt.c") set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" "${GLFW_SOURCE_DIR}/deps/tinycthread.c") add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL}) add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL}) add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL}) add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL}) add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL}) add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL}) add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD_GL}) add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL}) add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL}) target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}") if (RT_LIBRARY) target_link_libraries(particles "${RT_LIBRARY}") endif() set(GUI_ONLY_BINARIES boing gears heightmap particles sharing simple splitview wave) set(CONSOLE_BINARIES offscreen) set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES FOLDER "GLFW3/Examples") if (GLFW_USE_OSMESA) target_compile_definitions(offscreen PRIVATE USE_NATIVE_OSMESA) endif() if (MSVC) # Tell MSVC to use main instead of WinMain for Windows subsystem executables set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") endif() if (APPLE) set_target_properties(boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing") set_target_properties(gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears") set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap") set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles") set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") set_target_properties(simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple") set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView") set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave") set_source_files_properties(glfw.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_ICON_FILE glfw.icns MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") endif() ================================================ FILE: thirdparty/glfw/examples/boing.c ================================================ /***************************************************************************** * Title: GLBoing * Desc: Tribute to Amiga Boing. * Author: Jim Brooks * Original Amiga authors were R.J. Mical and Dale Luck. * GLFW conversion by Marcus Geelnard * Notes: - 360' = 2*PI [radian] * * - Distances between objects are created by doing a relative * Z translations. * * - Although OpenGL enticingly supports alpha-blending, * the shadow of the original Boing didn't affect the color * of the grid. * * - [Marcus] Changed timing scheme from interval driven to frame- * time based animation steps (which results in much smoother * movement) * * History of Amiga Boing: * * Boing was demonstrated on the prototype Amiga (codenamed "Lorraine") in * 1985. According to legend, it was written ad-hoc in one night by * R. J. Mical and Dale Luck. Because the bouncing ball animation was so fast * and smooth, attendees did not believe the Amiga prototype was really doing * the rendering. Suspecting a trick, they began looking around the booth for * a hidden computer or VCR. *****************************************************************************/ #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include #include #include #include #define GLFW_INCLUDE_NONE #include #include /***************************************************************************** * Various declarations and macros *****************************************************************************/ /* Prototypes */ void init( void ); void display( void ); void reshape( GLFWwindow* window, int w, int h ); void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods ); void mouse_button_callback( GLFWwindow* window, int button, int action, int mods ); void cursor_position_callback( GLFWwindow* window, double x, double y ); void DrawBoingBall( void ); void BounceBall( double dt ); void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi ); void DrawGrid( void ); #define RADIUS 70.f #define STEP_LONGITUDE 22.5f /* 22.5 makes 8 bands like original Boing */ #define STEP_LATITUDE 22.5f #define DIST_BALL (RADIUS * 2.f + RADIUS * 0.1f) #define VIEW_SCENE_DIST (DIST_BALL * 3.f + 200.f)/* distance from viewer to middle of boing area */ #define GRID_SIZE (RADIUS * 4.5f) /* length (width) of grid */ #define BOUNCE_HEIGHT (RADIUS * 2.1f) #define BOUNCE_WIDTH (RADIUS * 2.1f) #define SHADOW_OFFSET_X -20.f #define SHADOW_OFFSET_Y 10.f #define SHADOW_OFFSET_Z 0.f #define WALL_L_OFFSET 0.f #define WALL_R_OFFSET 5.f /* Animation speed (50.0 mimics the original GLUT demo speed) */ #define ANIMATION_SPEED 50.f /* Maximum allowed delta time per physics iteration */ #define MAX_DELTA_T 0.02f /* Draw ball, or its shadow */ typedef enum { DRAW_BALL, DRAW_BALL_SHADOW } DRAW_BALL_ENUM; /* Vertex type */ typedef struct {float x; float y; float z;} vertex_t; /* Global vars */ int windowed_xpos, windowed_ypos, windowed_width, windowed_height; int width, height; GLfloat deg_rot_y = 0.f; GLfloat deg_rot_y_inc = 2.f; int override_pos = GLFW_FALSE; GLfloat cursor_x = 0.f; GLfloat cursor_y = 0.f; GLfloat ball_x = -RADIUS; GLfloat ball_y = -RADIUS; GLfloat ball_x_inc = 1.f; GLfloat ball_y_inc = 2.f; DRAW_BALL_ENUM drawBallHow; double t; double t_old = 0.f; double dt; /* Random number generator */ #ifndef RAND_MAX #define RAND_MAX 4095 #endif /***************************************************************************** * Truncate a degree. *****************************************************************************/ GLfloat TruncateDeg( GLfloat deg ) { if ( deg >= 360.f ) return (deg - 360.f); else return deg; } /***************************************************************************** * Convert a degree (360-based) into a radian. * 360' = 2 * PI *****************************************************************************/ double deg2rad( double deg ) { return deg / 360 * (2 * M_PI); } /***************************************************************************** * 360' sin(). *****************************************************************************/ double sin_deg( double deg ) { return sin( deg2rad( deg ) ); } /***************************************************************************** * 360' cos(). *****************************************************************************/ double cos_deg( double deg ) { return cos( deg2rad( deg ) ); } /***************************************************************************** * Compute a cross product (for a normal vector). * * c = a x b *****************************************************************************/ void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n ) { GLfloat u1, u2, u3; GLfloat v1, v2, v3; u1 = b.x - a.x; u2 = b.y - a.y; u3 = b.y - a.z; v1 = c.x - a.x; v2 = c.y - a.y; v3 = c.z - a.z; n->x = u2 * v3 - v2 * u3; n->y = u3 * v1 - v3 * u1; n->z = u1 * v2 - v1 * u2; } #define BOING_DEBUG 0 /***************************************************************************** * init() *****************************************************************************/ void init( void ) { /* * Clear background. */ glClearColor( 0.55f, 0.55f, 0.55f, 0.f ); glShadeModel( GL_FLAT ); } /***************************************************************************** * display() *****************************************************************************/ void display(void) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glPushMatrix(); drawBallHow = DRAW_BALL_SHADOW; DrawBoingBall(); DrawGrid(); drawBallHow = DRAW_BALL; DrawBoingBall(); glPopMatrix(); glFlush(); } /***************************************************************************** * reshape() *****************************************************************************/ void reshape( GLFWwindow* window, int w, int h ) { mat4x4 projection, view; glViewport( 0, 0, (GLsizei)w, (GLsizei)h ); glMatrixMode( GL_PROJECTION ); mat4x4_perspective( projection, 2.f * (float) atan2( RADIUS, 200.f ), (float)w / (float)h, 1.f, VIEW_SCENE_DIST ); glLoadMatrixf((const GLfloat*) projection); glMatrixMode( GL_MODELVIEW ); { vec3 eye = { 0.f, 0.f, VIEW_SCENE_DIST }; vec3 center = { 0.f, 0.f, 0.f }; vec3 up = { 0.f, -1.f, 0.f }; mat4x4_look_at( view, eye, center, up ); } glLoadMatrixf((const GLfloat*) view); } void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods ) { if (action != GLFW_PRESS) return; if (key == GLFW_KEY_ESCAPE && mods == 0) glfwSetWindowShouldClose(window, GLFW_TRUE); if ((key == GLFW_KEY_ENTER && mods == GLFW_MOD_ALT) || (key == GLFW_KEY_F11 && mods == GLFW_MOD_ALT)) { if (glfwGetWindowMonitor(window)) { glfwSetWindowMonitor(window, NULL, windowed_xpos, windowed_ypos, windowed_width, windowed_height, 0); } else { GLFWmonitor* monitor = glfwGetPrimaryMonitor(); if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwGetWindowPos(window, &windowed_xpos, &windowed_ypos); glfwGetWindowSize(window, &windowed_width, &windowed_height); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); } } } } static void set_ball_pos ( GLfloat x, GLfloat y ) { ball_x = (width / 2) - x; ball_y = y - (height / 2); } void mouse_button_callback( GLFWwindow* window, int button, int action, int mods ) { if (button != GLFW_MOUSE_BUTTON_LEFT) return; if (action == GLFW_PRESS) { override_pos = GLFW_TRUE; set_ball_pos(cursor_x, cursor_y); } else { override_pos = GLFW_FALSE; } } void cursor_position_callback( GLFWwindow* window, double x, double y ) { cursor_x = (float) x; cursor_y = (float) y; if ( override_pos ) set_ball_pos(cursor_x, cursor_y); } /***************************************************************************** * Draw the Boing ball. * * The Boing ball is sphere in which each facet is a rectangle. * Facet colors alternate between red and white. * The ball is built by stacking latitudinal circles. Each circle is composed * of a widely-separated set of points, so that each facet is noticeably large. *****************************************************************************/ void DrawBoingBall( void ) { GLfloat lon_deg; /* degree of longitude */ double dt_total, dt2; glPushMatrix(); glMatrixMode( GL_MODELVIEW ); /* * Another relative Z translation to separate objects. */ glTranslatef( 0.0, 0.0, DIST_BALL ); /* Update ball position and rotation (iterate if necessary) */ dt_total = dt; while( dt_total > 0.0 ) { dt2 = dt_total > MAX_DELTA_T ? MAX_DELTA_T : dt_total; dt_total -= dt2; BounceBall( dt2 ); deg_rot_y = TruncateDeg( deg_rot_y + deg_rot_y_inc*((float)dt2*ANIMATION_SPEED) ); } /* Set ball position */ glTranslatef( ball_x, ball_y, 0.0 ); /* * Offset the shadow. */ if ( drawBallHow == DRAW_BALL_SHADOW ) { glTranslatef( SHADOW_OFFSET_X, SHADOW_OFFSET_Y, SHADOW_OFFSET_Z ); } /* * Tilt the ball. */ glRotatef( -20.0, 0.0, 0.0, 1.0 ); /* * Continually rotate ball around Y axis. */ glRotatef( deg_rot_y, 0.0, 1.0, 0.0 ); /* * Set OpenGL state for Boing ball. */ glCullFace( GL_FRONT ); glEnable( GL_CULL_FACE ); glEnable( GL_NORMALIZE ); /* * Build a faceted latitude slice of the Boing ball, * stepping same-sized vertical bands of the sphere. */ for ( lon_deg = 0; lon_deg < 180; lon_deg += STEP_LONGITUDE ) { /* * Draw a latitude circle at this longitude. */ DrawBoingBallBand( lon_deg, lon_deg + STEP_LONGITUDE ); } glPopMatrix(); return; } /***************************************************************************** * Bounce the ball. *****************************************************************************/ void BounceBall( double delta_t ) { GLfloat sign; GLfloat deg; if ( override_pos ) return; /* Bounce on walls */ if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) ) { ball_x_inc = -0.5f - 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX; deg_rot_y_inc = -deg_rot_y_inc; } if ( ball_x < -(BOUNCE_HEIGHT/2 + WALL_L_OFFSET) ) { ball_x_inc = 0.5f + 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX; deg_rot_y_inc = -deg_rot_y_inc; } /* Bounce on floor / roof */ if ( ball_y > BOUNCE_HEIGHT/2 ) { ball_y_inc = -0.75f - 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX; } if ( ball_y < -BOUNCE_HEIGHT/2*0.85 ) { ball_y_inc = 0.75f + 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX; } /* Update ball position */ ball_x += ball_x_inc * ((float)delta_t*ANIMATION_SPEED); ball_y += ball_y_inc * ((float)delta_t*ANIMATION_SPEED); /* * Simulate the effects of gravity on Y movement. */ if ( ball_y_inc < 0 ) sign = -1.0; else sign = 1.0; deg = (ball_y + BOUNCE_HEIGHT/2) * 90 / BOUNCE_HEIGHT; if ( deg > 80 ) deg = 80; if ( deg < 10 ) deg = 10; ball_y_inc = sign * 4.f * (float) sin_deg( deg ); } /***************************************************************************** * Draw a faceted latitude band of the Boing ball. * * Parms: long_lo, long_hi * Low and high longitudes of slice, resp. *****************************************************************************/ void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi ) { vertex_t vert_ne; /* "ne" means south-east, so on */ vertex_t vert_nw; vertex_t vert_sw; vertex_t vert_se; vertex_t vert_norm; GLfloat lat_deg; static int colorToggle = 0; /* * Iterate through the points of a latitude circle. * A latitude circle is a 2D set of X,Z points. */ for ( lat_deg = 0; lat_deg <= (360 - STEP_LATITUDE); lat_deg += STEP_LATITUDE ) { /* * Color this polygon with red or white. */ if ( colorToggle ) glColor3f( 0.8f, 0.1f, 0.1f ); else glColor3f( 0.95f, 0.95f, 0.95f ); #if 0 if ( lat_deg >= 180 ) if ( colorToggle ) glColor3f( 0.1f, 0.8f, 0.1f ); else glColor3f( 0.5f, 0.5f, 0.95f ); #endif colorToggle = ! colorToggle; /* * Change color if drawing shadow. */ if ( drawBallHow == DRAW_BALL_SHADOW ) glColor3f( 0.35f, 0.35f, 0.35f ); /* * Assign each Y. */ vert_ne.y = vert_nw.y = (float) cos_deg(long_hi) * RADIUS; vert_sw.y = vert_se.y = (float) cos_deg(long_lo) * RADIUS; /* * Assign each X,Z with sin,cos values scaled by latitude radius indexed by longitude. * Eg, long=0 and long=180 are at the poles, so zero scale is sin(longitude), * while long=90 (sin(90)=1) is at equator. */ vert_ne.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_se.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo )); vert_nw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_sw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo )); vert_ne.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_se.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo )); vert_nw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); vert_sw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo )); /* * Draw the facet. */ glBegin( GL_POLYGON ); CrossProduct( vert_ne, vert_nw, vert_sw, &vert_norm ); glNormal3f( vert_norm.x, vert_norm.y, vert_norm.z ); glVertex3f( vert_ne.x, vert_ne.y, vert_ne.z ); glVertex3f( vert_nw.x, vert_nw.y, vert_nw.z ); glVertex3f( vert_sw.x, vert_sw.y, vert_sw.z ); glVertex3f( vert_se.x, vert_se.y, vert_se.z ); glEnd(); #if BOING_DEBUG printf( "----------------------------------------------------------- \n" ); printf( "lat = %f long_lo = %f long_hi = %f \n", lat_deg, long_lo, long_hi ); printf( "vert_ne x = %.8f y = %.8f z = %.8f \n", vert_ne.x, vert_ne.y, vert_ne.z ); printf( "vert_nw x = %.8f y = %.8f z = %.8f \n", vert_nw.x, vert_nw.y, vert_nw.z ); printf( "vert_se x = %.8f y = %.8f z = %.8f \n", vert_se.x, vert_se.y, vert_se.z ); printf( "vert_sw x = %.8f y = %.8f z = %.8f \n", vert_sw.x, vert_sw.y, vert_sw.z ); #endif } /* * Toggle color so that next band will opposite red/white colors than this one. */ colorToggle = ! colorToggle; /* * This circular band is done. */ return; } /***************************************************************************** * Draw the purple grid of lines, behind the Boing ball. * When the Workbench is dropped to the bottom, Boing shows 12 rows. *****************************************************************************/ void DrawGrid( void ) { int row, col; const int rowTotal = 12; /* must be divisible by 2 */ const int colTotal = rowTotal; /* must be same as rowTotal */ const GLfloat widthLine = 2.0; /* should be divisible by 2 */ const GLfloat sizeCell = GRID_SIZE / rowTotal; const GLfloat z_offset = -40.0; GLfloat xl, xr; GLfloat yt, yb; glPushMatrix(); glDisable( GL_CULL_FACE ); /* * Another relative Z translation to separate objects. */ glTranslatef( 0.0, 0.0, DIST_BALL ); /* * Draw vertical lines (as skinny 3D rectangles). */ for ( col = 0; col <= colTotal; col++ ) { /* * Compute co-ords of line. */ xl = -GRID_SIZE / 2 + col * sizeCell; xr = xl + widthLine; yt = GRID_SIZE / 2; yb = -GRID_SIZE / 2 - widthLine; glBegin( GL_POLYGON ); glColor3f( 0.6f, 0.1f, 0.6f ); /* purple */ glVertex3f( xr, yt, z_offset ); /* NE */ glVertex3f( xl, yt, z_offset ); /* NW */ glVertex3f( xl, yb, z_offset ); /* SW */ glVertex3f( xr, yb, z_offset ); /* SE */ glEnd(); } /* * Draw horizontal lines (as skinny 3D rectangles). */ for ( row = 0; row <= rowTotal; row++ ) { /* * Compute co-ords of line. */ yt = GRID_SIZE / 2 - row * sizeCell; yb = yt - widthLine; xl = -GRID_SIZE / 2; xr = GRID_SIZE / 2 + widthLine; glBegin( GL_POLYGON ); glColor3f( 0.6f, 0.1f, 0.6f ); /* purple */ glVertex3f( xr, yt, z_offset ); /* NE */ glVertex3f( xl, yt, z_offset ); /* NW */ glVertex3f( xl, yb, z_offset ); /* SW */ glVertex3f( xr, yb, z_offset ); /* SE */ glEnd(); } glPopMatrix(); return; } /*======================================================================* * main() *======================================================================*/ int main( void ) { GLFWwindow* window; /* Init GLFW */ if( !glfwInit() ) exit( EXIT_FAILURE ); window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL ); if (!window) { glfwTerminate(); exit( EXIT_FAILURE ); } glfwSetWindowAspectRatio(window, 1, 1); glfwSetFramebufferSizeCallback(window, reshape); glfwSetKeyCallback(window, key_callback); glfwSetMouseButtonCallback(window, mouse_button_callback); glfwSetCursorPosCallback(window, cursor_position_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval( 1 ); glfwGetFramebufferSize(window, &width, &height); reshape(window, width, height); glfwSetTime( 0.0 ); init(); /* Main loop */ for (;;) { /* Timing */ t = glfwGetTime(); dt = t - t_old; t_old = t; /* Draw one frame */ display(); /* Swap buffers */ glfwSwapBuffers(window); glfwPollEvents(); /* Check if we are still running */ if (glfwWindowShouldClose(window)) break; } glfwTerminate(); exit( EXIT_SUCCESS ); } ================================================ FILE: thirdparty/glfw/examples/gears.c ================================================ /* * 3-D gear wheels. This program is in the public domain. * * Command line options: * -info print GL implementation information * -exit automatically exit after 30 seconds * * * Brian Paul * * * Marcus Geelnard: * - Conversion to GLFW * - Time based rendering (frame rate independent) * - Slightly modified camera that should work better for stereo viewing * * * Camilla Löwy: * - Removed FPS counter (this is not a benchmark) * - Added a few comments * - Enabled vsync */ #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include #include #include #include #include #define GLFW_INCLUDE_NONE #include /** Draw a gear wheel. You'll probably want to call this function when building a display list since we do a lot of trig here. Input: inner_radius - radius of hole at center outer_radius - radius at center of teeth width - width of gear teeth - number of teeth tooth_depth - depth of tooth **/ static void gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth) { GLint i; GLfloat r0, r1, r2; GLfloat angle, da; GLfloat u, v, len; r0 = inner_radius; r1 = outer_radius - tooth_depth / 2.f; r2 = outer_radius + tooth_depth / 2.f; da = 2.f * (float) M_PI / teeth / 4.f; glShadeModel(GL_FLAT); glNormal3f(0.f, 0.f, 1.f); /* draw front face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.f * (float) M_PI / teeth; glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f); glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f); if (i < teeth) { glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f); glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f); } } glEnd(); /* draw front sides of teeth */ glBegin(GL_QUADS); da = 2.f * (float) M_PI / teeth / 4.f; for (i = 0; i < teeth; i++) { angle = i * 2.f * (float) M_PI / teeth; glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f); glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), width * 0.5f); glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f); } glEnd(); glNormal3f(0.0, 0.0, -1.0); /* draw back face */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.f * (float) M_PI / teeth; glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f); glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f); if (i < teeth) { glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f); glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f); } } glEnd(); /* draw back sides of teeth */ glBegin(GL_QUADS); da = 2.f * (float) M_PI / teeth / 4.f; for (i = 0; i < teeth; i++) { angle = i * 2.f * (float) M_PI / teeth; glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f); glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), -width * 0.5f); glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), -width * 0.5f); glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f); } glEnd(); /* draw outward faces of teeth */ glBegin(GL_QUAD_STRIP); for (i = 0; i < teeth; i++) { angle = i * 2.f * (float) M_PI / teeth; glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f); glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f); u = r2 * (float) cos(angle + da) - r1 * (float) cos(angle); v = r2 * (float) sin(angle + da) - r1 * (float) sin(angle); len = (float) sqrt(u * u + v * v); u /= len; v /= len; glNormal3f(v, -u, 0.0); glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), width * 0.5f); glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), -width * 0.5f); glNormal3f((float) cos(angle), (float) sin(angle), 0.f); glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), width * 0.5f); glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), -width * 0.5f); u = r1 * (float) cos(angle + 3 * da) - r2 * (float) cos(angle + 2 * da); v = r1 * (float) sin(angle + 3 * da) - r2 * (float) sin(angle + 2 * da); glNormal3f(v, -u, 0.f); glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f); glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f); glNormal3f((float) cos(angle), (float) sin(angle), 0.f); } glVertex3f(r1 * (float) cos(0), r1 * (float) sin(0), width * 0.5f); glVertex3f(r1 * (float) cos(0), r1 * (float) sin(0), -width * 0.5f); glEnd(); glShadeModel(GL_SMOOTH); /* draw inside radius cylinder */ glBegin(GL_QUAD_STRIP); for (i = 0; i <= teeth; i++) { angle = i * 2.f * (float) M_PI / teeth; glNormal3f(-(float) cos(angle), -(float) sin(angle), 0.f); glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f); glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f); } glEnd(); } static GLfloat view_rotx = 20.f, view_roty = 30.f, view_rotz = 0.f; static GLint gear1, gear2, gear3; static GLfloat angle = 0.f; /* OpenGL draw function & timing */ static void draw(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(view_rotx, 1.0, 0.0, 0.0); glRotatef(view_roty, 0.0, 1.0, 0.0); glRotatef(view_rotz, 0.0, 0.0, 1.0); glPushMatrix(); glTranslatef(-3.0, -2.0, 0.0); glRotatef(angle, 0.0, 0.0, 1.0); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef(3.1f, -2.f, 0.f); glRotatef(-2.f * angle - 9.f, 0.f, 0.f, 1.f); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef(-3.1f, 4.2f, 0.f); glRotatef(-2.f * angle - 25.f, 0.f, 0.f, 1.f); glCallList(gear3); glPopMatrix(); glPopMatrix(); } /* update animation parameters */ static void animate(void) { angle = 100.f * (float) glfwGetTime(); } /* change view angle, exit upon ESC */ void key( GLFWwindow* window, int k, int s, int action, int mods ) { if( action != GLFW_PRESS ) return; switch (k) { case GLFW_KEY_Z: if( mods & GLFW_MOD_SHIFT ) view_rotz -= 5.0; else view_rotz += 5.0; break; case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; case GLFW_KEY_UP: view_rotx += 5.0; break; case GLFW_KEY_DOWN: view_rotx -= 5.0; break; case GLFW_KEY_LEFT: view_roty += 5.0; break; case GLFW_KEY_RIGHT: view_roty -= 5.0; break; default: return; } } /* new window size */ void reshape( GLFWwindow* window, int width, int height ) { GLfloat h = (GLfloat) height / (GLfloat) width; GLfloat xmax, znear, zfar; znear = 5.0f; zfar = 30.0f; xmax = znear * 0.5f; glViewport( 0, 0, (GLint) width, (GLint) height ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glFrustum( -xmax, xmax, -xmax*h, xmax*h, znear, zfar ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, -20.0 ); } /* program & OpenGL initialization */ static void init(void) { static GLfloat pos[4] = {5.f, 5.f, 10.f, 0.f}; static GLfloat red[4] = {0.8f, 0.1f, 0.f, 1.f}; static GLfloat green[4] = {0.f, 0.8f, 0.2f, 1.f}; static GLfloat blue[4] = {0.2f, 0.2f, 1.f, 1.f}; glLightfv(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); /* make the gears */ gear1 = glGenLists(1); glNewList(gear1, GL_COMPILE); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); gear(1.f, 4.f, 1.f, 20, 0.7f); glEndList(); gear2 = glGenLists(1); glNewList(gear2, GL_COMPILE); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); gear(0.5f, 2.f, 2.f, 10, 0.7f); glEndList(); gear3 = glGenLists(1); glNewList(gear3, GL_COMPILE); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); gear(1.3f, 2.f, 0.5f, 10, 0.7f); glEndList(); glEnable(GL_NORMALIZE); } /* program entry */ int main(int argc, char *argv[]) { GLFWwindow* window; int width, height; if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); exit( EXIT_FAILURE ); } glfwWindowHint(GLFW_DEPTH_BITS, 16); glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); window = glfwCreateWindow( 300, 300, "Gears", NULL, NULL ); if (!window) { fprintf( stderr, "Failed to open GLFW window\n" ); glfwTerminate(); exit( EXIT_FAILURE ); } // Set callback functions glfwSetFramebufferSizeCallback(window, reshape); glfwSetKeyCallback(window, key); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval( 1 ); glfwGetFramebufferSize(window, &width, &height); reshape(window, width, height); // Parse command-line options init(); // Main loop while( !glfwWindowShouldClose(window) ) { // Draw gears draw(); // Update animation animate(); // Swap buffers glfwSwapBuffers(window); glfwPollEvents(); } // Terminate GLFW glfwTerminate(); // Exit program exit( EXIT_SUCCESS ); } ================================================ FILE: thirdparty/glfw/examples/glfw.rc ================================================ GLFW_ICON ICON "glfw.ico" ================================================ FILE: thirdparty/glfw/examples/heightmap.c ================================================ //======================================================================== // Heightmap example program using OpenGL 3 core profile // Copyright (c) 2010 Olivier Delannoy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define GLFW_INCLUDE_NONE #include /* Map height updates */ #define MAX_CIRCLE_SIZE (5.0f) #define MAX_DISPLACEMENT (1.0f) #define DISPLACEMENT_SIGN_LIMIT (0.3f) #define MAX_ITER (200) #define NUM_ITER_AT_A_TIME (1) /* Map general information */ #define MAP_SIZE (10.0f) #define MAP_NUM_VERTICES (80) #define MAP_NUM_TOTAL_VERTICES (MAP_NUM_VERTICES*MAP_NUM_VERTICES) #define MAP_NUM_LINES (3* (MAP_NUM_VERTICES - 1) * (MAP_NUM_VERTICES - 1) + \ 2 * (MAP_NUM_VERTICES - 1)) /********************************************************************** * Default shader programs *********************************************************************/ static const char* vertex_shader_text = "#version 150\n" "uniform mat4 project;\n" "uniform mat4 modelview;\n" "in float x;\n" "in float y;\n" "in float z;\n" "\n" "void main()\n" "{\n" " gl_Position = project * modelview * vec4(x, y, z, 1.0);\n" "}\n"; static const char* fragment_shader_text = "#version 150\n" "out vec4 color;\n" "void main()\n" "{\n" " color = vec4(0.2, 1.0, 0.2, 1.0); \n" "}\n"; /********************************************************************** * Values for shader uniforms *********************************************************************/ /* Frustum configuration */ static GLfloat view_angle = 45.0f; static GLfloat aspect_ratio = 4.0f/3.0f; static GLfloat z_near = 1.0f; static GLfloat z_far = 100.f; /* Projection matrix */ static GLfloat projection_matrix[16] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; /* Model view matrix */ static GLfloat modelview_matrix[16] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; /********************************************************************** * Heightmap vertex and index data *********************************************************************/ static GLfloat map_vertices[3][MAP_NUM_TOTAL_VERTICES]; static GLuint map_line_indices[2*MAP_NUM_LINES]; /* Store uniform location for the shaders * Those values are setup as part of the process of creating * the shader program. They should not be used before creating * the program. */ static GLuint mesh; static GLuint mesh_vbo[4]; /********************************************************************** * OpenGL helper functions *********************************************************************/ /* Creates a shader object of the specified type using the specified text */ static GLuint make_shader(GLenum type, const char* text) { GLuint shader; GLint shader_ok; GLsizei log_length; char info_log[8192]; shader = glCreateShader(type); if (shader != 0) { glShaderSource(shader, 1, (const GLchar**)&text, NULL); glCompileShader(shader); glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok); if (shader_ok != GL_TRUE) { fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" ); glGetShaderInfoLog(shader, 8192, &log_length,info_log); fprintf(stderr, "ERROR: \n%s\n\n", info_log); glDeleteShader(shader); shader = 0; } } return shader; } /* Creates a program object using the specified vertex and fragment text */ static GLuint make_shader_program(const char* vs_text, const char* fs_text) { GLuint program = 0u; GLint program_ok; GLuint vertex_shader = 0u; GLuint fragment_shader = 0u; GLsizei log_length; char info_log[8192]; vertex_shader = make_shader(GL_VERTEX_SHADER, vs_text); if (vertex_shader != 0u) { fragment_shader = make_shader(GL_FRAGMENT_SHADER, fs_text); if (fragment_shader != 0u) { /* make the program that connect the two shader and link it */ program = glCreateProgram(); if (program != 0u) { /* attach both shader and link */ glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); glGetProgramiv(program, GL_LINK_STATUS, &program_ok); if (program_ok != GL_TRUE) { fprintf(stderr, "ERROR, failed to link shader program\n"); glGetProgramInfoLog(program, 8192, &log_length, info_log); fprintf(stderr, "ERROR: \n%s\n\n", info_log); glDeleteProgram(program); glDeleteShader(fragment_shader); glDeleteShader(vertex_shader); program = 0u; } } } else { fprintf(stderr, "ERROR: Unable to load fragment shader\n"); glDeleteShader(vertex_shader); } } else { fprintf(stderr, "ERROR: Unable to load vertex shader\n"); } return program; } /********************************************************************** * Geometry creation functions *********************************************************************/ /* Generate vertices and indices for the heightmap */ static void init_map(void) { int i; int j; int k; GLfloat step = MAP_SIZE / (MAP_NUM_VERTICES - 1); GLfloat x = 0.0f; GLfloat z = 0.0f; /* Create a flat grid */ k = 0; for (i = 0 ; i < MAP_NUM_VERTICES ; ++i) { for (j = 0 ; j < MAP_NUM_VERTICES ; ++j) { map_vertices[0][k] = x; map_vertices[1][k] = 0.0f; map_vertices[2][k] = z; z += step; ++k; } x += step; z = 0.0f; } #if DEBUG_ENABLED for (i = 0 ; i < MAP_NUM_TOTAL_VERTICES ; ++i) { printf ("Vertice %d (%f, %f, %f)\n", i, map_vertices[0][i], map_vertices[1][i], map_vertices[2][i]); } #endif /* create indices */ /* line fan based on i * i+1 * | / i + n + 1 * | / * |/ * i --- i + n */ /* close the top of the square */ k = 0; for (i = 0 ; i < MAP_NUM_VERTICES -1 ; ++i) { map_line_indices[k++] = (i + 1) * MAP_NUM_VERTICES -1; map_line_indices[k++] = (i + 2) * MAP_NUM_VERTICES -1; } /* close the right of the square */ for (i = 0 ; i < MAP_NUM_VERTICES -1 ; ++i) { map_line_indices[k++] = (MAP_NUM_VERTICES - 1) * MAP_NUM_VERTICES + i; map_line_indices[k++] = (MAP_NUM_VERTICES - 1) * MAP_NUM_VERTICES + i + 1; } for (i = 0 ; i < (MAP_NUM_VERTICES - 1) ; ++i) { for (j = 0 ; j < (MAP_NUM_VERTICES - 1) ; ++j) { int ref = i * (MAP_NUM_VERTICES) + j; map_line_indices[k++] = ref; map_line_indices[k++] = ref + 1; map_line_indices[k++] = ref; map_line_indices[k++] = ref + MAP_NUM_VERTICES; map_line_indices[k++] = ref; map_line_indices[k++] = ref + MAP_NUM_VERTICES + 1; } } #ifdef DEBUG_ENABLED for (k = 0 ; k < 2 * MAP_NUM_LINES ; k += 2) { int beg, end; beg = map_line_indices[k]; end = map_line_indices[k+1]; printf ("Line %d: %d -> %d (%f, %f, %f) -> (%f, %f, %f)\n", k / 2, beg, end, map_vertices[0][beg], map_vertices[1][beg], map_vertices[2][beg], map_vertices[0][end], map_vertices[1][end], map_vertices[2][end]); } #endif } static void generate_heightmap__circle(float* center_x, float* center_y, float* size, float* displacement) { float sign; /* random value for element in between [0-1.0] */ *center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); *center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); *size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX); sign = (1.0f * rand()) / (1.0f * RAND_MAX); sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f; *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX); } /* Run the specified number of iterations of the generation process for the * heightmap */ static void update_map(int num_iter) { assert(num_iter > 0); while(num_iter) { /* center of the circle */ float center_x; float center_z; float circle_size; float disp; size_t ii; generate_heightmap__circle(¢er_x, ¢er_z, &circle_size, &disp); disp = disp / 2.0f; for (ii = 0u ; ii < MAP_NUM_TOTAL_VERTICES ; ++ii) { GLfloat dx = center_x - map_vertices[0][ii]; GLfloat dz = center_z - map_vertices[2][ii]; GLfloat pd = (2.0f * (float) sqrt((dx * dx) + (dz * dz))) / circle_size; if (fabs(pd) <= 1.0f) { /* tx,tz is within the circle */ GLfloat new_height = disp + (float) (cos(pd*3.14f)*disp); map_vertices[1][ii] += new_height; } } --num_iter; } } /********************************************************************** * OpenGL helper functions *********************************************************************/ /* Create VBO, IBO and VAO objects for the heightmap geometry and bind them to * the specified program object */ static void make_mesh(GLuint program) { GLuint attrloc; glGenVertexArrays(1, &mesh); glGenBuffers(4, mesh_vbo); glBindVertexArray(mesh); /* Prepare the data for drawing through a buffer inidices */ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW); /* Prepare the attributes for rendering */ attrloc = glGetAttribLocation(program, "x"); glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW); glEnableVertexAttribArray(attrloc); glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); attrloc = glGetAttribLocation(program, "z"); glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW); glEnableVertexAttribArray(attrloc); glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); attrloc = glGetAttribLocation(program, "y"); glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW); glEnableVertexAttribArray(attrloc); glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); } /* Update VBO vertices from source data */ static void update_mesh(void) { glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]); } /********************************************************************** * GLFW callback functions *********************************************************************/ static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { switch(key) { case GLFW_KEY_ESCAPE: /* Exit program on Escape */ glfwSetWindowShouldClose(window, GLFW_TRUE); break; } } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } int main(int argc, char** argv) { GLFWwindow* window; int iter; double dt; double last_update_time; int frame; float f; GLint uloc_modelview; GLint uloc_project; int width, height; GLuint shader_program; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL); if (! window ) { glfwTerminate(); exit(EXIT_FAILURE); } /* Register events callback */ glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); /* Prepare opengl resources for rendering */ shader_program = make_shader_program(vertex_shader_text, fragment_shader_text); if (shader_program == 0u) { glfwTerminate(); exit(EXIT_FAILURE); } glUseProgram(shader_program); uloc_project = glGetUniformLocation(shader_program, "project"); uloc_modelview = glGetUniformLocation(shader_program, "modelview"); /* Compute the projection matrix */ f = 1.0f / tanf(view_angle / 2.0f); projection_matrix[0] = f / aspect_ratio; projection_matrix[5] = f; projection_matrix[10] = (z_far + z_near)/ (z_near - z_far); projection_matrix[11] = -1.0f; projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far); glUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix); /* Set the camera position */ modelview_matrix[12] = -5.0f; modelview_matrix[13] = -5.0f; modelview_matrix[14] = -20.0f; glUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix); /* Create mesh data */ init_map(); make_mesh(shader_program); /* Create vao + vbo to store the mesh */ /* Create the vbo to store all the information for the grid and the height */ /* setup the scene ready for rendering */ glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); /* main loop */ frame = 0; iter = 0; last_update_time = glfwGetTime(); while (!glfwWindowShouldClose(window)) { ++frame; /* render the next frame */ glClear(GL_COLOR_BUFFER_BIT); glDrawElements(GL_LINES, 2* MAP_NUM_LINES , GL_UNSIGNED_INT, 0); /* display and process events through callbacks */ glfwSwapBuffers(window); glfwPollEvents(); /* Check the frame rate and update the heightmap if needed */ dt = glfwGetTime(); if ((dt - last_update_time) > 0.2) { /* generate the next iteration of the heightmap */ if (iter < MAX_ITER) { update_map(NUM_ITER_AT_A_TIME); update_mesh(); iter += NUM_ITER_AT_A_TIME; } last_update_time = dt; frame = 0; } } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/examples/offscreen.c ================================================ //======================================================================== // Offscreen rendering example // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define GLFW_INCLUDE_NONE #include #if USE_NATIVE_OSMESA #define GLFW_EXPOSE_NATIVE_OSMESA #include #endif #include "linmath.h" #include #include #define STB_IMAGE_WRITE_IMPLEMENTATION #include static const struct { float x, y; float r, g, b; } vertices[3] = { { -0.6f, -0.4f, 1.f, 0.f, 0.f }, { 0.6f, -0.4f, 0.f, 1.f, 0.f }, { 0.f, 0.6f, 0.f, 0.f, 1.f } }; static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec3 vCol;\n" "attribute vec2 vPos;\n" "varying vec3 color;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" " color = vCol;\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "varying vec3 color;\n" "void main()\n" "{\n" " gl_FragColor = vec4(color, 1.0);\n" "}\n"; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } int main(void) { GLFWwindow* window; GLuint vertex_buffer, vertex_shader, fragment_shader, program; GLint mvp_location, vpos_location, vcol_location; float ratio; int width, height; mat4x4 mvp; char* buffer; glfwSetErrorCallback(error_callback); glfwInitHint(GLFW_COCOA_MENUBAR, GLFW_FALSE); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); // NOTE: OpenGL error checks have been omitted for brevity glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); vpos_location = glGetAttribLocation(program, "vPos"); vcol_location = glGetAttribLocation(program, "vCol"); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); glEnableVertexAttribArray(vcol_location); glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) (sizeof(float) * 2)); glfwGetFramebufferSize(window, &width, &height); ratio = width / (float) height; glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); mat4x4_ortho(mvp, -ratio, ratio, -1.f, 1.f, 1.f, -1.f); glUseProgram(program); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glDrawArrays(GL_TRIANGLES, 0, 3); #if USE_NATIVE_OSMESA glfwGetOSMesaColorBuffer(window, &width, &height, NULL, (void**) &buffer); #else buffer = calloc(4, width * height); glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); #endif // Write image Y-flipped because OpenGL stbi_write_png("offscreen.png", width, height, 4, buffer + (width * 4 * (height - 1)), -width * 4); #if USE_NATIVE_OSMESA // Here is where there's nothing #else free(buffer); #endif glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/examples/particles.c ================================================ //======================================================================== // A simple particle engine with threaded physics // Copyright (c) Marcus Geelnard // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include #include #include #include #include #include #include #include #include #define GLFW_INCLUDE_NONE #include // Define tokens for GL_EXT_separate_specular_color if not already defined #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 // GL_EXT_separate_specular_color //======================================================================== // Type definitions //======================================================================== typedef struct { float x, y, z; } Vec3; // This structure is used for interleaved vertex arrays (see the // draw_particles function) // // NOTE: This structure SHOULD be packed on most systems. It uses 32-bit fields // on 32-bit boundaries, and is a multiple of 64 bits in total (6x32=3x64). If // it does not work, try using pragmas or whatever to force the structure to be // packed. typedef struct { GLfloat s, t; // Texture coordinates GLuint rgba; // Color (four ubytes packed into an uint) GLfloat x, y, z; // Vertex coordinates } Vertex; //======================================================================== // Program control global variables //======================================================================== // Window dimensions float aspect_ratio; // "wireframe" flag (true if we use wireframe view) int wireframe; // Thread synchronization struct { double t; // Time (s) float dt; // Time since last frame (s) int p_frame; // Particle physics frame number int d_frame; // Particle draw frame number cnd_t p_done; // Condition: particle physics done cnd_t d_done; // Condition: particle draw done mtx_t particles_lock; // Particles data sharing mutex } thread_sync; //======================================================================== // Texture declarations (we hard-code them into the source code, since // they are so simple) //======================================================================== #define P_TEX_WIDTH 8 // Particle texture dimensions #define P_TEX_HEIGHT 8 #define F_TEX_WIDTH 16 // Floor texture dimensions #define F_TEX_HEIGHT 16 // Texture object IDs GLuint particle_tex_id, floor_tex_id; // Particle texture (a simple spot) const unsigned char particle_texture[ P_TEX_WIDTH * P_TEX_HEIGHT ] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x22, 0x11, 0x00, 0x00, 0x00, 0x11, 0x33, 0x88, 0x77, 0x33, 0x11, 0x00, 0x00, 0x22, 0x88, 0xff, 0xee, 0x77, 0x22, 0x00, 0x00, 0x22, 0x77, 0xee, 0xff, 0x88, 0x22, 0x00, 0x00, 0x11, 0x33, 0x77, 0x88, 0x33, 0x11, 0x00, 0x00, 0x00, 0x11, 0x33, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // Floor texture (your basic checkered floor) const unsigned char floor_texture[ F_TEX_WIDTH * F_TEX_HEIGHT ] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xf0, 0xcc, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xcc, 0xee, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x66, 0x30, 0x30, 0x30, 0x20, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xee, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xcc, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x55, 0x30, 0x30, 0x44, 0x30, 0x30, 0xf0, 0xdd, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x33, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x30, 0x30, 0xf0, 0xff, 0xf0, 0xf0, 0xdd, 0xf0, 0xf0, 0xff, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x55, 0x33, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, 0x30, 0x44, 0x66, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xaa, 0xf0, 0xf0, 0xcc, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xdd, 0xf0, 0x30, 0x30, 0x30, 0x77, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, }; //======================================================================== // These are fixed constants that control the particle engine. In a // modular world, these values should be variables... //======================================================================== // Maximum number of particles #define MAX_PARTICLES 3000 // Life span of a particle (in seconds) #define LIFE_SPAN 8.f // A new particle is born every [BIRTH_INTERVAL] second #define BIRTH_INTERVAL (LIFE_SPAN/(float)MAX_PARTICLES) // Particle size (meters) #define PARTICLE_SIZE 0.7f // Gravitational constant (m/s^2) #define GRAVITY 9.8f // Base initial velocity (m/s) #define VELOCITY 8.f // Bounce friction (1.0 = no friction, 0.0 = maximum friction) #define FRICTION 0.75f // "Fountain" height (m) #define FOUNTAIN_HEIGHT 3.f // Fountain radius (m) #define FOUNTAIN_RADIUS 1.6f // Minimum delta-time for particle phisics (s) #define MIN_DELTA_T (BIRTH_INTERVAL * 0.5f) //======================================================================== // Particle system global variables //======================================================================== // This structure holds all state for a single particle typedef struct { float x,y,z; // Position in space float vx,vy,vz; // Velocity vector float r,g,b; // Color of particle float life; // Life of particle (1.0 = newborn, < 0.0 = dead) int active; // Tells if this particle is active } PARTICLE; // Global vectors holding all particles. We use two vectors for double // buffering. static PARTICLE particles[MAX_PARTICLES]; // Global variable holding the age of the youngest particle static float min_age; // Color of latest born particle (used for fountain lighting) static float glow_color[4]; // Position of latest born particle (used for fountain lighting) static float glow_pos[4]; //======================================================================== // Object material and fog configuration constants //======================================================================== const GLfloat fountain_diffuse[4] = { 0.7f, 1.f, 1.f, 1.f }; const GLfloat fountain_specular[4] = { 1.f, 1.f, 1.f, 1.f }; const GLfloat fountain_shininess = 12.f; const GLfloat floor_diffuse[4] = { 1.f, 0.6f, 0.6f, 1.f }; const GLfloat floor_specular[4] = { 0.6f, 0.6f, 0.6f, 1.f }; const GLfloat floor_shininess = 18.f; const GLfloat fog_color[4] = { 0.1f, 0.1f, 0.1f, 1.f }; //======================================================================== // Print usage information //======================================================================== static void usage(void) { printf("Usage: particles [-bfhs]\n"); printf("Options:\n"); printf(" -f Run in full screen\n"); printf(" -h Display this help\n"); printf(" -s Run program as single thread (default is to use two threads)\n"); printf("\n"); printf("Program runtime controls:\n"); printf(" W Toggle wireframe mode\n"); printf(" Esc Exit program\n"); } //======================================================================== // Initialize a new particle //======================================================================== static void init_particle(PARTICLE *p, double t) { float xy_angle, velocity; // Start position of particle is at the fountain blow-out p->x = 0.f; p->y = 0.f; p->z = FOUNTAIN_HEIGHT; // Start velocity is up (Z)... p->vz = 0.7f + (0.3f / 4096.f) * (float) (rand() & 4095); // ...and a randomly chosen X/Y direction xy_angle = (2.f * (float) M_PI / 4096.f) * (float) (rand() & 4095); p->vx = 0.4f * (float) cos(xy_angle); p->vy = 0.4f * (float) sin(xy_angle); // Scale velocity vector according to a time-varying velocity velocity = VELOCITY * (0.8f + 0.1f * (float) (sin(0.5 * t) + sin(1.31 * t))); p->vx *= velocity; p->vy *= velocity; p->vz *= velocity; // Color is time-varying p->r = 0.7f + 0.3f * (float) sin(0.34 * t + 0.1); p->g = 0.6f + 0.4f * (float) sin(0.63 * t + 1.1); p->b = 0.6f + 0.4f * (float) sin(0.91 * t + 2.1); // Store settings for fountain glow lighting glow_pos[0] = 0.4f * (float) sin(1.34 * t); glow_pos[1] = 0.4f * (float) sin(3.11 * t); glow_pos[2] = FOUNTAIN_HEIGHT + 1.f; glow_pos[3] = 1.f; glow_color[0] = p->r; glow_color[1] = p->g; glow_color[2] = p->b; glow_color[3] = 1.f; // The particle is new-born and active p->life = 1.f; p->active = 1; } //======================================================================== // Update a particle //======================================================================== #define FOUNTAIN_R2 (FOUNTAIN_RADIUS+PARTICLE_SIZE/2)*(FOUNTAIN_RADIUS+PARTICLE_SIZE/2) static void update_particle(PARTICLE *p, float dt) { // If the particle is not active, we need not do anything if (!p->active) return; // The particle is getting older... p->life -= dt * (1.f / LIFE_SPAN); // Did the particle die? if (p->life <= 0.f) { p->active = 0; return; } // Apply gravity p->vz = p->vz - GRAVITY * dt; // Update particle position p->x = p->x + p->vx * dt; p->y = p->y + p->vy * dt; p->z = p->z + p->vz * dt; // Simple collision detection + response if (p->vz < 0.f) { // Particles should bounce on the fountain (with friction) if ((p->x * p->x + p->y * p->y) < FOUNTAIN_R2 && p->z < (FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2)) { p->vz = -FRICTION * p->vz; p->z = FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2 + FRICTION * (FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2 - p->z); } // Particles should bounce on the floor (with friction) else if (p->z < PARTICLE_SIZE / 2) { p->vz = -FRICTION * p->vz; p->z = PARTICLE_SIZE / 2 + FRICTION * (PARTICLE_SIZE / 2 - p->z); } } } //======================================================================== // The main frame for the particle engine. Called once per frame. //======================================================================== static void particle_engine(double t, float dt) { int i; float dt2; // Update particles (iterated several times per frame if dt is too large) while (dt > 0.f) { // Calculate delta time for this iteration dt2 = dt < MIN_DELTA_T ? dt : MIN_DELTA_T; for (i = 0; i < MAX_PARTICLES; i++) update_particle(&particles[i], dt2); min_age += dt2; // Should we create any new particle(s)? while (min_age >= BIRTH_INTERVAL) { min_age -= BIRTH_INTERVAL; // Find a dead particle to replace with a new one for (i = 0; i < MAX_PARTICLES; i++) { if (!particles[i].active) { init_particle(&particles[i], t + min_age); update_particle(&particles[i], min_age); break; } } } dt -= dt2; } } //======================================================================== // Draw all active particles. We use OpenGL 1.1 vertex // arrays for this in order to accelerate the drawing. //======================================================================== #define BATCH_PARTICLES 70 // Number of particles to draw in each batch // (70 corresponds to 7.5 KB = will not blow // the L1 data cache on most CPUs) #define PARTICLE_VERTS 4 // Number of vertices per particle static void draw_particles(GLFWwindow* window, double t, float dt) { int i, particle_count; Vertex vertex_array[BATCH_PARTICLES * PARTICLE_VERTS]; Vertex* vptr; float alpha; GLuint rgba; Vec3 quad_lower_left, quad_lower_right; GLfloat mat[16]; PARTICLE* pptr; // Here comes the real trick with flat single primitive objects (s.c. // "billboards"): We must rotate the textured primitive so that it // always faces the viewer (is coplanar with the view-plane). // We: // 1) Create the primitive around origo (0,0,0) // 2) Rotate it so that it is coplanar with the view plane // 3) Translate it according to the particle position // Note that 1) and 2) is the same for all particles (done only once). // Get modelview matrix. We will only use the upper left 3x3 part of // the matrix, which represents the rotation. glGetFloatv(GL_MODELVIEW_MATRIX, mat); // 1) & 2) We do it in one swift step: // Although not obvious, the following six lines represent two matrix/ // vector multiplications. The matrix is the inverse 3x3 rotation // matrix (i.e. the transpose of the same matrix), and the two vectors // represent the lower left corner of the quad, PARTICLE_SIZE/2 * // (-1,-1,0), and the lower right corner, PARTICLE_SIZE/2 * (1,-1,0). // The upper left/right corners of the quad is always the negative of // the opposite corners (regardless of rotation). quad_lower_left.x = (-PARTICLE_SIZE / 2) * (mat[0] + mat[1]); quad_lower_left.y = (-PARTICLE_SIZE / 2) * (mat[4] + mat[5]); quad_lower_left.z = (-PARTICLE_SIZE / 2) * (mat[8] + mat[9]); quad_lower_right.x = (PARTICLE_SIZE / 2) * (mat[0] - mat[1]); quad_lower_right.y = (PARTICLE_SIZE / 2) * (mat[4] - mat[5]); quad_lower_right.z = (PARTICLE_SIZE / 2) * (mat[8] - mat[9]); // Don't update z-buffer, since all particles are transparent! glDepthMask(GL_FALSE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); // Select particle texture if (!wireframe) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, particle_tex_id); } // Set up vertex arrays. We use interleaved arrays, which is easier to // handle (in most situations) and it gives a linear memory access // access pattern (which may give better performance in some // situations). GL_T2F_C4UB_V3F means: 2 floats for texture coords, // 4 ubytes for color and 3 floats for vertex coord (in that order). // Most OpenGL cards / drivers are optimized for this format. glInterleavedArrays(GL_T2F_C4UB_V3F, 0, vertex_array); // Wait for particle physics thread to be done mtx_lock(&thread_sync.particles_lock); while (!glfwWindowShouldClose(window) && thread_sync.p_frame <= thread_sync.d_frame) { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); ts.tv_nsec += 100 * 1000 * 1000; ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000); ts.tv_nsec %= 1000 * 1000 * 1000; cnd_timedwait(&thread_sync.p_done, &thread_sync.particles_lock, &ts); } // Store the frame time and delta time for the physics thread thread_sync.t = t; thread_sync.dt = dt; // Update frame counter thread_sync.d_frame++; // Loop through all particles and build vertex arrays. particle_count = 0; vptr = vertex_array; pptr = particles; for (i = 0; i < MAX_PARTICLES; i++) { if (pptr->active) { // Calculate particle intensity (we set it to max during 75% // of its life, then it fades out) alpha = 4.f * pptr->life; if (alpha > 1.f) alpha = 1.f; // Convert color from float to 8-bit (store it in a 32-bit // integer using endian independent type casting) ((GLubyte*) &rgba)[0] = (GLubyte)(pptr->r * 255.f); ((GLubyte*) &rgba)[1] = (GLubyte)(pptr->g * 255.f); ((GLubyte*) &rgba)[2] = (GLubyte)(pptr->b * 255.f); ((GLubyte*) &rgba)[3] = (GLubyte)(alpha * 255.f); // 3) Translate the quad to the correct position in modelview // space and store its parameters in vertex arrays (we also // store texture coord and color information for each vertex). // Lower left corner vptr->s = 0.f; vptr->t = 0.f; vptr->rgba = rgba; vptr->x = pptr->x + quad_lower_left.x; vptr->y = pptr->y + quad_lower_left.y; vptr->z = pptr->z + quad_lower_left.z; vptr ++; // Lower right corner vptr->s = 1.f; vptr->t = 0.f; vptr->rgba = rgba; vptr->x = pptr->x + quad_lower_right.x; vptr->y = pptr->y + quad_lower_right.y; vptr->z = pptr->z + quad_lower_right.z; vptr ++; // Upper right corner vptr->s = 1.f; vptr->t = 1.f; vptr->rgba = rgba; vptr->x = pptr->x - quad_lower_left.x; vptr->y = pptr->y - quad_lower_left.y; vptr->z = pptr->z - quad_lower_left.z; vptr ++; // Upper left corner vptr->s = 0.f; vptr->t = 1.f; vptr->rgba = rgba; vptr->x = pptr->x - quad_lower_right.x; vptr->y = pptr->y - quad_lower_right.y; vptr->z = pptr->z - quad_lower_right.z; vptr ++; // Increase count of drawable particles particle_count ++; } // If we have filled up one batch of particles, draw it as a set // of quads using glDrawArrays. if (particle_count >= BATCH_PARTICLES) { // The first argument tells which primitive type we use (QUAD) // The second argument tells the index of the first vertex (0) // The last argument is the vertex count glDrawArrays(GL_QUADS, 0, PARTICLE_VERTS * particle_count); particle_count = 0; vptr = vertex_array; } // Next particle pptr++; } // We are done with the particle data mtx_unlock(&thread_sync.particles_lock); cnd_signal(&thread_sync.d_done); // Draw final batch of particles (if any) glDrawArrays(GL_QUADS, 0, PARTICLE_VERTS * particle_count); // Disable vertex arrays (Note: glInterleavedArrays implicitly called // glEnableClientState for vertex, texture coord and color arrays) glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glDepthMask(GL_TRUE); } //======================================================================== // Fountain geometry specification //======================================================================== #define FOUNTAIN_SIDE_POINTS 14 #define FOUNTAIN_SWEEP_STEPS 32 static const float fountain_side[FOUNTAIN_SIDE_POINTS * 2] = { 1.2f, 0.f, 1.f, 0.2f, 0.41f, 0.3f, 0.4f, 0.35f, 0.4f, 1.95f, 0.41f, 2.f, 0.8f, 2.2f, 1.2f, 2.4f, 1.5f, 2.7f, 1.55f,2.95f, 1.6f, 3.f, 1.f, 3.f, 0.5f, 3.f, 0.f, 3.f }; static const float fountain_normal[FOUNTAIN_SIDE_POINTS * 2] = { 1.0000f, 0.0000f, 0.6428f, 0.7660f, 0.3420f, 0.9397f, 1.0000f, 0.0000f, 1.0000f, 0.0000f, 0.3420f,-0.9397f, 0.4226f,-0.9063f, 0.5000f,-0.8660f, 0.7660f,-0.6428f, 0.9063f,-0.4226f, 0.0000f,1.00000f, 0.0000f,1.00000f, 0.0000f,1.00000f, 0.0000f,1.00000f }; //======================================================================== // Draw a fountain //======================================================================== static void draw_fountain(void) { static GLuint fountain_list = 0; double angle; float x, y; int m, n; // The first time, we build the fountain display list if (!fountain_list) { fountain_list = glGenLists(1); glNewList(fountain_list, GL_COMPILE_AND_EXECUTE); glMaterialfv(GL_FRONT, GL_DIFFUSE, fountain_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, fountain_specular); glMaterialf(GL_FRONT, GL_SHININESS, fountain_shininess); // Build fountain using triangle strips for (n = 0; n < FOUNTAIN_SIDE_POINTS - 1; n++) { glBegin(GL_TRIANGLE_STRIP); for (m = 0; m <= FOUNTAIN_SWEEP_STEPS; m++) { angle = (double) m * (2.0 * M_PI / (double) FOUNTAIN_SWEEP_STEPS); x = (float) cos(angle); y = (float) sin(angle); // Draw triangle strip glNormal3f(x * fountain_normal[n * 2 + 2], y * fountain_normal[n * 2 + 2], fountain_normal[n * 2 + 3]); glVertex3f(x * fountain_side[n * 2 + 2], y * fountain_side[n * 2 + 2], fountain_side[n * 2 +3 ]); glNormal3f(x * fountain_normal[n * 2], y * fountain_normal[n * 2], fountain_normal[n * 2 + 1]); glVertex3f(x * fountain_side[n * 2], y * fountain_side[n * 2], fountain_side[n * 2 + 1]); } glEnd(); } glEndList(); } else glCallList(fountain_list); } //======================================================================== // Recursive function for building variable tessellated floor //======================================================================== static void tessellate_floor(float x1, float y1, float x2, float y2, int depth) { float delta, x, y; // Last recursion? if (depth >= 5) delta = 999999.f; else { x = (float) (fabs(x1) < fabs(x2) ? fabs(x1) : fabs(x2)); y = (float) (fabs(y1) < fabs(y2) ? fabs(y1) : fabs(y2)); delta = x*x + y*y; } // Recurse further? if (delta < 0.1f) { x = (x1 + x2) * 0.5f; y = (y1 + y2) * 0.5f; tessellate_floor(x1, y1, x, y, depth + 1); tessellate_floor(x, y1, x2, y, depth + 1); tessellate_floor(x1, y, x, y2, depth + 1); tessellate_floor(x, y, x2, y2, depth + 1); } else { glTexCoord2f(x1 * 30.f, y1 * 30.f); glVertex3f( x1 * 80.f, y1 * 80.f, 0.f); glTexCoord2f(x2 * 30.f, y1 * 30.f); glVertex3f( x2 * 80.f, y1 * 80.f, 0.f); glTexCoord2f(x2 * 30.f, y2 * 30.f); glVertex3f( x2 * 80.f, y2 * 80.f, 0.f); glTexCoord2f(x1 * 30.f, y2 * 30.f); glVertex3f( x1 * 80.f, y2 * 80.f, 0.f); } } //======================================================================== // Draw floor. We build the floor recursively and let the tessellation in the // center (near x,y=0,0) be high, while the tessellation around the edges be // low. //======================================================================== static void draw_floor(void) { static GLuint floor_list = 0; if (!wireframe) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, floor_tex_id); } // The first time, we build the floor display list if (!floor_list) { floor_list = glGenLists(1); glNewList(floor_list, GL_COMPILE_AND_EXECUTE); glMaterialfv(GL_FRONT, GL_DIFFUSE, floor_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, floor_specular); glMaterialf(GL_FRONT, GL_SHININESS, floor_shininess); // Draw floor as a bunch of triangle strips (high tessellation // improves lighting) glNormal3f(0.f, 0.f, 1.f); glBegin(GL_QUADS); tessellate_floor(-1.f, -1.f, 0.f, 0.f, 0); tessellate_floor( 0.f, -1.f, 1.f, 0.f, 0); tessellate_floor( 0.f, 0.f, 1.f, 1.f, 0); tessellate_floor(-1.f, 0.f, 0.f, 1.f, 0); glEnd(); glEndList(); } else glCallList(floor_list); glDisable(GL_TEXTURE_2D); } //======================================================================== // Position and configure light sources //======================================================================== static void setup_lights(void) { float l1pos[4], l1amb[4], l1dif[4], l1spec[4]; float l2pos[4], l2amb[4], l2dif[4], l2spec[4]; // Set light source 1 parameters l1pos[0] = 0.f; l1pos[1] = -9.f; l1pos[2] = 8.f; l1pos[3] = 1.f; l1amb[0] = 0.2f; l1amb[1] = 0.2f; l1amb[2] = 0.2f; l1amb[3] = 1.f; l1dif[0] = 0.8f; l1dif[1] = 0.4f; l1dif[2] = 0.2f; l1dif[3] = 1.f; l1spec[0] = 1.f; l1spec[1] = 0.6f; l1spec[2] = 0.2f; l1spec[3] = 0.f; // Set light source 2 parameters l2pos[0] = -15.f; l2pos[1] = 12.f; l2pos[2] = 1.5f; l2pos[3] = 1.f; l2amb[0] = 0.f; l2amb[1] = 0.f; l2amb[2] = 0.f; l2amb[3] = 1.f; l2dif[0] = 0.2f; l2dif[1] = 0.4f; l2dif[2] = 0.8f; l2dif[3] = 1.f; l2spec[0] = 0.2f; l2spec[1] = 0.6f; l2spec[2] = 1.f; l2spec[3] = 0.f; glLightfv(GL_LIGHT1, GL_POSITION, l1pos); glLightfv(GL_LIGHT1, GL_AMBIENT, l1amb); glLightfv(GL_LIGHT1, GL_DIFFUSE, l1dif); glLightfv(GL_LIGHT1, GL_SPECULAR, l1spec); glLightfv(GL_LIGHT2, GL_POSITION, l2pos); glLightfv(GL_LIGHT2, GL_AMBIENT, l2amb); glLightfv(GL_LIGHT2, GL_DIFFUSE, l2dif); glLightfv(GL_LIGHT2, GL_SPECULAR, l2spec); glLightfv(GL_LIGHT3, GL_POSITION, glow_pos); glLightfv(GL_LIGHT3, GL_DIFFUSE, glow_color); glLightfv(GL_LIGHT3, GL_SPECULAR, glow_color); glEnable(GL_LIGHT1); glEnable(GL_LIGHT2); glEnable(GL_LIGHT3); } //======================================================================== // Main rendering function //======================================================================== static void draw_scene(GLFWwindow* window, double t) { double xpos, ypos, zpos, angle_x, angle_y, angle_z; static double t_old = 0.0; float dt; mat4x4 projection; // Calculate frame-to-frame delta time dt = (float) (t - t_old); t_old = t; mat4x4_perspective(projection, 65.f * (float) M_PI / 180.f, aspect_ratio, 1.0, 60.0); glClearColor(0.1f, 0.1f, 0.1f, 1.f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadMatrixf((const GLfloat*) projection); // Setup camera glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Rotate camera angle_x = 90.0 - 10.0; angle_y = 10.0 * sin(0.3 * t); angle_z = 10.0 * t; glRotated(-angle_x, 1.0, 0.0, 0.0); glRotated(-angle_y, 0.0, 1.0, 0.0); glRotated(-angle_z, 0.0, 0.0, 1.0); // Translate camera xpos = 15.0 * sin((M_PI / 180.0) * angle_z) + 2.0 * sin((M_PI / 180.0) * 3.1 * t); ypos = -15.0 * cos((M_PI / 180.0) * angle_z) + 2.0 * cos((M_PI / 180.0) * 2.9 * t); zpos = 4.0 + 2.0 * cos((M_PI / 180.0) * 4.9 * t); glTranslated(-xpos, -ypos, -zpos); glFrontFace(GL_CCW); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); setup_lights(); glEnable(GL_LIGHTING); glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, 0.05f); glFogfv(GL_FOG_COLOR, fog_color); draw_floor(); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glDepthMask(GL_TRUE); draw_fountain(); glDisable(GL_LIGHTING); glDisable(GL_FOG); // Particles must be drawn after all solid objects have been drawn draw_particles(window, t, dt); // Z-buffer not needed anymore glDisable(GL_DEPTH_TEST); } //======================================================================== // Window resize callback function //======================================================================== static void resize_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); aspect_ratio = height ? width / (float) height : 1.f; } //======================================================================== // Key callback functions //======================================================================== static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action == GLFW_PRESS) { switch (key) { case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; case GLFW_KEY_W: wireframe = !wireframe; glPolygonMode(GL_FRONT_AND_BACK, wireframe ? GL_LINE : GL_FILL); break; default: break; } } } //======================================================================== // Thread for updating particle physics //======================================================================== static int physics_thread_main(void* arg) { GLFWwindow* window = arg; for (;;) { mtx_lock(&thread_sync.particles_lock); // Wait for particle drawing to be done while (!glfwWindowShouldClose(window) && thread_sync.p_frame > thread_sync.d_frame) { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); ts.tv_nsec += 100 * 1000 * 1000; ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000); ts.tv_nsec %= 1000 * 1000 * 1000; cnd_timedwait(&thread_sync.d_done, &thread_sync.particles_lock, &ts); } if (glfwWindowShouldClose(window)) break; // Update particles particle_engine(thread_sync.t, thread_sync.dt); // Update frame counter thread_sync.p_frame++; // Unlock mutex and signal drawing thread mtx_unlock(&thread_sync.particles_lock); cnd_signal(&thread_sync.p_done); } return 0; } //======================================================================== // main //======================================================================== int main(int argc, char** argv) { int ch, width, height; thrd_t physics_thread = 0; GLFWwindow* window; GLFWmonitor* monitor = NULL; if (!glfwInit()) { fprintf(stderr, "Failed to initialize GLFW\n"); exit(EXIT_FAILURE); } while ((ch = getopt(argc, argv, "fh")) != -1) { switch (ch) { case 'f': monitor = glfwGetPrimaryMonitor(); break; case 'h': usage(); exit(EXIT_SUCCESS); } } if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); width = mode->width; height = mode->height; } else { width = 640; height = 480; } window = glfwCreateWindow(width, height, "Particle Engine", monitor, NULL); if (!window) { fprintf(stderr, "Failed to create GLFW window\n"); glfwTerminate(); exit(EXIT_FAILURE); } if (monitor) glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); glfwSetFramebufferSizeCallback(window, resize_callback); glfwSetKeyCallback(window, key_callback); // Set initial aspect ratio glfwGetFramebufferSize(window, &width, &height); resize_callback(window, width, height); // Upload particle texture glGenTextures(1, &particle_tex_id); glBindTexture(GL_TEXTURE_2D, particle_tex_id); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, P_TEX_WIDTH, P_TEX_HEIGHT, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, particle_texture); // Upload floor texture glGenTextures(1, &floor_tex_id); glBindTexture(GL_TEXTURE_2D, floor_tex_id); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, F_TEX_WIDTH, F_TEX_HEIGHT, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, floor_texture); if (glfwExtensionSupported("GL_EXT_separate_specular_color")) { glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); } // Set filled polygon mode as default (not wireframe) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); wireframe = 0; // Set initial times thread_sync.t = 0.0; thread_sync.dt = 0.001f; thread_sync.p_frame = 0; thread_sync.d_frame = 0; mtx_init(&thread_sync.particles_lock, mtx_timed); cnd_init(&thread_sync.p_done); cnd_init(&thread_sync.d_done); if (thrd_create(&physics_thread, physics_thread_main, window) != thrd_success) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetTime(0.0); while (!glfwWindowShouldClose(window)) { draw_scene(window, glfwGetTime()); glfwSwapBuffers(window); glfwPollEvents(); } thrd_join(physics_thread, NULL); glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/examples/sharing.c ================================================ //======================================================================== // Context sharing example // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define GLFW_INCLUDE_NONE #include #include #include #include "getopt.h" #include "linmath.h" static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec2 vPos;\n" "varying vec2 texcoord;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" " texcoord = vPos;\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "uniform sampler2D texture;\n" "uniform vec3 color;\n" "varying vec2 texcoord;\n" "void main()\n" "{\n" " gl_FragColor = vec4(color * texture2D(texture, texcoord).rgb, 1.0);\n" "}\n"; static const vec2 vertices[4] = { { 0.f, 0.f }, { 1.f, 0.f }, { 1.f, 1.f }, { 0.f, 1.f } }; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE) glfwSetWindowShouldClose(window, GLFW_TRUE); } int main(int argc, char** argv) { GLFWwindow* windows[2]; GLuint texture, program, vertex_buffer; GLint mvp_location, vpos_location, color_location, texture_location; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); windows[0] = glfwCreateWindow(400, 400, "First", NULL, NULL); if (!windows[0]) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(windows[0], key_callback); glfwMakeContextCurrent(windows[0]); // Only enable vsync for the first of the windows to be swapped to // avoid waiting out the interval for each window glfwSwapInterval(1); // The contexts are created with the same APIs so the function // pointers should be re-usable between them gladLoadGL(glfwGetProcAddress); // Create the OpenGL objects inside the first context, created above // All objects will be shared with the second context, created below { int x, y; char pixels[16 * 16]; GLuint vertex_shader, fragment_shader; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); srand((unsigned int) glfwGetTimerValue()); for (y = 0; y < 16; y++) { for (x = 0; x < 16; x++) pixels[y * 16 + x] = rand() % 256; } glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 16, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); color_location = glGetUniformLocation(program, "color"); texture_location = glGetUniformLocation(program, "texture"); vpos_location = glGetAttribLocation(program, "vPos"); glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); } glUseProgram(program); glUniform1i(texture_location, 0); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); windows[1] = glfwCreateWindow(400, 400, "Second", NULL, windows[0]); if (!windows[1]) { glfwTerminate(); exit(EXIT_FAILURE); } // Place the second window to the right of the first { int xpos, ypos, left, right, width; glfwGetWindowSize(windows[0], &width, NULL); glfwGetWindowFrameSize(windows[0], &left, NULL, &right, NULL); glfwGetWindowPos(windows[0], &xpos, &ypos); glfwSetWindowPos(windows[1], xpos + width + left + right, ypos); } glfwSetKeyCallback(windows[1], key_callback); glfwMakeContextCurrent(windows[1]); // While objects are shared, the global context state is not and will // need to be set up for each context glUseProgram(program); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); while (!glfwWindowShouldClose(windows[0]) && !glfwWindowShouldClose(windows[1])) { int i; const vec3 colors[2] = { { 0.8f, 0.4f, 1.f }, { 0.3f, 0.4f, 1.f } }; for (i = 0; i < 2; i++) { int width, height; mat4x4 mvp; glfwGetFramebufferSize(windows[i], &width, &height); glfwMakeContextCurrent(windows[i]); glViewport(0, 0, width, height); mat4x4_ortho(mvp, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glUniform3fv(color_location, 1, colors[i]); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glfwSwapBuffers(windows[i]); } glfwWaitEvents(); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/examples/simple.c ================================================ //======================================================================== // Simple GLFW example // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== //! [code] #include #define GLFW_INCLUDE_NONE #include #include "linmath.h" #include #include static const struct { float x, y; float r, g, b; } vertices[3] = { { -0.6f, -0.4f, 1.f, 0.f, 0.f }, { 0.6f, -0.4f, 0.f, 1.f, 0.f }, { 0.f, 0.6f, 0.f, 0.f, 1.f } }; static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec3 vCol;\n" "attribute vec2 vPos;\n" "varying vec3 color;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" " color = vCol;\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "varying vec3 color;\n" "void main()\n" "{\n" " gl_FragColor = vec4(color, 1.0);\n" "}\n"; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } int main(void) { GLFWwindow* window; GLuint vertex_buffer, vertex_shader, fragment_shader, program; GLint mvp_location, vpos_location, vcol_location; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); // NOTE: OpenGL error checks have been omitted for brevity glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); vpos_location = glGetAttribLocation(program, "vPos"); vcol_location = glGetAttribLocation(program, "vCol"); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); glEnableVertexAttribArray(vcol_location); glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) (sizeof(float) * 2)); while (!glfwWindowShouldClose(window)) { float ratio; int width, height; mat4x4 m, p, mvp; glfwGetFramebufferSize(window, &width, &height); ratio = width / (float) height; glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); mat4x4_identity(m); mat4x4_rotate_Z(m, m, (float) glfwGetTime()); mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f); mat4x4_mul(mvp, p, m); glUseProgram(program); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glDrawArrays(GL_TRIANGLES, 0, 3); glfwSwapBuffers(window); glfwPollEvents(); } glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } //! [code] ================================================ FILE: thirdparty/glfw/examples/splitview.c ================================================ //======================================================================== // This is an example program for the GLFW library // // The program uses a "split window" view, rendering four views of the // same scene in one window (e.g. uesful for 3D modelling software). This // demo uses scissors to separate the four different rendering areas from // each other. // // (If the code seems a little bit strange here and there, it may be // because I am not a friend of orthogonal projections) //======================================================================== #include #define GLFW_INCLUDE_NONE #include #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include #include #include #include //======================================================================== // Global variables //======================================================================== // Mouse position static double xpos = 0, ypos = 0; // Window size static int width, height; // Active view: 0 = none, 1 = upper left, 2 = upper right, 3 = lower left, // 4 = lower right static int active_view = 0; // Rotation around each axis static int rot_x = 0, rot_y = 0, rot_z = 0; // Do redraw? static int do_redraw = 1; //======================================================================== // Draw a solid torus (use a display list for the model) //======================================================================== #define TORUS_MAJOR 1.5 #define TORUS_MINOR 0.5 #define TORUS_MAJOR_RES 32 #define TORUS_MINOR_RES 32 static void drawTorus(void) { static GLuint torus_list = 0; int i, j, k; double s, t, x, y, z, nx, ny, nz, scale, twopi; if (!torus_list) { // Start recording displaylist torus_list = glGenLists(1); glNewList(torus_list, GL_COMPILE_AND_EXECUTE); // Draw torus twopi = 2.0 * M_PI; for (i = 0; i < TORUS_MINOR_RES; i++) { glBegin(GL_QUAD_STRIP); for (j = 0; j <= TORUS_MAJOR_RES; j++) { for (k = 1; k >= 0; k--) { s = (i + k) % TORUS_MINOR_RES + 0.5; t = j % TORUS_MAJOR_RES; // Calculate point on surface x = (TORUS_MAJOR + TORUS_MINOR * cos(s * twopi / TORUS_MINOR_RES)) * cos(t * twopi / TORUS_MAJOR_RES); y = TORUS_MINOR * sin(s * twopi / TORUS_MINOR_RES); z = (TORUS_MAJOR + TORUS_MINOR * cos(s * twopi / TORUS_MINOR_RES)) * sin(t * twopi / TORUS_MAJOR_RES); // Calculate surface normal nx = x - TORUS_MAJOR * cos(t * twopi / TORUS_MAJOR_RES); ny = y; nz = z - TORUS_MAJOR * sin(t * twopi / TORUS_MAJOR_RES); scale = 1.0 / sqrt(nx*nx + ny*ny + nz*nz); nx *= scale; ny *= scale; nz *= scale; glNormal3f((float) nx, (float) ny, (float) nz); glVertex3f((float) x, (float) y, (float) z); } } glEnd(); } // Stop recording displaylist glEndList(); } else { // Playback displaylist glCallList(torus_list); } } //======================================================================== // Draw the scene (a rotating torus) //======================================================================== static void drawScene(void) { const GLfloat model_diffuse[4] = {1.0f, 0.8f, 0.8f, 1.0f}; const GLfloat model_specular[4] = {0.6f, 0.6f, 0.6f, 1.0f}; const GLfloat model_shininess = 20.0f; glPushMatrix(); // Rotate the object glRotatef((GLfloat) rot_x * 0.5f, 1.0f, 0.0f, 0.0f); glRotatef((GLfloat) rot_y * 0.5f, 0.0f, 1.0f, 0.0f); glRotatef((GLfloat) rot_z * 0.5f, 0.0f, 0.0f, 1.0f); // Set model color (used for orthogonal views, lighting disabled) glColor4fv(model_diffuse); // Set model material (used for perspective view, lighting enabled) glMaterialfv(GL_FRONT, GL_DIFFUSE, model_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, model_specular); glMaterialf(GL_FRONT, GL_SHININESS, model_shininess); // Draw torus drawTorus(); glPopMatrix(); } //======================================================================== // Draw a 2D grid (used for orthogonal views) //======================================================================== static void drawGrid(float scale, int steps) { int i; float x, y; mat4x4 view; glPushMatrix(); // Set background to some dark bluish grey glClearColor(0.05f, 0.05f, 0.2f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); // Setup modelview matrix (flat XY view) { vec3 eye = { 0.f, 0.f, 1.f }; vec3 center = { 0.f, 0.f, 0.f }; vec3 up = { 0.f, 1.f, 0.f }; mat4x4_look_at(view, eye, center, up); } glLoadMatrixf((const GLfloat*) view); // We don't want to update the Z-buffer glDepthMask(GL_FALSE); // Set grid color glColor3f(0.0f, 0.5f, 0.5f); glBegin(GL_LINES); // Horizontal lines x = scale * 0.5f * (float) (steps - 1); y = -scale * 0.5f * (float) (steps - 1); for (i = 0; i < steps; i++) { glVertex3f(-x, y, 0.0f); glVertex3f(x, y, 0.0f); y += scale; } // Vertical lines x = -scale * 0.5f * (float) (steps - 1); y = scale * 0.5f * (float) (steps - 1); for (i = 0; i < steps; i++) { glVertex3f(x, -y, 0.0f); glVertex3f(x, y, 0.0f); x += scale; } glEnd(); // Enable Z-buffer writing again glDepthMask(GL_TRUE); glPopMatrix(); } //======================================================================== // Draw all views //======================================================================== static void drawAllViews(void) { const GLfloat light_position[4] = {0.0f, 8.0f, 8.0f, 1.0f}; const GLfloat light_diffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f}; const GLfloat light_specular[4] = {1.0f, 1.0f, 1.0f, 1.0f}; const GLfloat light_ambient[4] = {0.2f, 0.2f, 0.3f, 1.0f}; float aspect; mat4x4 view, projection; // Calculate aspect of window if (height > 0) aspect = (float) width / (float) height; else aspect = 1.f; // Clear screen glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Enable scissor test glEnable(GL_SCISSOR_TEST); // Enable depth test glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); // ** ORTHOGONAL VIEWS ** // For orthogonal views, use wireframe rendering glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // Enable line anti-aliasing glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Setup orthogonal projection matrix glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-3.0 * aspect, 3.0 * aspect, -3.0, 3.0, 1.0, 50.0); // Upper left view (TOP VIEW) glViewport(0, height / 2, width / 2, height / 2); glScissor(0, height / 2, width / 2, height / 2); glMatrixMode(GL_MODELVIEW); { vec3 eye = { 0.f, 10.f, 1e-3f }; vec3 center = { 0.f, 0.f, 0.f }; vec3 up = { 0.f, 1.f, 0.f }; mat4x4_look_at( view, eye, center, up ); } glLoadMatrixf((const GLfloat*) view); drawGrid(0.5, 12); drawScene(); // Lower left view (FRONT VIEW) glViewport(0, 0, width / 2, height / 2); glScissor(0, 0, width / 2, height / 2); glMatrixMode(GL_MODELVIEW); { vec3 eye = { 0.f, 0.f, 10.f }; vec3 center = { 0.f, 0.f, 0.f }; vec3 up = { 0.f, 1.f, 0.f }; mat4x4_look_at( view, eye, center, up ); } glLoadMatrixf((const GLfloat*) view); drawGrid(0.5, 12); drawScene(); // Lower right view (SIDE VIEW) glViewport(width / 2, 0, width / 2, height / 2); glScissor(width / 2, 0, width / 2, height / 2); glMatrixMode(GL_MODELVIEW); { vec3 eye = { 10.f, 0.f, 0.f }; vec3 center = { 0.f, 0.f, 0.f }; vec3 up = { 0.f, 1.f, 0.f }; mat4x4_look_at( view, eye, center, up ); } glLoadMatrixf((const GLfloat*) view); drawGrid(0.5, 12); drawScene(); // Disable line anti-aliasing glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); // ** PERSPECTIVE VIEW ** // For perspective view, use solid rendering glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Enable face culling (faster rendering) glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CW); // Setup perspective projection matrix glMatrixMode(GL_PROJECTION); mat4x4_perspective(projection, 65.f * (float) M_PI / 180.f, aspect, 1.f, 50.f); glLoadMatrixf((const GLfloat*) projection); // Upper right view (PERSPECTIVE VIEW) glViewport(width / 2, height / 2, width / 2, height / 2); glScissor(width / 2, height / 2, width / 2, height / 2); glMatrixMode(GL_MODELVIEW); { vec3 eye = { 3.f, 1.5f, 3.f }; vec3 center = { 0.f, 0.f, 0.f }; vec3 up = { 0.f, 1.f, 0.f }; mat4x4_look_at( view, eye, center, up ); } glLoadMatrixf((const GLfloat*) view); // Configure and enable light source 1 glLightfv(GL_LIGHT1, GL_POSITION, light_position); glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); glEnable(GL_LIGHT1); glEnable(GL_LIGHTING); // Draw scene drawScene(); // Disable lighting glDisable(GL_LIGHTING); // Disable face culling glDisable(GL_CULL_FACE); // Disable depth test glDisable(GL_DEPTH_TEST); // Disable scissor test glDisable(GL_SCISSOR_TEST); // Draw a border around the active view if (active_view > 0 && active_view != 2) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 2.0, 0.0, 2.0, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef((GLfloat) ((active_view - 1) & 1), (GLfloat) (1 - (active_view - 1) / 2), 0.0f); glColor3f(1.0f, 1.0f, 0.6f); glBegin(GL_LINE_STRIP); glVertex2i(0, 0); glVertex2i(1, 0); glVertex2i(1, 1); glVertex2i(0, 1); glVertex2i(0, 0); glEnd(); } } //======================================================================== // Framebuffer size callback function //======================================================================== static void framebufferSizeFun(GLFWwindow* window, int w, int h) { width = w; height = h > 0 ? h : 1; do_redraw = 1; } //======================================================================== // Window refresh callback function //======================================================================== static void windowRefreshFun(GLFWwindow* window) { drawAllViews(); glfwSwapBuffers(window); do_redraw = 0; } //======================================================================== // Mouse position callback function //======================================================================== static void cursorPosFun(GLFWwindow* window, double x, double y) { int wnd_width, wnd_height, fb_width, fb_height; double scale; glfwGetWindowSize(window, &wnd_width, &wnd_height); glfwGetFramebufferSize(window, &fb_width, &fb_height); scale = (double) fb_width / (double) wnd_width; x *= scale; y *= scale; // Depending on which view was selected, rotate around different axes switch (active_view) { case 1: rot_x += (int) (y - ypos); rot_z += (int) (x - xpos); do_redraw = 1; break; case 3: rot_x += (int) (y - ypos); rot_y += (int) (x - xpos); do_redraw = 1; break; case 4: rot_y += (int) (x - xpos); rot_z += (int) (y - ypos); do_redraw = 1; break; default: // Do nothing for perspective view, or if no view is selected break; } // Remember cursor position xpos = x; ypos = y; } //======================================================================== // Mouse button callback function //======================================================================== static void mouseButtonFun(GLFWwindow* window, int button, int action, int mods) { if ((button == GLFW_MOUSE_BUTTON_LEFT) && action == GLFW_PRESS) { // Detect which of the four views was clicked active_view = 1; if (xpos >= width / 2) active_view += 1; if (ypos >= height / 2) active_view += 2; } else if (button == GLFW_MOUSE_BUTTON_LEFT) { // Deselect any previously selected view active_view = 0; } do_redraw = 1; } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } //======================================================================== // main //======================================================================== int main(void) { GLFWwindow* window; // Initialise GLFW if (!glfwInit()) { fprintf(stderr, "Failed to initialize GLFW\n"); exit(EXIT_FAILURE); } glfwWindowHint(GLFW_SAMPLES, 4); // Open OpenGL window window = glfwCreateWindow(500, 500, "Split view demo", NULL, NULL); if (!window) { fprintf(stderr, "Failed to open GLFW window\n"); glfwTerminate(); exit(EXIT_FAILURE); } // Set callback functions glfwSetFramebufferSizeCallback(window, framebufferSizeFun); glfwSetWindowRefreshCallback(window, windowRefreshFun); glfwSetCursorPosCallback(window, cursorPosFun); glfwSetMouseButtonCallback(window, mouseButtonFun); glfwSetKeyCallback(window, key_callback); // Enable vsync glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3) glEnable(GL_MULTISAMPLE_ARB); glfwGetFramebufferSize(window, &width, &height); framebufferSizeFun(window, width, height); // Main loop for (;;) { // Only redraw if we need to if (do_redraw) windowRefreshFun(window); // Wait for new events glfwWaitEvents(); // Check if the window should be closed if (glfwWindowShouldClose(window)) break; } // Close OpenGL window and terminate GLFW glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/examples/wave.c ================================================ /***************************************************************************** * Wave Simulation in OpenGL * (C) 2002 Jakob Thomsen * http://home.in.tum.de/~thomsen * Modified for GLFW by Sylvain Hellegouarch - sh@programmationworld.com * Modified for variable frame rate by Marcus Geelnard * 2003-Jan-31: Minor cleanups and speedups / MG * 2010-10-24: Formatting and cleanup - Camilla Löwy *****************************************************************************/ #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include #include #include #include #define GLFW_INCLUDE_NONE #include #include // Maximum delta T to allow for differential calculations #define MAX_DELTA_T 0.01 // Animation speed (10.0 looks good) #define ANIMATION_SPEED 10.0 GLfloat alpha = 210.f, beta = -70.f; GLfloat zoom = 2.f; double cursorX; double cursorY; struct Vertex { GLfloat x, y, z; GLfloat r, g, b; }; #define GRIDW 50 #define GRIDH 50 #define VERTEXNUM (GRIDW*GRIDH) #define QUADW (GRIDW - 1) #define QUADH (GRIDH - 1) #define QUADNUM (QUADW*QUADH) GLuint quad[4 * QUADNUM]; struct Vertex vertex[VERTEXNUM]; /* The grid will look like this: * * 3 4 5 * *---*---* * | | | * | 0 | 1 | * | | | * *---*---* * 0 1 2 */ //======================================================================== // Initialize grid geometry //======================================================================== void init_vertices(void) { int x, y, p; // Place the vertices in a grid for (y = 0; y < GRIDH; y++) { for (x = 0; x < GRIDW; x++) { p = y * GRIDW + x; vertex[p].x = (GLfloat) (x - GRIDW / 2) / (GLfloat) (GRIDW / 2); vertex[p].y = (GLfloat) (y - GRIDH / 2) / (GLfloat) (GRIDH / 2); vertex[p].z = 0; if ((x % 4 < 2) ^ (y % 4 < 2)) vertex[p].r = 0.0; else vertex[p].r = 1.0; vertex[p].g = (GLfloat) y / (GLfloat) GRIDH; vertex[p].b = 1.f - ((GLfloat) x / (GLfloat) GRIDW + (GLfloat) y / (GLfloat) GRIDH) / 2.f; } } for (y = 0; y < QUADH; y++) { for (x = 0; x < QUADW; x++) { p = 4 * (y * QUADW + x); quad[p + 0] = y * GRIDW + x; // Some point quad[p + 1] = y * GRIDW + x + 1; // Neighbor at the right side quad[p + 2] = (y + 1) * GRIDW + x + 1; // Upper right neighbor quad[p + 3] = (y + 1) * GRIDW + x; // Upper neighbor } } } double dt; double p[GRIDW][GRIDH]; double vx[GRIDW][GRIDH], vy[GRIDW][GRIDH]; double ax[GRIDW][GRIDH], ay[GRIDW][GRIDH]; //======================================================================== // Initialize grid //======================================================================== void init_grid(void) { int x, y; double dx, dy, d; for (y = 0; y < GRIDH; y++) { for (x = 0; x < GRIDW; x++) { dx = (double) (x - GRIDW / 2); dy = (double) (y - GRIDH / 2); d = sqrt(dx * dx + dy * dy); if (d < 0.1 * (double) (GRIDW / 2)) { d = d * 10.0; p[x][y] = -cos(d * (M_PI / (double)(GRIDW * 4))) * 100.0; } else p[x][y] = 0.0; vx[x][y] = 0.0; vy[x][y] = 0.0; } } } //======================================================================== // Draw scene //======================================================================== void draw_scene(GLFWwindow* window) { // Clear the color and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // We don't want to modify the projection matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Move back glTranslatef(0.0, 0.0, -zoom); // Rotate the view glRotatef(beta, 1.0, 0.0, 0.0); glRotatef(alpha, 0.0, 0.0, 1.0); glDrawElements(GL_QUADS, 4 * QUADNUM, GL_UNSIGNED_INT, quad); glfwSwapBuffers(window); } //======================================================================== // Initialize Miscellaneous OpenGL state //======================================================================== void init_opengl(void) { // Use Gouraud (smooth) shading glShadeModel(GL_SMOOTH); // Switch on the z-buffer glEnable(GL_DEPTH_TEST); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glVertexPointer(3, GL_FLOAT, sizeof(struct Vertex), vertex); glColorPointer(3, GL_FLOAT, sizeof(struct Vertex), &vertex[0].r); // Pointer to the first color glPointSize(2.0); // Background color is black glClearColor(0, 0, 0, 0); } //======================================================================== // Modify the height of each vertex according to the pressure //======================================================================== void adjust_grid(void) { int pos; int x, y; for (y = 0; y < GRIDH; y++) { for (x = 0; x < GRIDW; x++) { pos = y * GRIDW + x; vertex[pos].z = (float) (p[x][y] * (1.0 / 50.0)); } } } //======================================================================== // Calculate wave propagation //======================================================================== void calc_grid(void) { int x, y, x2, y2; double time_step = dt * ANIMATION_SPEED; // Compute accelerations for (x = 0; x < GRIDW; x++) { x2 = (x + 1) % GRIDW; for(y = 0; y < GRIDH; y++) ax[x][y] = p[x][y] - p[x2][y]; } for (y = 0; y < GRIDH; y++) { y2 = (y + 1) % GRIDH; for(x = 0; x < GRIDW; x++) ay[x][y] = p[x][y] - p[x][y2]; } // Compute speeds for (x = 0; x < GRIDW; x++) { for (y = 0; y < GRIDH; y++) { vx[x][y] = vx[x][y] + ax[x][y] * time_step; vy[x][y] = vy[x][y] + ay[x][y] * time_step; } } // Compute pressure for (x = 1; x < GRIDW; x++) { x2 = x - 1; for (y = 1; y < GRIDH; y++) { y2 = y - 1; p[x][y] = p[x][y] + (vx[x2][y] - vx[x][y] + vy[x][y2] - vy[x][y]) * time_step; } } } //======================================================================== // Print errors //======================================================================== static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } //======================================================================== // Handle key strokes //======================================================================== void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; case GLFW_KEY_SPACE: init_grid(); break; case GLFW_KEY_LEFT: alpha += 5; break; case GLFW_KEY_RIGHT: alpha -= 5; break; case GLFW_KEY_UP: beta -= 5; break; case GLFW_KEY_DOWN: beta += 5; break; case GLFW_KEY_PAGE_UP: zoom -= 0.25f; if (zoom < 0.f) zoom = 0.f; break; case GLFW_KEY_PAGE_DOWN: zoom += 0.25f; break; default: break; } } //======================================================================== // Callback function for mouse button events //======================================================================== void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { if (button != GLFW_MOUSE_BUTTON_LEFT) return; if (action == GLFW_PRESS) { glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwGetCursorPos(window, &cursorX, &cursorY); } else glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); } //======================================================================== // Callback function for cursor motion events //======================================================================== void cursor_position_callback(GLFWwindow* window, double x, double y) { if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) { alpha += (GLfloat) (x - cursorX) / 10.f; beta += (GLfloat) (y - cursorY) / 10.f; cursorX = x; cursorY = y; } } //======================================================================== // Callback function for scroll events //======================================================================== void scroll_callback(GLFWwindow* window, double x, double y) { zoom += (float) y / 4.f; if (zoom < 0) zoom = 0; } //======================================================================== // Callback function for framebuffer resize events //======================================================================== void framebuffer_size_callback(GLFWwindow* window, int width, int height) { float ratio = 1.f; mat4x4 projection; if (height > 0) ratio = (float) width / (float) height; // Setup viewport glViewport(0, 0, width, height); // Change to the projection matrix and set our viewing volume glMatrixMode(GL_PROJECTION); mat4x4_perspective(projection, 60.f * (float) M_PI / 180.f, ratio, 1.f, 1024.f); glLoadMatrixf((const GLfloat*) projection); } //======================================================================== // main //======================================================================== int main(int argc, char* argv[]) { GLFWwindow* window; double t, dt_total, t_old; int width, height; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); window = glfwCreateWindow(640, 480, "Wave Simulation", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(window, key_callback); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetMouseButtonCallback(window, mouse_button_callback); glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetScrollCallback(window, scroll_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); glfwGetFramebufferSize(window, &width, &height); framebuffer_size_callback(window, width, height); // Initialize OpenGL init_opengl(); // Initialize simulation init_vertices(); init_grid(); adjust_grid(); // Initialize timer t_old = glfwGetTime() - 0.01; while (!glfwWindowShouldClose(window)) { t = glfwGetTime(); dt_total = t - t_old; t_old = t; // Safety - iterate if dt_total is too large while (dt_total > 0.f) { // Select iteration time step dt = dt_total > MAX_DELTA_T ? MAX_DELTA_T : dt_total; dt_total -= dt; // Calculate wave propagation calc_grid(); } // Compute height of each vertex adjust_grid(); // Draw wave grid to OpenGL display draw_scene(window); glfwPollEvents(); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/include/GLFW/glfw3.h ================================================ /************************************************************************* * GLFW 3.3 - www.glfw.org * A library for OpenGL, window and input *------------------------------------------------------------------------ * Copyright (c) 2002-2006 Marcus Geelnard * Copyright (c) 2006-2019 Camilla Löwy * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would * be appreciated but is not required. * * 2. Altered source versions must be plainly marked as 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 _glfw3_h_ #define _glfw3_h_ #ifdef __cplusplus extern "C" { #endif /************************************************************************* * Doxygen documentation *************************************************************************/ /*! @file glfw3.h * @brief The header of the GLFW 3 API. * * This is the header file of the GLFW 3 API. It defines all its types and * declares all its functions. * * For more information about how to use this file, see @ref build_include. */ /*! @defgroup context Context reference * @brief Functions and types related to OpenGL and OpenGL ES contexts. * * This is the reference documentation for OpenGL and OpenGL ES context related * functions. For more task-oriented information, see the @ref context_guide. */ /*! @defgroup vulkan Vulkan reference * @brief Functions and types related to Vulkan. * * This is the reference documentation for Vulkan related functions and types. * For more task-oriented information, see the @ref vulkan_guide. */ /*! @defgroup init Initialization, version and error reference * @brief Functions and types related to initialization and error handling. * * This is the reference documentation for initialization and termination of * the library, version management and error handling. For more task-oriented * information, see the @ref intro_guide. */ /*! @defgroup input Input reference * @brief Functions and types related to input handling. * * This is the reference documentation for input related functions and types. * For more task-oriented information, see the @ref input_guide. */ /*! @defgroup monitor Monitor reference * @brief Functions and types related to monitors. * * This is the reference documentation for monitor related functions and types. * For more task-oriented information, see the @ref monitor_guide. */ /*! @defgroup window Window reference * @brief Functions and types related to windows. * * This is the reference documentation for window related functions and types, * including creation, deletion and event polling. For more task-oriented * information, see the @ref window_guide. */ /************************************************************************* * Compiler- and platform-specific preprocessor work *************************************************************************/ /* If we are we on Windows, we want a single define for it. */ #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)) #define _WIN32 #endif /* _WIN32 */ /* Include because most Windows GLU headers need wchar_t and * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h. * Include it unconditionally to avoid surprising side-effects. */ #include /* Include because it is needed by Vulkan and related functions. * Include it unconditionally to avoid surprising side-effects. */ #include #if defined(GLFW_INCLUDE_VULKAN) #include #endif /* Vulkan header */ /* The Vulkan header may have indirectly included windows.h (because of * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it. */ /* It is customary to use APIENTRY for OpenGL function pointer declarations on * all platforms. Additionally, the Windows OpenGL header needs APIENTRY. */ #if !defined(APIENTRY) #if defined(_WIN32) #define APIENTRY __stdcall #else #define APIENTRY #endif #define GLFW_APIENTRY_DEFINED #endif /* APIENTRY */ /* Some Windows OpenGL headers need this. */ #if !defined(WINGDIAPI) && defined(_WIN32) #define WINGDIAPI __declspec(dllimport) #define GLFW_WINGDIAPI_DEFINED #endif /* WINGDIAPI */ /* Some Windows GLU headers need this. */ #if !defined(CALLBACK) && defined(_WIN32) #define CALLBACK __stdcall #define GLFW_CALLBACK_DEFINED #endif /* CALLBACK */ /* Include the chosen OpenGL or OpenGL ES headers. */ #if defined(GLFW_INCLUDE_ES1) #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif #elif defined(GLFW_INCLUDE_ES2) #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif #elif defined(GLFW_INCLUDE_ES3) #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif #elif defined(GLFW_INCLUDE_ES31) #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif #elif defined(GLFW_INCLUDE_ES32) #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif #elif defined(GLFW_INCLUDE_GLCOREARB) #if defined(__APPLE__) #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif /*GLFW_INCLUDE_GLEXT*/ #else /*__APPLE__*/ #include #endif /*__APPLE__*/ #elif !defined(GLFW_INCLUDE_NONE) #if defined(__APPLE__) #if !defined(GLFW_INCLUDE_GLEXT) #define GL_GLEXT_LEGACY #endif #include #if defined(GLFW_INCLUDE_GLU) #include #endif #else /*__APPLE__*/ #include #if defined(GLFW_INCLUDE_GLEXT) #include #endif #if defined(GLFW_INCLUDE_GLU) #include #endif #endif /*__APPLE__*/ #endif /* OpenGL and OpenGL ES headers */ #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) /* GLFW_DLL must be defined by applications that are linking against the DLL * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW * configuration header when compiling the DLL version of the library. */ #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" #endif /* GLFWAPI is used to declare public API functions for export * from the DLL / shared library / dynamic library. */ #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) /* We are building GLFW as a Win32 DLL */ #define GLFWAPI __declspec(dllexport) #elif defined(_WIN32) && defined(GLFW_DLL) /* We are calling GLFW as a Win32 DLL */ #define GLFWAPI __declspec(dllimport) #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) /* We are building GLFW as a shared / dynamic library */ #define GLFWAPI __attribute__((visibility("default"))) #else /* We are building or calling GLFW as a static library */ #define GLFWAPI #endif /************************************************************************* * GLFW API tokens *************************************************************************/ /*! @name GLFW version macros * @{ */ /*! @brief The major version number of the GLFW library. * * This is incremented when the API is changed in non-compatible ways. * @ingroup init */ #define GLFW_VERSION_MAJOR 3 /*! @brief The minor version number of the GLFW library. * * This is incremented when features are added to the API but it remains * backward-compatible. * @ingroup init */ #define GLFW_VERSION_MINOR 3 /*! @brief The revision number of the GLFW library. * * This is incremented when a bug fix release is made that does not contain any * API changes. * @ingroup init */ #define GLFW_VERSION_REVISION 2 /*! @} */ /*! @brief One. * * This is only semantic sugar for the number 1. You can instead use `1` or * `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal * to one. * * @ingroup init */ #define GLFW_TRUE 1 /*! @brief Zero. * * This is only semantic sugar for the number 0. You can instead use `0` or * `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is * equal to zero. * * @ingroup init */ #define GLFW_FALSE 0 /*! @name Key and button actions * @{ */ /*! @brief The key or mouse button was released. * * The key or mouse button was released. * * @ingroup input */ #define GLFW_RELEASE 0 /*! @brief The key or mouse button was pressed. * * The key or mouse button was pressed. * * @ingroup input */ #define GLFW_PRESS 1 /*! @brief The key was held down until it repeated. * * The key was held down until it repeated. * * @ingroup input */ #define GLFW_REPEAT 2 /*! @} */ /*! @defgroup hat_state Joystick hat states * @brief Joystick hat states. * * See [joystick hat input](@ref joystick_hat) for how these are used. * * @ingroup input * @{ */ #define GLFW_HAT_CENTERED 0 #define GLFW_HAT_UP 1 #define GLFW_HAT_RIGHT 2 #define GLFW_HAT_DOWN 4 #define GLFW_HAT_LEFT 8 #define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP) #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN) #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP) #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN) /*! @} */ /*! @defgroup keys Keyboard keys * @brief Keyboard key IDs. * * See [key input](@ref input_key) for how these are used. * * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), * but re-arranged to map to 7-bit ASCII for printable keys (function keys are * put in the 256+ range). * * The naming of the key codes follow these rules: * - The US keyboard layout is used * - Names of printable alpha-numeric characters are used (e.g. "A", "R", * "3", etc.) * - For non-alphanumeric characters, Unicode:ish names are used (e.g. * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not * correspond to the Unicode standard (usually for brevity) * - Keys that lack a clear US mapping are named "WORLD_x" * - For non-printable keys, custom names are used (e.g. "F4", * "BACKSPACE", etc.) * * @ingroup input * @{ */ /* The unknown key */ #define GLFW_KEY_UNKNOWN -1 /* Printable keys */ #define GLFW_KEY_SPACE 32 #define GLFW_KEY_APOSTROPHE 39 /* ' */ #define GLFW_KEY_COMMA 44 /* , */ #define GLFW_KEY_MINUS 45 /* - */ #define GLFW_KEY_PERIOD 46 /* . */ #define GLFW_KEY_SLASH 47 /* / */ #define GLFW_KEY_0 48 #define GLFW_KEY_1 49 #define GLFW_KEY_2 50 #define GLFW_KEY_3 51 #define GLFW_KEY_4 52 #define GLFW_KEY_5 53 #define GLFW_KEY_6 54 #define GLFW_KEY_7 55 #define GLFW_KEY_8 56 #define GLFW_KEY_9 57 #define GLFW_KEY_SEMICOLON 59 /* ; */ #define GLFW_KEY_EQUAL 61 /* = */ #define GLFW_KEY_A 65 #define GLFW_KEY_B 66 #define GLFW_KEY_C 67 #define GLFW_KEY_D 68 #define GLFW_KEY_E 69 #define GLFW_KEY_F 70 #define GLFW_KEY_G 71 #define GLFW_KEY_H 72 #define GLFW_KEY_I 73 #define GLFW_KEY_J 74 #define GLFW_KEY_K 75 #define GLFW_KEY_L 76 #define GLFW_KEY_M 77 #define GLFW_KEY_N 78 #define GLFW_KEY_O 79 #define GLFW_KEY_P 80 #define GLFW_KEY_Q 81 #define GLFW_KEY_R 82 #define GLFW_KEY_S 83 #define GLFW_KEY_T 84 #define GLFW_KEY_U 85 #define GLFW_KEY_V 86 #define GLFW_KEY_W 87 #define GLFW_KEY_X 88 #define GLFW_KEY_Y 89 #define GLFW_KEY_Z 90 #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ #define GLFW_KEY_BACKSLASH 92 /* \ */ #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ /* Function keys */ #define GLFW_KEY_ESCAPE 256 #define GLFW_KEY_ENTER 257 #define GLFW_KEY_TAB 258 #define GLFW_KEY_BACKSPACE 259 #define GLFW_KEY_INSERT 260 #define GLFW_KEY_DELETE 261 #define GLFW_KEY_RIGHT 262 #define GLFW_KEY_LEFT 263 #define GLFW_KEY_DOWN 264 #define GLFW_KEY_UP 265 #define GLFW_KEY_PAGE_UP 266 #define GLFW_KEY_PAGE_DOWN 267 #define GLFW_KEY_HOME 268 #define GLFW_KEY_END 269 #define GLFW_KEY_CAPS_LOCK 280 #define GLFW_KEY_SCROLL_LOCK 281 #define GLFW_KEY_NUM_LOCK 282 #define GLFW_KEY_PRINT_SCREEN 283 #define GLFW_KEY_PAUSE 284 #define GLFW_KEY_F1 290 #define GLFW_KEY_F2 291 #define GLFW_KEY_F3 292 #define GLFW_KEY_F4 293 #define GLFW_KEY_F5 294 #define GLFW_KEY_F6 295 #define GLFW_KEY_F7 296 #define GLFW_KEY_F8 297 #define GLFW_KEY_F9 298 #define GLFW_KEY_F10 299 #define GLFW_KEY_F11 300 #define GLFW_KEY_F12 301 #define GLFW_KEY_F13 302 #define GLFW_KEY_F14 303 #define GLFW_KEY_F15 304 #define GLFW_KEY_F16 305 #define GLFW_KEY_F17 306 #define GLFW_KEY_F18 307 #define GLFW_KEY_F19 308 #define GLFW_KEY_F20 309 #define GLFW_KEY_F21 310 #define GLFW_KEY_F22 311 #define GLFW_KEY_F23 312 #define GLFW_KEY_F24 313 #define GLFW_KEY_F25 314 #define GLFW_KEY_KP_0 320 #define GLFW_KEY_KP_1 321 #define GLFW_KEY_KP_2 322 #define GLFW_KEY_KP_3 323 #define GLFW_KEY_KP_4 324 #define GLFW_KEY_KP_5 325 #define GLFW_KEY_KP_6 326 #define GLFW_KEY_KP_7 327 #define GLFW_KEY_KP_8 328 #define GLFW_KEY_KP_9 329 #define GLFW_KEY_KP_DECIMAL 330 #define GLFW_KEY_KP_DIVIDE 331 #define GLFW_KEY_KP_MULTIPLY 332 #define GLFW_KEY_KP_SUBTRACT 333 #define GLFW_KEY_KP_ADD 334 #define GLFW_KEY_KP_ENTER 335 #define GLFW_KEY_KP_EQUAL 336 #define GLFW_KEY_LEFT_SHIFT 340 #define GLFW_KEY_LEFT_CONTROL 341 #define GLFW_KEY_LEFT_ALT 342 #define GLFW_KEY_LEFT_SUPER 343 #define GLFW_KEY_RIGHT_SHIFT 344 #define GLFW_KEY_RIGHT_CONTROL 345 #define GLFW_KEY_RIGHT_ALT 346 #define GLFW_KEY_RIGHT_SUPER 347 #define GLFW_KEY_MENU 348 #define GLFW_KEY_LAST GLFW_KEY_MENU /*! @} */ /*! @defgroup mods Modifier key flags * @brief Modifier key flags. * * See [key input](@ref input_key) for how these are used. * * @ingroup input * @{ */ /*! @brief If this bit is set one or more Shift keys were held down. * * If this bit is set one or more Shift keys were held down. */ #define GLFW_MOD_SHIFT 0x0001 /*! @brief If this bit is set one or more Control keys were held down. * * If this bit is set one or more Control keys were held down. */ #define GLFW_MOD_CONTROL 0x0002 /*! @brief If this bit is set one or more Alt keys were held down. * * If this bit is set one or more Alt keys were held down. */ #define GLFW_MOD_ALT 0x0004 /*! @brief If this bit is set one or more Super keys were held down. * * If this bit is set one or more Super keys were held down. */ #define GLFW_MOD_SUPER 0x0008 /*! @brief If this bit is set the Caps Lock key is enabled. * * If this bit is set the Caps Lock key is enabled and the @ref * GLFW_LOCK_KEY_MODS input mode is set. */ #define GLFW_MOD_CAPS_LOCK 0x0010 /*! @brief If this bit is set the Num Lock key is enabled. * * If this bit is set the Num Lock key is enabled and the @ref * GLFW_LOCK_KEY_MODS input mode is set. */ #define GLFW_MOD_NUM_LOCK 0x0020 /*! @} */ /*! @defgroup buttons Mouse buttons * @brief Mouse button IDs. * * See [mouse button input](@ref input_mouse_button) for how these are used. * * @ingroup input * @{ */ #define GLFW_MOUSE_BUTTON_1 0 #define GLFW_MOUSE_BUTTON_2 1 #define GLFW_MOUSE_BUTTON_3 2 #define GLFW_MOUSE_BUTTON_4 3 #define GLFW_MOUSE_BUTTON_5 4 #define GLFW_MOUSE_BUTTON_6 5 #define GLFW_MOUSE_BUTTON_7 6 #define GLFW_MOUSE_BUTTON_8 7 #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 /*! @} */ /*! @defgroup joysticks Joysticks * @brief Joystick IDs. * * See [joystick input](@ref joystick) for how these are used. * * @ingroup input * @{ */ #define GLFW_JOYSTICK_1 0 #define GLFW_JOYSTICK_2 1 #define GLFW_JOYSTICK_3 2 #define GLFW_JOYSTICK_4 3 #define GLFW_JOYSTICK_5 4 #define GLFW_JOYSTICK_6 5 #define GLFW_JOYSTICK_7 6 #define GLFW_JOYSTICK_8 7 #define GLFW_JOYSTICK_9 8 #define GLFW_JOYSTICK_10 9 #define GLFW_JOYSTICK_11 10 #define GLFW_JOYSTICK_12 11 #define GLFW_JOYSTICK_13 12 #define GLFW_JOYSTICK_14 13 #define GLFW_JOYSTICK_15 14 #define GLFW_JOYSTICK_16 15 #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 /*! @} */ /*! @defgroup gamepad_buttons Gamepad buttons * @brief Gamepad buttons. * * See @ref gamepad for how these are used. * * @ingroup input * @{ */ #define GLFW_GAMEPAD_BUTTON_A 0 #define GLFW_GAMEPAD_BUTTON_B 1 #define GLFW_GAMEPAD_BUTTON_X 2 #define GLFW_GAMEPAD_BUTTON_Y 3 #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4 #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5 #define GLFW_GAMEPAD_BUTTON_BACK 6 #define GLFW_GAMEPAD_BUTTON_START 7 #define GLFW_GAMEPAD_BUTTON_GUIDE 8 #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9 #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10 #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11 #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12 #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13 #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14 #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y /*! @} */ /*! @defgroup gamepad_axes Gamepad axes * @brief Gamepad axes. * * See @ref gamepad for how these are used. * * @ingroup input * @{ */ #define GLFW_GAMEPAD_AXIS_LEFT_X 0 #define GLFW_GAMEPAD_AXIS_LEFT_Y 1 #define GLFW_GAMEPAD_AXIS_RIGHT_X 2 #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3 #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4 #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5 #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER /*! @} */ /*! @defgroup errors Error codes * @brief Error codes. * * See [error handling](@ref error_handling) for how these are used. * * @ingroup init * @{ */ /*! @brief No error has occurred. * * No error has occurred. * * @analysis Yay. */ #define GLFW_NO_ERROR 0 /*! @brief GLFW has not been initialized. * * This occurs if a GLFW function was called that must not be called unless the * library is [initialized](@ref intro_init). * * @analysis Application programmer error. Initialize GLFW before calling any * function that requires initialization. */ #define GLFW_NOT_INITIALIZED 0x00010001 /*! @brief No context is current for this thread. * * This occurs if a GLFW function was called that needs and operates on the * current OpenGL or OpenGL ES context but no context is current on the calling * thread. One such function is @ref glfwSwapInterval. * * @analysis Application programmer error. Ensure a context is current before * calling functions that require a current context. */ #define GLFW_NO_CURRENT_CONTEXT 0x00010002 /*! @brief One of the arguments to the function was an invalid enum value. * * One of the arguments to the function was an invalid enum value, for example * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib. * * @analysis Application programmer error. Fix the offending call. */ #define GLFW_INVALID_ENUM 0x00010003 /*! @brief One of the arguments to the function was an invalid value. * * One of the arguments to the function was an invalid value, for example * requesting a non-existent OpenGL or OpenGL ES version like 2.7. * * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead * result in a @ref GLFW_VERSION_UNAVAILABLE error. * * @analysis Application programmer error. Fix the offending call. */ #define GLFW_INVALID_VALUE 0x00010004 /*! @brief A memory allocation failed. * * A memory allocation failed. * * @analysis A bug in GLFW or the underlying operating system. Report the bug * to our [issue tracker](https://github.com/glfw/glfw/issues). */ #define GLFW_OUT_OF_MEMORY 0x00010005 /*! @brief GLFW could not find support for the requested API on the system. * * GLFW could not find support for the requested API on the system. * * @analysis The installed graphics driver does not support the requested * API, or does not support it via the chosen context creation backend. * Below are a few examples. * * @par * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only * supports OpenGL ES via EGL, while Nvidia and Intel only support it via * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary * driver. Older graphics drivers do not support Vulkan. */ #define GLFW_API_UNAVAILABLE 0x00010006 /*! @brief The requested OpenGL or OpenGL ES version is not available. * * The requested OpenGL or OpenGL ES version (including any requested context * or framebuffer hints) is not available on this machine. * * @analysis The machine does not support your requirements. If your * application is sufficiently flexible, downgrade your requirements and try * again. Otherwise, inform the user that their machine does not match your * requirements. * * @par * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 * comes out before the 4.x series gets that far, also fail with this error and * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions * will exist. */ #define GLFW_VERSION_UNAVAILABLE 0x00010007 /*! @brief A platform-specific error occurred that does not match any of the * more specific categories. * * A platform-specific error occurred that does not match any of the more * specific categories. * * @analysis A bug or configuration error in GLFW, the underlying operating * system or its drivers, or a lack of required resources. Report the issue to * our [issue tracker](https://github.com/glfw/glfw/issues). */ #define GLFW_PLATFORM_ERROR 0x00010008 /*! @brief The requested format is not supported or available. * * If emitted during window creation, the requested pixel format is not * supported. * * If emitted when querying the clipboard, the contents of the clipboard could * not be converted to the requested format. * * @analysis If emitted during window creation, one or more * [hard constraints](@ref window_hints_hard) did not match any of the * available pixel formats. If your application is sufficiently flexible, * downgrade your requirements and try again. Otherwise, inform the user that * their machine does not match your requirements. * * @par * If emitted when querying the clipboard, ignore the error or report it to * the user, as appropriate. */ #define GLFW_FORMAT_UNAVAILABLE 0x00010009 /*! @brief The specified window does not have an OpenGL or OpenGL ES context. * * A window that does not have an OpenGL or OpenGL ES context was passed to * a function that requires it to have one. * * @analysis Application programmer error. Fix the offending call. */ #define GLFW_NO_WINDOW_CONTEXT 0x0001000A /*! @} */ /*! @addtogroup window * @{ */ /*! @brief Input focus window hint and attribute * * Input focus [window hint](@ref GLFW_FOCUSED_hint) or * [window attribute](@ref GLFW_FOCUSED_attrib). */ #define GLFW_FOCUSED 0x00020001 /*! @brief Window iconification window attribute * * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib). */ #define GLFW_ICONIFIED 0x00020002 /*! @brief Window resize-ability window hint and attribute * * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and * [window attribute](@ref GLFW_RESIZABLE_attrib). */ #define GLFW_RESIZABLE 0x00020003 /*! @brief Window visibility window hint and attribute * * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and * [window attribute](@ref GLFW_VISIBLE_attrib). */ #define GLFW_VISIBLE 0x00020004 /*! @brief Window decoration window hint and attribute * * Window decoration [window hint](@ref GLFW_DECORATED_hint) and * [window attribute](@ref GLFW_DECORATED_attrib). */ #define GLFW_DECORATED 0x00020005 /*! @brief Window auto-iconification window hint and attribute * * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib). */ #define GLFW_AUTO_ICONIFY 0x00020006 /*! @brief Window decoration window hint and attribute * * Window decoration [window hint](@ref GLFW_FLOATING_hint) and * [window attribute](@ref GLFW_FLOATING_attrib). */ #define GLFW_FLOATING 0x00020007 /*! @brief Window maximization window hint and attribute * * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and * [window attribute](@ref GLFW_MAXIMIZED_attrib). */ #define GLFW_MAXIMIZED 0x00020008 /*! @brief Cursor centering window hint * * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint). */ #define GLFW_CENTER_CURSOR 0x00020009 /*! @brief Window framebuffer transparency hint and attribute * * Window framebuffer transparency * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). */ #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A /*! @brief Mouse cursor hover window attribute. * * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib). */ #define GLFW_HOVERED 0x0002000B /*! @brief Input focus on calling show window hint and attribute * * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). */ #define GLFW_FOCUS_ON_SHOW 0x0002000C /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). */ #define GLFW_RED_BITS 0x00021001 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). */ #define GLFW_GREEN_BITS 0x00021002 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS). */ #define GLFW_BLUE_BITS 0x00021003 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS). */ #define GLFW_ALPHA_BITS 0x00021004 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS). */ #define GLFW_DEPTH_BITS 0x00021005 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS). */ #define GLFW_STENCIL_BITS 0x00021006 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS). */ #define GLFW_ACCUM_RED_BITS 0x00021007 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS). */ #define GLFW_ACCUM_GREEN_BITS 0x00021008 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS). */ #define GLFW_ACCUM_BLUE_BITS 0x00021009 /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS). */ #define GLFW_ACCUM_ALPHA_BITS 0x0002100A /*! @brief Framebuffer auxiliary buffer hint. * * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). */ #define GLFW_AUX_BUFFERS 0x0002100B /*! @brief OpenGL stereoscopic rendering hint. * * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). */ #define GLFW_STEREO 0x0002100C /*! @brief Framebuffer MSAA samples hint. * * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). */ #define GLFW_SAMPLES 0x0002100D /*! @brief Framebuffer sRGB hint. * * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). */ #define GLFW_SRGB_CAPABLE 0x0002100E /*! @brief Monitor refresh rate hint. * * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). */ #define GLFW_REFRESH_RATE 0x0002100F /*! @brief Framebuffer double buffering hint. * * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER). */ #define GLFW_DOUBLEBUFFER 0x00021010 /*! @brief Context client API hint and attribute. * * Context client API [hint](@ref GLFW_CLIENT_API_hint) and * [attribute](@ref GLFW_CLIENT_API_attrib). */ #define GLFW_CLIENT_API 0x00022001 /*! @brief Context client API major version hint and attribute. * * Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint) * and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib). */ #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 /*! @brief Context client API minor version hint and attribute. * * Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint) * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib). */ #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 /*! @brief Context client API revision number hint and attribute. * * Context client API revision number * [attribute](@ref GLFW_CONTEXT_REVISION_attrib). */ #define GLFW_CONTEXT_REVISION 0x00022004 /*! @brief Context robustness hint and attribute. * * Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint) * and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib). */ #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 /*! @brief OpenGL forward-compatibility hint and attribute. * * OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). */ #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 /*! @brief OpenGL debug context hint and attribute. * * OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and * [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib). */ #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 /*! @brief OpenGL profile hint and attribute. * * OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and * [attribute](@ref GLFW_OPENGL_PROFILE_attrib). */ #define GLFW_OPENGL_PROFILE 0x00022008 /*! @brief Context flush-on-release hint and attribute. * * Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and * [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib). */ #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 /*! @brief Context error suppression hint and attribute. * * Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and * [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib). */ #define GLFW_CONTEXT_NO_ERROR 0x0002200A /*! @brief Context creation API hint and attribute. * * Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and * [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib). */ #define GLFW_CONTEXT_CREATION_API 0x0002200B /*! @brief Window content area scaling window * [window hint](@ref GLFW_SCALE_TO_MONITOR). */ #define GLFW_SCALE_TO_MONITOR 0x0002200C /*! @brief macOS specific * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). */ #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001 /*! @brief macOS specific * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint). */ #define GLFW_COCOA_FRAME_NAME 0x00023002 /*! @brief macOS specific * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint). */ #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003 /*! @brief X11 specific * [window hint](@ref GLFW_X11_CLASS_NAME_hint). */ #define GLFW_X11_CLASS_NAME 0x00024001 /*! @brief X11 specific * [window hint](@ref GLFW_X11_CLASS_NAME_hint). */ #define GLFW_X11_INSTANCE_NAME 0x00024002 /*! @} */ #define GLFW_NO_API 0 #define GLFW_OPENGL_API 0x00030001 #define GLFW_OPENGL_ES_API 0x00030002 #define GLFW_NO_ROBUSTNESS 0 #define GLFW_NO_RESET_NOTIFICATION 0x00031001 #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 #define GLFW_OPENGL_ANY_PROFILE 0 #define GLFW_OPENGL_CORE_PROFILE 0x00032001 #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 #define GLFW_CURSOR 0x00033001 #define GLFW_STICKY_KEYS 0x00033002 #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 #define GLFW_LOCK_KEY_MODS 0x00033004 #define GLFW_RAW_MOUSE_MOTION 0x00033005 #define GLFW_CURSOR_NORMAL 0x00034001 #define GLFW_CURSOR_HIDDEN 0x00034002 #define GLFW_CURSOR_DISABLED 0x00034003 #define GLFW_ANY_RELEASE_BEHAVIOR 0 #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 #define GLFW_NATIVE_CONTEXT_API 0x00036001 #define GLFW_EGL_CONTEXT_API 0x00036002 #define GLFW_OSMESA_CONTEXT_API 0x00036003 /*! @defgroup shapes Standard cursor shapes * @brief Standard system cursor shapes. * * See [standard cursor creation](@ref cursor_standard) for how these are used. * * @ingroup input * @{ */ /*! @brief The regular arrow cursor shape. * * The regular arrow cursor. */ #define GLFW_ARROW_CURSOR 0x00036001 /*! @brief The text input I-beam cursor shape. * * The text input I-beam cursor shape. */ #define GLFW_IBEAM_CURSOR 0x00036002 /*! @brief The crosshair shape. * * The crosshair shape. */ #define GLFW_CROSSHAIR_CURSOR 0x00036003 /*! @brief The hand shape. * * The hand shape. */ #define GLFW_HAND_CURSOR 0x00036004 /*! @brief The horizontal resize arrow shape. * * The horizontal resize arrow shape. */ #define GLFW_HRESIZE_CURSOR 0x00036005 /*! @brief The vertical resize arrow shape. * * The vertical resize arrow shape. */ #define GLFW_VRESIZE_CURSOR 0x00036006 /*! @} */ #define GLFW_CONNECTED 0x00040001 #define GLFW_DISCONNECTED 0x00040002 /*! @addtogroup init * @{ */ /*! @brief Joystick hat buttons init hint. * * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS). */ #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 /*! @brief macOS specific init hint. * * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint). */ #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 /*! @brief macOS specific init hint. * * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). */ #define GLFW_COCOA_MENUBAR 0x00051002 /*! @} */ #define GLFW_DONT_CARE -1 /************************************************************************* * GLFW API types *************************************************************************/ /*! @brief Client API function pointer type. * * Generic function pointer used for returning client API function pointers * without forcing a cast from a regular pointer. * * @sa @ref context_glext * @sa @ref glfwGetProcAddress * * @since Added in version 3.0. * * @ingroup context */ typedef void (*GLFWglproc)(void); /*! @brief Vulkan API function pointer type. * * Generic function pointer used for returning Vulkan API function pointers * without forcing a cast from a regular pointer. * * @sa @ref vulkan_proc * @sa @ref glfwGetInstanceProcAddress * * @since Added in version 3.2. * * @ingroup vulkan */ typedef void (*GLFWvkproc)(void); /*! @brief Opaque monitor object. * * Opaque monitor object. * * @see @ref monitor_object * * @since Added in version 3.0. * * @ingroup monitor */ typedef struct GLFWmonitor GLFWmonitor; /*! @brief Opaque window object. * * Opaque window object. * * @see @ref window_object * * @since Added in version 3.0. * * @ingroup window */ typedef struct GLFWwindow GLFWwindow; /*! @brief Opaque cursor object. * * Opaque cursor object. * * @see @ref cursor_object * * @since Added in version 3.1. * * @ingroup input */ typedef struct GLFWcursor GLFWcursor; /*! @brief The function pointer type for error callbacks. * * This is the function pointer type for error callbacks. An error callback * function has the following signature: * @code * void callback_name(int error_code, const char* description) * @endcode * * @param[in] error_code An [error code](@ref errors). Future releases may add * more error codes. * @param[in] description A UTF-8 encoded string describing the error. * * @pointer_lifetime The error description string is valid until the callback * function returns. * * @sa @ref error_handling * @sa @ref glfwSetErrorCallback * * @since Added in version 3.0. * * @ingroup init */ typedef void (* GLFWerrorfun)(int,const char*); /*! @brief The function pointer type for window position callbacks. * * This is the function pointer type for window position callbacks. A window * position callback function has the following signature: * @code * void callback_name(GLFWwindow* window, int xpos, int ypos) * @endcode * * @param[in] window The window that was moved. * @param[in] xpos The new x-coordinate, in screen coordinates, of the * upper-left corner of the content area of the window. * @param[in] ypos The new y-coordinate, in screen coordinates, of the * upper-left corner of the content area of the window. * * @sa @ref window_pos * @sa @ref glfwSetWindowPosCallback * * @since Added in version 3.0. * * @ingroup window */ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); /*! @brief The function pointer type for window size callbacks. * * This is the function pointer type for window size callbacks. A window size * callback function has the following signature: * @code * void callback_name(GLFWwindow* window, int width, int height) * @endcode * * @param[in] window The window that was resized. * @param[in] width The new width, in screen coordinates, of the window. * @param[in] height The new height, in screen coordinates, of the window. * * @sa @ref window_size * @sa @ref glfwSetWindowSizeCallback * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup window */ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); /*! @brief The function pointer type for window close callbacks. * * This is the function pointer type for window close callbacks. A window * close callback function has the following signature: * @code * void function_name(GLFWwindow* window) * @endcode * * @param[in] window The window that the user attempted to close. * * @sa @ref window_close * @sa @ref glfwSetWindowCloseCallback * * @since Added in version 2.5. * @glfw3 Added window handle parameter. * * @ingroup window */ typedef void (* GLFWwindowclosefun)(GLFWwindow*); /*! @brief The function pointer type for window content refresh callbacks. * * This is the function pointer type for window content refresh callbacks. * A window content refresh callback function has the following signature: * @code * void function_name(GLFWwindow* window); * @endcode * * @param[in] window The window whose content needs to be refreshed. * * @sa @ref window_refresh * @sa @ref glfwSetWindowRefreshCallback * * @since Added in version 2.5. * @glfw3 Added window handle parameter. * * @ingroup window */ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); /*! @brief The function pointer type for window focus callbacks. * * This is the function pointer type for window focus callbacks. A window * focus callback function has the following signature: * @code * void function_name(GLFWwindow* window, int focused) * @endcode * * @param[in] window The window that gained or lost input focus. * @param[in] focused `GLFW_TRUE` if the window was given input focus, or * `GLFW_FALSE` if it lost it. * * @sa @ref window_focus * @sa @ref glfwSetWindowFocusCallback * * @since Added in version 3.0. * * @ingroup window */ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); /*! @brief The function pointer type for window iconify callbacks. * * This is the function pointer type for window iconify callbacks. A window * iconify callback function has the following signature: * @code * void function_name(GLFWwindow* window, int iconified) * @endcode * * @param[in] window The window that was iconified or restored. * @param[in] iconified `GLFW_TRUE` if the window was iconified, or * `GLFW_FALSE` if it was restored. * * @sa @ref window_iconify * @sa @ref glfwSetWindowIconifyCallback * * @since Added in version 3.0. * * @ingroup window */ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); /*! @brief The function pointer type for window maximize callbacks. * * This is the function pointer type for window maximize callbacks. A window * maximize callback function has the following signature: * @code * void function_name(GLFWwindow* window, int maximized) * @endcode * * @param[in] window The window that was maximized or restored. * @param[in] iconified `GLFW_TRUE` if the window was maximized, or * `GLFW_FALSE` if it was restored. * * @sa @ref window_maximize * @sa glfwSetWindowMaximizeCallback * * @since Added in version 3.3. * * @ingroup window */ typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); /*! @brief The function pointer type for framebuffer size callbacks. * * This is the function pointer type for framebuffer size callbacks. * A framebuffer size callback function has the following signature: * @code * void function_name(GLFWwindow* window, int width, int height) * @endcode * * @param[in] window The window whose framebuffer was resized. * @param[in] width The new width, in pixels, of the framebuffer. * @param[in] height The new height, in pixels, of the framebuffer. * * @sa @ref window_fbsize * @sa @ref glfwSetFramebufferSizeCallback * * @since Added in version 3.0. * * @ingroup window */ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); /*! @brief The function pointer type for window content scale callbacks. * * This is the function pointer type for window content scale callbacks. * A window content scale callback function has the following signature: * @code * void function_name(GLFWwindow* window, float xscale, float yscale) * @endcode * * @param[in] window The window whose content scale changed. * @param[in] xscale The new x-axis content scale of the window. * @param[in] yscale The new y-axis content scale of the window. * * @sa @ref window_scale * @sa @ref glfwSetWindowContentScaleCallback * * @since Added in version 3.3. * * @ingroup window */ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); /*! @brief The function pointer type for mouse button callbacks. * * This is the function pointer type for mouse button callback functions. * A mouse button callback function has the following signature: * @code * void function_name(GLFWwindow* window, int button, int action, int mods) * @endcode * * @param[in] window The window that received the event. * @param[in] button The [mouse button](@ref buttons) that was pressed or * released. * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases * may add more actions. * @param[in] mods Bit field describing which [modifier keys](@ref mods) were * held down. * * @sa @ref input_mouse_button * @sa @ref glfwSetMouseButtonCallback * * @since Added in version 1.0. * @glfw3 Added window handle and modifier mask parameters. * * @ingroup input */ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); /*! @brief The function pointer type for cursor position callbacks. * * This is the function pointer type for cursor position callbacks. A cursor * position callback function has the following signature: * @code * void function_name(GLFWwindow* window, double xpos, double ypos); * @endcode * * @param[in] window The window that received the event. * @param[in] xpos The new cursor x-coordinate, relative to the left edge of * the content area. * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the * content area. * * @sa @ref cursor_pos * @sa @ref glfwSetCursorPosCallback * * @since Added in version 3.0. Replaces `GLFWmouseposfun`. * * @ingroup input */ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); /*! @brief The function pointer type for cursor enter/leave callbacks. * * This is the function pointer type for cursor enter/leave callbacks. * A cursor enter/leave callback function has the following signature: * @code * void function_name(GLFWwindow* window, int entered) * @endcode * * @param[in] window The window that received the event. * @param[in] entered `GLFW_TRUE` if the cursor entered the window's content * area, or `GLFW_FALSE` if it left it. * * @sa @ref cursor_enter * @sa @ref glfwSetCursorEnterCallback * * @since Added in version 3.0. * * @ingroup input */ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); /*! @brief The function pointer type for scroll callbacks. * * This is the function pointer type for scroll callbacks. A scroll callback * function has the following signature: * @code * void function_name(GLFWwindow* window, double xoffset, double yoffset) * @endcode * * @param[in] window The window that received the event. * @param[in] xoffset The scroll offset along the x-axis. * @param[in] yoffset The scroll offset along the y-axis. * * @sa @ref scrolling * @sa @ref glfwSetScrollCallback * * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. * * @ingroup input */ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); /*! @brief The function pointer type for keyboard key callbacks. * * This is the function pointer type for keyboard key callbacks. A keyboard * key callback function has the following signature: * @code * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) * @endcode * * @param[in] window The window that received the event. * @param[in] key The [keyboard key](@ref keys) that was pressed or released. * @param[in] scancode The system-specific scancode of the key. * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future * releases may add more actions. * @param[in] mods Bit field describing which [modifier keys](@ref mods) were * held down. * * @sa @ref input_key * @sa @ref glfwSetKeyCallback * * @since Added in version 1.0. * @glfw3 Added window handle, scancode and modifier mask parameters. * * @ingroup input */ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); /*! @brief The function pointer type for Unicode character callbacks. * * This is the function pointer type for Unicode character callbacks. * A Unicode character callback function has the following signature: * @code * void function_name(GLFWwindow* window, unsigned int codepoint) * @endcode * * @param[in] window The window that received the event. * @param[in] codepoint The Unicode code point of the character. * * @sa @ref input_char * @sa @ref glfwSetCharCallback * * @since Added in version 2.4. * @glfw3 Added window handle parameter. * * @ingroup input */ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); /*! @brief The function pointer type for Unicode character with modifiers * callbacks. * * This is the function pointer type for Unicode character with modifiers * callbacks. It is called for each input character, regardless of what * modifier keys are held down. A Unicode character with modifiers callback * function has the following signature: * @code * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) * @endcode * * @param[in] window The window that received the event. * @param[in] codepoint The Unicode code point of the character. * @param[in] mods Bit field describing which [modifier keys](@ref mods) were * held down. * * @sa @ref input_char * @sa @ref glfwSetCharModsCallback * * @deprecated Scheduled for removal in version 4.0. * * @since Added in version 3.1. * * @ingroup input */ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); /*! @brief The function pointer type for path drop callbacks. * * This is the function pointer type for path drop callbacks. A path drop * callback function has the following signature: * @code * void function_name(GLFWwindow* window, int path_count, const char* paths[]) * @endcode * * @param[in] window The window that received the event. * @param[in] path_count The number of dropped paths. * @param[in] paths The UTF-8 encoded file and/or directory path names. * * @pointer_lifetime The path array and its strings are valid until the * callback function returns. * * @sa @ref path_drop * @sa @ref glfwSetDropCallback * * @since Added in version 3.1. * * @ingroup input */ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]); /*! @brief The function pointer type for monitor configuration callbacks. * * This is the function pointer type for monitor configuration callbacks. * A monitor callback function has the following signature: * @code * void function_name(GLFWmonitor* monitor, int event) * @endcode * * @param[in] monitor The monitor that was connected or disconnected. * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future * releases may add more events. * * @sa @ref monitor_event * @sa @ref glfwSetMonitorCallback * * @since Added in version 3.0. * * @ingroup monitor */ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); /*! @brief The function pointer type for joystick configuration callbacks. * * This is the function pointer type for joystick configuration callbacks. * A joystick configuration callback function has the following signature: * @code * void function_name(int jid, int event) * @endcode * * @param[in] jid The joystick that was connected or disconnected. * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future * releases may add more events. * * @sa @ref joystick_event * @sa @ref glfwSetJoystickCallback * * @since Added in version 3.2. * * @ingroup input */ typedef void (* GLFWjoystickfun)(int,int); /*! @brief Video mode type. * * This describes a single video mode. * * @sa @ref monitor_modes * @sa @ref glfwGetVideoMode * @sa @ref glfwGetVideoModes * * @since Added in version 1.0. * @glfw3 Added refresh rate member. * * @ingroup monitor */ typedef struct GLFWvidmode { /*! The width, in screen coordinates, of the video mode. */ int width; /*! The height, in screen coordinates, of the video mode. */ int height; /*! The bit depth of the red channel of the video mode. */ int redBits; /*! The bit depth of the green channel of the video mode. */ int greenBits; /*! The bit depth of the blue channel of the video mode. */ int blueBits; /*! The refresh rate, in Hz, of the video mode. */ int refreshRate; } GLFWvidmode; /*! @brief Gamma ramp. * * This describes the gamma ramp for a monitor. * * @sa @ref monitor_gamma * @sa @ref glfwGetGammaRamp * @sa @ref glfwSetGammaRamp * * @since Added in version 3.0. * * @ingroup monitor */ typedef struct GLFWgammaramp { /*! An array of value describing the response of the red channel. */ unsigned short* red; /*! An array of value describing the response of the green channel. */ unsigned short* green; /*! An array of value describing the response of the blue channel. */ unsigned short* blue; /*! The number of elements in each array. */ unsigned int size; } GLFWgammaramp; /*! @brief Image data. * * This describes a single 2D image. See the documentation for each related * function what the expected pixel format is. * * @sa @ref cursor_custom * @sa @ref window_icon * * @since Added in version 2.1. * @glfw3 Removed format and bytes-per-pixel members. * * @ingroup window */ typedef struct GLFWimage { /*! The width, in pixels, of this image. */ int width; /*! The height, in pixels, of this image. */ int height; /*! The pixel data of this image, arranged left-to-right, top-to-bottom. */ unsigned char* pixels; } GLFWimage; /*! @brief Gamepad input state * * This describes the input state of a gamepad. * * @sa @ref gamepad * @sa @ref glfwGetGamepadState * * @since Added in version 3.3. * * @ingroup input */ typedef struct GLFWgamepadstate { /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` * or `GLFW_RELEASE`. */ unsigned char buttons[15]; /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 * to 1.0 inclusive. */ float axes[6]; } GLFWgamepadstate; /************************************************************************* * GLFW API functions *************************************************************************/ /*! @brief Initializes the GLFW library. * * This function initializes the GLFW library. Before most GLFW functions can * be used, GLFW must be initialized, and before an application terminates GLFW * should be terminated in order to free any resources allocated during or * after initialization. * * If this function fails, it calls @ref glfwTerminate before returning. If it * succeeds, you should call @ref glfwTerminate before the application exits. * * Additional calls to this function after successful initialization but before * termination will return `GLFW_TRUE` immediately. * * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. * * @remark @macos This function will change the current directory of the * application to the `Contents/Resources` subdirectory of the application's * bundle, if present. This can be disabled with the @ref * GLFW_COCOA_CHDIR_RESOURCES init hint. * * @thread_safety This function must only be called from the main thread. * * @sa @ref intro_init * @sa @ref glfwTerminate * * @since Added in version 1.0. * * @ingroup init */ GLFWAPI int glfwInit(void); /*! @brief Terminates the GLFW library. * * This function destroys all remaining windows and cursors, restores any * modified gamma ramps and frees any other allocated resources. Once this * function is called, you must again call @ref glfwInit successfully before * you will be able to use most GLFW functions. * * If GLFW has been successfully initialized, this function should be called * before the application exits. If initialization fails, there is no need to * call this function, as it is called by @ref glfwInit before it returns * failure. * * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. * * @remark This function may be called before @ref glfwInit. * * @warning The contexts of any remaining windows must not be current on any * other thread when this function is called. * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. * * @sa @ref intro_init * @sa @ref glfwInit * * @since Added in version 1.0. * * @ingroup init */ GLFWAPI void glfwTerminate(void); /*! @brief Sets the specified init hint to the desired value. * * This function sets hints for the next initialization of GLFW. * * The values you set hints to are never reset by GLFW, but they only take * effect during initialization. Once GLFW has been initialized, any values * you set will be ignored until the library is terminated and initialized * again. * * Some hints are platform specific. These may be set on any platform but they * will only affect their specific platform. Other platforms will ignore them. * Setting these hints requires no platform specific headers or functions. * * @param[in] hint The [init hint](@ref init_hints) to set. * @param[in] value The new value of the init hint. * * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref * GLFW_INVALID_VALUE. * * @remarks This function may be called before @ref glfwInit. * * @thread_safety This function must only be called from the main thread. * * @sa init_hints * @sa glfwInit * * @since Added in version 3.3. * * @ingroup init */ GLFWAPI void glfwInitHint(int hint, int value); /*! @brief Retrieves the version of the GLFW library. * * This function retrieves the major, minor and revision numbers of the GLFW * library. It is intended for when you are using GLFW as a shared library and * want to ensure that you are using the minimum required version. * * Any or all of the version arguments may be `NULL`. * * @param[out] major Where to store the major version number, or `NULL`. * @param[out] minor Where to store the minor version number, or `NULL`. * @param[out] rev Where to store the revision number, or `NULL`. * * @errors None. * * @remark This function may be called before @ref glfwInit. * * @thread_safety This function may be called from any thread. * * @sa @ref intro_version * @sa @ref glfwGetVersionString * * @since Added in version 1.0. * * @ingroup init */ GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); /*! @brief Returns a string describing the compile-time configuration. * * This function returns the compile-time generated * [version string](@ref intro_version_string) of the GLFW library binary. It * describes the version, platform, compiler and any platform-specific * compile-time options. It should not be confused with the OpenGL or OpenGL * ES version string, queried with `glGetString`. * * __Do not use the version string__ to parse the GLFW library version. The * @ref glfwGetVersion function provides the version of the running library * binary in numerical format. * * @return The ASCII encoded GLFW version string. * * @errors None. * * @remark This function may be called before @ref glfwInit. * * @pointer_lifetime The returned string is static and compile-time generated. * * @thread_safety This function may be called from any thread. * * @sa @ref intro_version * @sa @ref glfwGetVersion * * @since Added in version 3.0. * * @ingroup init */ GLFWAPI const char* glfwGetVersionString(void); /*! @brief Returns and clears the last error for the calling thread. * * This function returns and clears the [error code](@ref errors) of the last * error that occurred on the calling thread, and optionally a UTF-8 encoded * human-readable description of it. If no error has occurred since the last * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is * set to `NULL`. * * @param[in] description Where to store the error description pointer, or `NULL`. * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR * (zero). * * @errors None. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is guaranteed to be valid only until the * next error occurs or the library is terminated. * * @remark This function may be called before @ref glfwInit. * * @thread_safety This function may be called from any thread. * * @sa @ref error_handling * @sa @ref glfwSetErrorCallback * * @since Added in version 3.3. * * @ingroup init */ GLFWAPI int glfwGetError(const char** description); /*! @brief Sets the error callback. * * This function sets the error callback, which is called with an error code * and a human-readable description each time a GLFW error occurs. * * The error code is set before the callback is called. Calling @ref * glfwGetError from the error callback will return the same value as the error * code argument. * * The error callback is called on the thread where the error occurred. If you * are using GLFW from multiple threads, your error callback needs to be * written accordingly. * * Because the description string may have been generated specifically for that * error, it is not guaranteed to be valid after the callback has returned. If * you wish to use it after the callback returns, you need to make a copy. * * Once set, the error callback remains set even after the library has been * terminated. * * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set. * * @callback_signature * @code * void callback_name(int error_code, const char* description) * @endcode * For more information about the callback parameters, see the * [callback pointer type](@ref GLFWerrorfun). * * @errors None. * * @remark This function may be called before @ref glfwInit. * * @thread_safety This function must only be called from the main thread. * * @sa @ref error_handling * @sa @ref glfwGetError * * @since Added in version 3.0. * * @ingroup init */ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback); /*! @brief Returns the currently connected monitors. * * This function returns an array of handles for all currently connected * monitors. The primary monitor is always first in the returned array. If no * monitors were found, this function returns `NULL`. * * @param[out] count Where to store the number of monitors in the returned * array. This is set to zero if an error occurred. * @return An array of monitor handles, or `NULL` if no monitors were found or * if an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is guaranteed to be valid only until the * monitor configuration changes or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_monitors * @sa @ref monitor_event * @sa @ref glfwGetPrimaryMonitor * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); /*! @brief Returns the primary monitor. * * This function returns the primary monitor. This is usually the monitor * where elements like the task bar or global menu bar are located. * * @return The primary monitor, or `NULL` if no monitors were found or if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @remark The primary monitor is always first in the array returned by @ref * glfwGetMonitors. * * @sa @ref monitor_monitors * @sa @ref glfwGetMonitors * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); /*! @brief Returns the position of the monitor's viewport on the virtual screen. * * This function returns the position, in screen coordinates, of the upper-left * corner of the specified monitor. * * Any or all of the position arguments may be `NULL`. If an error occurs, all * non-`NULL` position arguments will be set to zero. * * @param[in] monitor The monitor to query. * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_properties * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); /*! @brief Retrieves the work area of the monitor. * * This function returns the position, in screen coordinates, of the upper-left * corner of the work area of the specified monitor along with the work area * size in screen coordinates. The work area is defined as the area of the * monitor not occluded by the operating system task bar where present. If no * task bar exists then the work area is the monitor resolution in screen * coordinates. * * Any or all of the position and size arguments may be `NULL`. If an error * occurs, all non-`NULL` position and size arguments will be set to zero. * * @param[in] monitor The monitor to query. * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. * @param[out] width Where to store the monitor width, or `NULL`. * @param[out] height Where to store the monitor height, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_workarea * * @since Added in version 3.3. * * @ingroup monitor */ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); /*! @brief Returns the physical size of the monitor. * * This function returns the size, in millimetres, of the display area of the * specified monitor. * * Some systems do not provide accurate monitor size information, either * because the monitor * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) * data is incorrect or because the driver does not report it accurately. * * Any or all of the size arguments may be `NULL`. If an error occurs, all * non-`NULL` size arguments will be set to zero. * * @param[in] monitor The monitor to query. * @param[out] widthMM Where to store the width, in millimetres, of the * monitor's display area, or `NULL`. * @param[out] heightMM Where to store the height, in millimetres, of the * monitor's display area, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @remark @win32 calculates the returned physical size from the * current resolution and system DPI instead of querying the monitor EDID data. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_properties * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); /*! @brief Retrieves the content scale for the specified monitor. * * This function retrieves the content scale for the specified monitor. The * content scale is the ratio between the current DPI and the platform's * default DPI. This is especially important for text and any UI elements. If * the pixel dimensions of your UI scaled by this look appropriate on your * machine then it should appear at a reasonable size on other machines * regardless of their DPI and scaling settings. This relies on the system DPI * and scaling settings being somewhat correct. * * The content scale may depend on both the monitor resolution and pixel * density and on user settings. It may be very different from the raw DPI * calculated from the physical size and current resolution. * * @param[in] monitor The monitor to query. * @param[out] xscale Where to store the x-axis content scale, or `NULL`. * @param[out] yscale Where to store the y-axis content scale, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_scale * @sa @ref glfwGetWindowContentScale * * @since Added in version 3.3. * * @ingroup monitor */ GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); /*! @brief Returns the name of the specified monitor. * * This function returns a human-readable name, encoded as UTF-8, of the * specified monitor. The name typically reflects the make and model of the * monitor and is not guaranteed to be unique among the connected monitors. * * @param[in] monitor The monitor to query. * @return The UTF-8 encoded name of the monitor, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified monitor is * disconnected or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_properties * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); /*! @brief Sets the user pointer of the specified monitor. * * This function sets the user-defined pointer of the specified monitor. The * current value is retained until the monitor is disconnected. The initial * value is `NULL`. * * This function may be called from the monitor callback, even for a monitor * that is being disconnected. * * @param[in] monitor The monitor whose pointer to set. * @param[in] pointer The new value. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref monitor_userptr * @sa @ref glfwGetMonitorUserPointer * * @since Added in version 3.3. * * @ingroup monitor */ GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); /*! @brief Returns the user pointer of the specified monitor. * * This function returns the current value of the user-defined pointer of the * specified monitor. The initial value is `NULL`. * * This function may be called from the monitor callback, even for a monitor * that is being disconnected. * * @param[in] monitor The monitor whose pointer to return. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref monitor_userptr * @sa @ref glfwSetMonitorUserPointer * * @since Added in version 3.3. * * @ingroup monitor */ GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); /*! @brief Sets the monitor configuration callback. * * This function sets the monitor configuration callback, or removes the * currently set callback. This is called when a monitor is connected to or * disconnected from the system. * * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWmonitor* monitor, int event) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWmonitorfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_event * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); /*! @brief Returns the available video modes for the specified monitor. * * This function returns an array of all video modes supported by the specified * monitor. The returned array is sorted in ascending order, first by color * bit depth (the sum of all channel depths) and then by resolution area (the * product of width and height). * * @param[in] monitor The monitor to query. * @param[out] count Where to store the number of video modes in the returned * array. This is set to zero if an error occurred. * @return An array of video modes, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified monitor is * disconnected, this function is called again for that monitor or the library * is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_modes * @sa @ref glfwGetVideoMode * * @since Added in version 1.0. * @glfw3 Changed to return an array of modes for a specific monitor. * * @ingroup monitor */ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); /*! @brief Returns the current mode of the specified monitor. * * This function returns the current video mode of the specified monitor. If * you have created a full screen window for that monitor, the return value * will depend on whether that window is iconified. * * @param[in] monitor The monitor to query. * @return The current mode of the monitor, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified monitor is * disconnected or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_modes * @sa @ref glfwGetVideoModes * * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. * * @ingroup monitor */ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); /*! @brief Generates a gamma ramp and sets it for the specified monitor. * * This function generates an appropriately sized gamma ramp from the specified * exponent and then calls @ref glfwSetGammaRamp with it. The value must be * a finite number greater than zero. * * The software controlled gamma ramp is applied _in addition_ to the hardware * gamma correction, which today is usually an approximation of sRGB gamma. * This means that setting a perfectly linear ramp, or gamma 1.0, will produce * the default (usually sRGB-like) behavior. * * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref * GLFW_SRGB_CAPABLE hint. * * @param[in] monitor The monitor whose gamma ramp to set. * @param[in] gamma The desired exponent. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @remark @wayland Gamma handling is a privileged protocol, this function * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_gamma * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); /*! @brief Returns the current gamma ramp for the specified monitor. * * This function returns the current gamma ramp of the specified monitor. * * @param[in] monitor The monitor to query. * @return The current gamma ramp, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland Gamma handling is a privileged protocol, this function * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while * returning `NULL`. * * @pointer_lifetime The returned structure and its arrays are allocated and * freed by GLFW. You should not free them yourself. They are valid until the * specified monitor is disconnected, this function is called again for that * monitor or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_gamma * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); /*! @brief Sets the current gamma ramp for the specified monitor. * * This function sets the current gamma ramp for the specified monitor. The * original gamma ramp for that monitor is saved by GLFW the first time this * function is called and is restored by @ref glfwTerminate. * * The software controlled gamma ramp is applied _in addition_ to the hardware * gamma correction, which today is usually an approximation of sRGB gamma. * This means that setting a perfectly linear ramp, or gamma 1.0, will produce * the default (usually sRGB-like) behavior. * * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref * GLFW_SRGB_CAPABLE hint. * * @param[in] monitor The monitor whose gamma ramp to set. * @param[in] ramp The gamma ramp to use. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark The size of the specified gamma ramp should match the size of the * current ramp for that monitor. * * @remark @win32 The gamma ramp size must be 256. * * @remark @wayland Gamma handling is a privileged protocol, this function * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified gamma ramp is copied before this function * returns. * * @thread_safety This function must only be called from the main thread. * * @sa @ref monitor_gamma * * @since Added in version 3.0. * * @ingroup monitor */ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); /*! @brief Resets all window hints to their default values. * * This function resets all window hints to their * [default values](@ref window_hints_values). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_hints * @sa @ref glfwWindowHint * @sa @ref glfwWindowHintString * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwDefaultWindowHints(void); /*! @brief Sets the specified window hint to the desired value. * * This function sets hints for the next call to @ref glfwCreateWindow. The * hints, once set, retain their values until changed by a call to this * function or @ref glfwDefaultWindowHints, or until the library is terminated. * * Only integer value hints can be set with this function. String value hints * are set with @ref glfwWindowHintString. * * This function does not check whether the specified hint values are valid. * If you set hints to invalid values this will instead be reported by the next * call to @ref glfwCreateWindow. * * Some hints are platform specific. These may be set on any platform but they * will only affect their specific platform. Other platforms will ignore them. * Setting these hints requires no platform specific headers or functions. * * @param[in] hint The [window hint](@ref window_hints) to set. * @param[in] value The new value of the window hint. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_hints * @sa @ref glfwWindowHintString * @sa @ref glfwDefaultWindowHints * * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. * * @ingroup window */ GLFWAPI void glfwWindowHint(int hint, int value); /*! @brief Sets the specified window hint to the desired value. * * This function sets hints for the next call to @ref glfwCreateWindow. The * hints, once set, retain their values until changed by a call to this * function or @ref glfwDefaultWindowHints, or until the library is terminated. * * Only string type hints can be set with this function. Integer value hints * are set with @ref glfwWindowHint. * * This function does not check whether the specified hint values are valid. * If you set hints to invalid values this will instead be reported by the next * call to @ref glfwCreateWindow. * * Some hints are platform specific. These may be set on any platform but they * will only affect their specific platform. Other platforms will ignore them. * Setting these hints requires no platform specific headers or functions. * * @param[in] hint The [window hint](@ref window_hints) to set. * @param[in] value The new value of the window hint. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @pointer_lifetime The specified string is copied before this function * returns. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_hints * @sa @ref glfwWindowHint * @sa @ref glfwDefaultWindowHints * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI void glfwWindowHintString(int hint, const char* value); /*! @brief Creates a window and its associated context. * * This function creates a window and its associated OpenGL or OpenGL ES * context. Most of the options controlling how the window and its context * should be created are specified with [window hints](@ref window_hints). * * Successful creation does not change which context is current. Before you * can use the newly created context, you need to * [make it current](@ref context_current). For information about the `share` * parameter, see @ref context_sharing. * * The created window, framebuffer and context may differ from what you * requested, as not all parameters and hints are * [hard constraints](@ref window_hints_hard). This includes the size of the * window, especially for full screen windows. To query the actual attributes * of the created window, framebuffer and context, see @ref * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. * * To create a full screen window, you need to specify the monitor the window * will cover. If no monitor is specified, the window will be windowed mode. * Unless you have a way for the user to choose a specific monitor, it is * recommended that you pick the primary monitor. For more information on how * to query connected monitors, see @ref monitor_monitors. * * For full screen windows, the specified size becomes the resolution of the * window's _desired video mode_. As long as a full screen window is not * iconified, the supported video mode most closely matching the desired video * mode is set for the specified monitor. For more information about full * screen windows, including the creation of so called _windowed full screen_ * or _borderless full screen_ windows, see @ref window_windowed_full_screen. * * Once you have created the window, you can switch it between windowed and * full screen mode with @ref glfwSetWindowMonitor. This will not affect its * OpenGL or OpenGL ES context. * * By default, newly created windows use the placement recommended by the * window system. To create the window at a specific position, make it * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) * it. * * As long as at least one full screen window is not iconified, the screensaver * is prohibited from starting. * * Window systems put limits on window sizes. Very large or very small window * dimensions may be overridden by the window system on creation. Check the * actual [size](@ref window_size) after creation. * * The [swap interval](@ref buffer_swap) is not set during window creation and * the initial value may vary depending on driver settings and defaults. * * @param[in] width The desired width, in screen coordinates, of the window. * This must be greater than zero. * @param[in] height The desired height, in screen coordinates, of the window. * This must be greater than zero. * @param[in] title The initial, UTF-8 encoded window title. * @param[in] monitor The monitor to use for full screen mode, or `NULL` for * windowed mode. * @param[in] share The window whose context to share resources with, or `NULL` * to not share resources. * @return The handle of the created window, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref * GLFW_PLATFORM_ERROR. * * @remark @win32 Window creation will fail if the Microsoft GDI software * OpenGL implementation is the only one available. * * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it * will be set as the initial icon for the window. If no such icon is present, * the `IDI_APPLICATION` icon will be used instead. To set a different icon, * see @ref glfwSetWindowIcon. * * @remark @win32 The context to share resources with must not be current on * any other thread. * * @remark @macos The OS only supports forward-compatible core profile contexts * for OpenGL versions 3.2 and later. Before creating an OpenGL context of * version 3.2 or later you must set the * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS. * * @remark @macos The GLFW window has no icon, as it is not a document * window, but the dock icon will be the same as the application bundle's icon. * For more information on bundles, see the * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) * in the Mac Developer Library. * * @remark @macos The first time a window is created the menu bar is created. * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu * bar. Otherwise a minimal menu bar is created manually with common commands * like Hide, Quit and About. The About entry opens a minimal about dialog * with information from the application's bundle. Menu bar creation can be * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint. * * @remark @macos On OS X 10.10 and later the window frame will not be rendered * at full resolution on Retina displays unless the * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the * application bundle's `Info.plist`. For more information, see * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html) * in the Mac Developer Library. The GLFW test and example programs use * a custom `Info.plist` template for this, which can be found as * `CMake/MacOSXBundleInfo.plist.in` in the source tree. * * @remark @macos When activating frame autosaving with * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified * window size and position may be overridden by previously saved values. * * @remark @x11 Some window managers will not respect the placement of * initially hidden windows. * * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for * a window to reach its requested state. This means you may not be able to * query the final size, position or other attributes directly after window * creation. * * @remark @x11 The class part of the `WM_CLASS` window property will by * default be set to the window title passed to this function. The instance * part will use the contents of the `RESOURCE_NAME` environment variable, if * present and not empty, or fall back to the window title. Set the * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to * override this. * * @remark @wayland Compositors should implement the xdg-decoration protocol * for GLFW to decorate the window properly. If this protocol isn't * supported, or if the compositor prefers client-side decorations, a very * simple fallback frame will be drawn using the wp_viewporter protocol. A * compositor can still emit close, maximize or fullscreen events, using for * instance a keybind mechanism. If neither of these protocols is supported, * the window won't be decorated. * * @remark @wayland A full screen window will not attempt to change the mode, * no matter what the requested size or refresh rate. * * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol * to be implemented in the user's compositor. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_creation * @sa @ref glfwDestroyWindow * * @since Added in version 3.0. Replaces `glfwOpenWindow`. * * @ingroup window */ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); /*! @brief Destroys the specified window and its context. * * This function destroys the specified window and its context. On calling * this function, no further callbacks will be called for that window. * * If the context of the specified window is current on the main thread, it is * detached before being destroyed. * * @param[in] window The window to destroy. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @note The context of the specified window must not be current on any other * thread when this function is called. * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_creation * @sa @ref glfwCreateWindow * * @since Added in version 3.0. Replaces `glfwCloseWindow`. * * @ingroup window */ GLFWAPI void glfwDestroyWindow(GLFWwindow* window); /*! @brief Checks the close flag of the specified window. * * This function returns the value of the close flag of the specified window. * * @param[in] window The window to query. * @return The value of the close flag. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref window_close * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); /*! @brief Sets the close flag of the specified window. * * This function sets the value of the close flag of the specified window. * This can be used to override the user's attempt to close the window, or * to signal that it should be closed. * * @param[in] window The window whose flag to change. * @param[in] value The new value. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref window_close * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); /*! @brief Sets the title of the specified window. * * This function sets the window title, encoded as UTF-8, of the specified * window. * * @param[in] window The window whose title to change. * @param[in] title The UTF-8 encoded window title. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @macos The window title will not be updated until the next time you * process events. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_title * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); /*! @brief Sets the icon for the specified window. * * This function sets the icon of the specified window. If passed an array of * candidate images, those of or closest to the sizes desired by the system are * selected. If no images are specified, the window reverts to its default * icon. * * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight * bits per channel with the red channel first. They are arranged canonically * as packed sequential rows, starting from the top-left corner. * * The desired image sizes varies depending on platform and system settings. * The selected images will be rescaled as needed. Good sizes include 16x16, * 32x32 and 48x48. * * @param[in] window The window whose icon to set. * @param[in] count The number of images in the specified array, or zero to * revert to the default window icon. * @param[in] images The images to create the icon from. This is ignored if * count is zero. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified image data is copied before this function * returns. * * @remark @macos The GLFW window has no icon, as it is not a document * window, so this function does nothing. The dock icon will be the same as * the application bundle's icon. For more information on bundles, see the * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) * in the Mac Developer Library. * * @remark @wayland There is no existing protocol to change an icon, the * window will thus inherit the one defined in the application's desktop file. * This function always emits @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_icon * * @since Added in version 3.2. * * @ingroup window */ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); /*! @brief Retrieves the position of the content area of the specified window. * * This function retrieves the position, in screen coordinates, of the * upper-left corner of the content area of the specified window. * * Any or all of the position arguments may be `NULL`. If an error occurs, all * non-`NULL` position arguments will be set to zero. * * @param[in] window The window to query. * @param[out] xpos Where to store the x-coordinate of the upper-left corner of * the content area, or `NULL`. * @param[out] ypos Where to store the y-coordinate of the upper-left corner of * the content area, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland There is no way for an application to retrieve the global * position of its windows, this function will always emit @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_pos * @sa @ref glfwSetWindowPos * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); /*! @brief Sets the position of the content area of the specified window. * * This function sets the position, in screen coordinates, of the upper-left * corner of the content area of the specified windowed mode window. If the * window is a full screen window, this function does nothing. * * __Do not use this function__ to move an already visible window unless you * have very good reasons for doing so, as it will confuse and annoy the user. * * The window manager may put limits on what positions are allowed. GLFW * cannot and should not override these limits. * * @param[in] window The window to query. * @param[in] xpos The x-coordinate of the upper-left corner of the content area. * @param[in] ypos The y-coordinate of the upper-left corner of the content area. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland There is no way for an application to set the global * position of its windows, this function will always emit @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_pos * @sa @ref glfwGetWindowPos * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); /*! @brief Retrieves the size of the content area of the specified window. * * This function retrieves the size, in screen coordinates, of the content area * of the specified window. If you wish to retrieve the size of the * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. * * Any or all of the size arguments may be `NULL`. If an error occurs, all * non-`NULL` size arguments will be set to zero. * * @param[in] window The window whose size to retrieve. * @param[out] width Where to store the width, in screen coordinates, of the * content area, or `NULL`. * @param[out] height Where to store the height, in screen coordinates, of the * content area, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_size * @sa @ref glfwSetWindowSize * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); /*! @brief Sets the size limits of the specified window. * * This function sets the size limits of the content area of the specified * window. If the window is full screen, the size limits only take effect * once it is made windowed. If the window is not resizable, this function * does nothing. * * The size limits are applied immediately to a windowed mode window and may * cause it to be resized. * * The maximum dimensions must be greater than or equal to the minimum * dimensions and all must be greater than or equal to zero. * * @param[in] window The window to set limits for. * @param[in] minwidth The minimum width, in screen coordinates, of the content * area, or `GLFW_DONT_CARE`. * @param[in] minheight The minimum height, in screen coordinates, of the * content area, or `GLFW_DONT_CARE`. * @param[in] maxwidth The maximum width, in screen coordinates, of the content * area, or `GLFW_DONT_CARE`. * @param[in] maxheight The maximum height, in screen coordinates, of the * content area, or `GLFW_DONT_CARE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @remark If you set size limits and an aspect ratio that conflict, the * results are undefined. * * @remark @wayland The size limits will not be applied until the window is * actually resized, either by the user or by the compositor. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_sizelimits * @sa @ref glfwSetWindowAspectRatio * * @since Added in version 3.2. * * @ingroup window */ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); /*! @brief Sets the aspect ratio of the specified window. * * This function sets the required aspect ratio of the content area of the * specified window. If the window is full screen, the aspect ratio only takes * effect once it is made windowed. If the window is not resizable, this * function does nothing. * * The aspect ratio is specified as a numerator and a denominator and both * values must be greater than zero. For example, the common 16:9 aspect ratio * is specified as 16 and 9, respectively. * * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect * ratio limit is disabled. * * The aspect ratio is applied immediately to a windowed mode window and may * cause it to be resized. * * @param[in] window The window to set limits for. * @param[in] numer The numerator of the desired aspect ratio, or * `GLFW_DONT_CARE`. * @param[in] denom The denominator of the desired aspect ratio, or * `GLFW_DONT_CARE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @remark If you set size limits and an aspect ratio that conflict, the * results are undefined. * * @remark @wayland The aspect ratio will not be applied until the window is * actually resized, either by the user or by the compositor. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_sizelimits * @sa @ref glfwSetWindowSizeLimits * * @since Added in version 3.2. * * @ingroup window */ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); /*! @brief Sets the size of the content area of the specified window. * * This function sets the size, in screen coordinates, of the content area of * the specified window. * * For full screen windows, this function updates the resolution of its desired * video mode and switches to the video mode closest to it, without affecting * the window's context. As the context is unaffected, the bit depths of the * framebuffer remain unchanged. * * If you wish to update the refresh rate of the desired video mode in addition * to its resolution, see @ref glfwSetWindowMonitor. * * The window manager may put limits on what sizes are allowed. GLFW cannot * and should not override these limits. * * @param[in] window The window to resize. * @param[in] width The desired width, in screen coordinates, of the window * content area. * @param[in] height The desired height, in screen coordinates, of the window * content area. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland A full screen window will not attempt to change the mode, * no matter what the requested size. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_size * @sa @ref glfwGetWindowSize * @sa @ref glfwSetWindowMonitor * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); /*! @brief Retrieves the size of the framebuffer of the specified window. * * This function retrieves the size, in pixels, of the framebuffer of the * specified window. If you wish to retrieve the size of the window in screen * coordinates, see @ref glfwGetWindowSize. * * Any or all of the size arguments may be `NULL`. If an error occurs, all * non-`NULL` size arguments will be set to zero. * * @param[in] window The window whose framebuffer to query. * @param[out] width Where to store the width, in pixels, of the framebuffer, * or `NULL`. * @param[out] height Where to store the height, in pixels, of the framebuffer, * or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_fbsize * @sa @ref glfwSetFramebufferSizeCallback * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); /*! @brief Retrieves the size of the frame of the window. * * This function retrieves the size, in screen coordinates, of each edge of the * frame of the specified window. This size includes the title bar, if the * window has one. The size of the frame may vary depending on the * [window-related hints](@ref window_hints_wnd) used to create it. * * Because this function retrieves the size of each window frame edge and not * the offset along a particular coordinate axis, the retrieved values will * always be zero or positive. * * Any or all of the size arguments may be `NULL`. If an error occurs, all * non-`NULL` size arguments will be set to zero. * * @param[in] window The window whose frame size to query. * @param[out] left Where to store the size, in screen coordinates, of the left * edge of the window frame, or `NULL`. * @param[out] top Where to store the size, in screen coordinates, of the top * edge of the window frame, or `NULL`. * @param[out] right Where to store the size, in screen coordinates, of the * right edge of the window frame, or `NULL`. * @param[out] bottom Where to store the size, in screen coordinates, of the * bottom edge of the window frame, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_size * * @since Added in version 3.1. * * @ingroup window */ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); /*! @brief Retrieves the content scale for the specified window. * * This function retrieves the content scale for the specified window. The * content scale is the ratio between the current DPI and the platform's * default DPI. This is especially important for text and any UI elements. If * the pixel dimensions of your UI scaled by this look appropriate on your * machine then it should appear at a reasonable size on other machines * regardless of their DPI and scaling settings. This relies on the system DPI * and scaling settings being somewhat correct. * * On systems where each monitors can have its own content scale, the window * content scale will depend on which monitor the system considers the window * to be on. * * @param[in] window The window to query. * @param[out] xscale Where to store the x-axis content scale, or `NULL`. * @param[out] yscale Where to store the y-axis content scale, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_scale * @sa @ref glfwSetWindowContentScaleCallback * @sa @ref glfwGetMonitorContentScale * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); /*! @brief Returns the opacity of the whole window. * * This function returns the opacity of the window, including any decorations. * * The opacity (or alpha) value is a positive finite number between zero and * one, where zero is fully transparent and one is fully opaque. If the system * does not support whole window transparency, this function always returns one. * * The initial opacity value for newly created windows is one. * * @param[in] window The window to query. * @return The opacity value of the specified window. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_transparency * @sa @ref glfwSetWindowOpacity * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); /*! @brief Sets the opacity of the whole window. * * This function sets the opacity of the window, including any decorations. * * The opacity (or alpha) value is a positive finite number between zero and * one, where zero is fully transparent and one is fully opaque. * * The initial opacity value for newly created windows is one. * * A window created with framebuffer transparency may not use whole window * transparency. The results of doing this are undefined. * * @param[in] window The window to set the opacity for. * @param[in] opacity The desired opacity of the specified window. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_transparency * @sa @ref glfwGetWindowOpacity * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); /*! @brief Iconifies the specified window. * * This function iconifies (minimizes) the specified window if it was * previously restored. If the window is already iconified, this function does * nothing. * * If the specified window is a full screen window, the original monitor * resolution is restored until the window is restored. * * @param[in] window The window to iconify. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland There is no concept of iconification in wl_shell, this * function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated * protocol. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify * @sa @ref glfwRestoreWindow * @sa @ref glfwMaximizeWindow * * @since Added in version 2.1. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); /*! @brief Restores the specified window. * * This function restores the specified window if it was previously iconified * (minimized) or maximized. If the window is already restored, this function * does nothing. * * If the specified window is a full screen window, the resolution chosen for * the window is restored on the selected monitor. * * @param[in] window The window to restore. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify * @sa @ref glfwIconifyWindow * @sa @ref glfwMaximizeWindow * * @since Added in version 2.1. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwRestoreWindow(GLFWwindow* window); /*! @brief Maximizes the specified window. * * This function maximizes the specified window if it was previously not * maximized. If the window is already maximized, this function does nothing. * * If the specified window is a full screen window, this function does nothing. * * @param[in] window The window to maximize. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @par Thread Safety * This function may only be called from the main thread. * * @sa @ref window_iconify * @sa @ref glfwIconifyWindow * @sa @ref glfwRestoreWindow * * @since Added in GLFW 3.2. * * @ingroup window */ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); /*! @brief Makes the specified window visible. * * This function makes the specified window visible if it was previously * hidden. If the window is already visible or is in full screen mode, this * function does nothing. * * By default, windowed mode windows are focused when shown * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint * to change this behavior for all newly created windows, or change the * behavior for an existing window with @ref glfwSetWindowAttrib. * * @param[in] window The window to make visible. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_hide * @sa @ref glfwHideWindow * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwShowWindow(GLFWwindow* window); /*! @brief Hides the specified window. * * This function hides the specified window if it was previously visible. If * the window is already hidden or is in full screen mode, this function does * nothing. * * @param[in] window The window to hide. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_hide * @sa @ref glfwShowWindow * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwHideWindow(GLFWwindow* window); /*! @brief Brings the specified window to front and sets input focus. * * This function brings the specified window to front and sets input focus. * The window should already be visible and not iconified. * * By default, both windowed and full screen mode windows are focused when * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to * disable this behavior. * * Also by default, windowed mode windows are focused when shown * with @ref glfwShowWindow. Set the * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior. * * __Do not use this function__ to steal focus from other applications unless * you are certain that is what the user wants. Focus stealing can be * extremely disruptive. * * For a less disruptive way of getting the user's attention, see * [attention requests](@ref window_attention). * * @param[in] window The window to give input focus. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland It is not possible for an application to bring its windows * to front, this function will always emit @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_focus * @sa @ref window_attention * * @since Added in version 3.2. * * @ingroup window */ GLFWAPI void glfwFocusWindow(GLFWwindow* window); /*! @brief Requests user attention to the specified window. * * This function requests user attention to the specified window. On * platforms where this is not supported, attention is requested to the * application as a whole. * * Once the user has given attention, usually by focusing the window or * application, the system will end the request automatically. * * @param[in] window The window to request attention to. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @macos Attention is requested to the application as a whole, not the * specific window. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_attention * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); /*! @brief Returns the monitor that the window uses for full screen mode. * * This function returns the handle of the monitor that the specified window is * in full screen on. * * @param[in] window The window to query. * @return The monitor, or `NULL` if the window is in windowed mode or an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_monitor * @sa @ref glfwSetWindowMonitor * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); /*! @brief Sets the mode, monitor, video mode and placement of a window. * * This function sets the monitor that the window uses for full screen mode or, * if the monitor is `NULL`, makes it windowed mode. * * When setting a monitor, this function updates the width, height and refresh * rate of the desired video mode and switches to the video mode closest to it. * The window position is ignored when setting a monitor. * * When the monitor is `NULL`, the position, width and height are used to * place the window content area. The refresh rate is ignored when no monitor * is specified. * * If you only wish to update the resolution of a full screen window or the * size of a windowed mode window, see @ref glfwSetWindowSize. * * When a window transitions from full screen to windowed mode, this function * restores any previous window settings such as whether it is decorated, * floating, resizable, has size or aspect ratio limits, etc. * * @param[in] window The window whose monitor, size or video mode to set. * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. * @param[in] xpos The desired x-coordinate of the upper-left corner of the * content area. * @param[in] ypos The desired y-coordinate of the upper-left corner of the * content area. * @param[in] width The desired with, in screen coordinates, of the content * area or video mode. * @param[in] height The desired height, in screen coordinates, of the content * area or video mode. * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, * or `GLFW_DONT_CARE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise * affected by any resizing or mode switching, although you may need to update * your viewport if the framebuffer size has changed. * * @remark @wayland The desired window position is ignored, as there is no way * for an application to set this property. * * @remark @wayland Setting the window to full screen will not attempt to * change the mode, no matter what the requested size or refresh rate. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_monitor * @sa @ref window_full_screen * @sa @ref glfwGetWindowMonitor * @sa @ref glfwSetWindowSize * * @since Added in version 3.2. * * @ingroup window */ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); /*! @brief Returns an attribute of the specified window. * * This function returns the value of an attribute of the specified window or * its OpenGL or OpenGL ES context. * * @param[in] window The window to query. * @param[in] attrib The [window attribute](@ref window_attribs) whose value to * return. * @return The value of the attribute, or zero if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @remark Framebuffer related hints are not window attributes. See @ref * window_attribs_fb for more information. * * @remark Zero is a valid value for many window and context related * attributes so you cannot use a return value of zero as an indication of * errors. However, this function should not fail as long as it is passed * valid arguments and the library has been [initialized](@ref intro_init). * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_attribs * @sa @ref glfwSetWindowAttrib * * @since Added in version 3.0. Replaces `glfwGetWindowParam` and * `glfwGetGLVersion`. * * @ingroup window */ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); /*! @brief Sets an attribute of the specified window. * * This function sets the value of an attribute of the specified window. * * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). * * Some of these attributes are ignored for full screen windows. The new * value will take effect if the window is later made windowed. * * Some of these attributes are ignored for windowed mode windows. The new * value will take effect if the window is later made full screen. * * @param[in] window The window to set the attribute for. * @param[in] attrib A supported window attribute. * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @remark Calling @ref glfwGetWindowAttrib will always return the latest * value, even if that value is ignored by the current mode of the window. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_attribs * @sa @ref glfwGetWindowAttrib * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); /*! @brief Sets the user pointer of the specified window. * * This function sets the user-defined pointer of the specified window. The * current value is retained until the window is destroyed. The initial value * is `NULL`. * * @param[in] window The window whose pointer to set. * @param[in] pointer The new value. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref window_userptr * @sa @ref glfwGetWindowUserPointer * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); /*! @brief Returns the user pointer of the specified window. * * This function returns the current value of the user-defined pointer of the * specified window. The initial value is `NULL`. * * @param[in] window The window whose pointer to return. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref window_userptr * @sa @ref glfwSetWindowUserPointer * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); /*! @brief Sets the position callback for the specified window. * * This function sets the position callback of the specified window, which is * called when the window is moved. The callback is provided with the * position, in screen coordinates, of the upper-left corner of the content * area of the window. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int xpos, int ypos) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowposfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @remark @wayland This callback will never be called, as there is no way for * an application to know its global position. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_pos * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback); /*! @brief Sets the size callback for the specified window. * * This function sets the size callback of the specified window, which is * called when the window is resized. The callback is provided with the size, * in screen coordinates, of the content area of the window. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int width, int height) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowsizefun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_size * * @since Added in version 1.0. * @glfw3 Added window handle parameter and return value. * * @ingroup window */ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback); /*! @brief Sets the close callback for the specified window. * * This function sets the close callback of the specified window, which is * called when the user attempts to close the window, for example by clicking * the close widget in the title bar. * * The close flag is set before this callback is called, but you can modify it * at any time with @ref glfwSetWindowShouldClose. * * The close callback is not triggered by @ref glfwDestroyWindow. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowclosefun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @remark @macos Selecting Quit from the application menu will trigger the * close callback for all windows. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_close * * @since Added in version 2.5. * @glfw3 Added window handle parameter and return value. * * @ingroup window */ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback); /*! @brief Sets the refresh callback for the specified window. * * This function sets the refresh callback of the specified window, which is * called when the content area of the window needs to be redrawn, for example * if the window has been exposed after having been covered by another window. * * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where * the window contents are saved off-screen, this callback may be called only * very infrequently or never at all. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window); * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowrefreshfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_refresh * * @since Added in version 2.5. * @glfw3 Added window handle parameter and return value. * * @ingroup window */ GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback); /*! @brief Sets the focus callback for the specified window. * * This function sets the focus callback of the specified window, which is * called when the window gains or loses input focus. * * After the focus callback is called for a window that lost input focus, * synthetic key and mouse button release events will be generated for all such * that had been pressed. For more information, see @ref glfwSetKeyCallback * and @ref glfwSetMouseButtonCallback. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int focused) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowfocusfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_focus * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback); /*! @brief Sets the iconify callback for the specified window. * * This function sets the iconification callback of the specified window, which * is called when the window is iconified or restored. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int iconified) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowiconifyfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @remark @wayland The wl_shell protocol has no concept of iconification, * this callback will never be called when using this deprecated protocol. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback); /*! @brief Sets the maximize callback for the specified window. * * This function sets the maximization callback of the specified window, which * is called when the window is maximized or restored. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int maximized) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowmaximizefun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_maximize * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback); /*! @brief Sets the framebuffer resize callback for the specified window. * * This function sets the framebuffer resize callback of the specified window, * which is called when the framebuffer of the specified window is resized. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int width, int height) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWframebuffersizefun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_fbsize * * @since Added in version 3.0. * * @ingroup window */ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback); /*! @brief Sets the window content scale callback for the specified window. * * This function sets the window content scale callback of the specified window, * which is called when the content scale of the specified window changes. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, float xscale, float yscale) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWwindowcontentscalefun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_scale * @sa @ref glfwGetWindowContentScale * * @since Added in version 3.3. * * @ingroup window */ GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback); /*! @brief Processes all pending events. * * This function processes only those events that are already in the event * queue and then returns immediately. Processing events will cause the window * and input callbacks associated with those events to be called. * * On some platforms, a window move, resize or menu operation will cause event * processing to block. This is due to how event processing is designed on * those platforms. You can use the * [window refresh callback](@ref window_refresh) to redraw the contents of * your window when necessary during such operations. * * Do not assume that callbacks you set will _only_ be called in response to * event processing functions like this one. While it is necessary to poll for * events, window systems that require GLFW to register callbacks of its own * can pass events to GLFW in response to many window system function calls. * GLFW will pass those events on to the application callbacks before * returning. * * Event processing is not required for joystick input to work. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. * * @sa @ref events * @sa @ref glfwWaitEvents * @sa @ref glfwWaitEventsTimeout * * @since Added in version 1.0. * * @ingroup window */ GLFWAPI void glfwPollEvents(void); /*! @brief Waits until events are queued and processes them. * * This function puts the calling thread to sleep until at least one event is * available in the event queue. Once one or more events are available, * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue * are processed and the function then returns immediately. Processing events * will cause the window and input callbacks associated with those events to be * called. * * Since not all events are associated with callbacks, this function may return * without a callback having been called even if you are monitoring all * callbacks. * * On some platforms, a window move, resize or menu operation will cause event * processing to block. This is due to how event processing is designed on * those platforms. You can use the * [window refresh callback](@ref window_refresh) to redraw the contents of * your window when necessary during such operations. * * Do not assume that callbacks you set will _only_ be called in response to * event processing functions like this one. While it is necessary to poll for * events, window systems that require GLFW to register callbacks of its own * can pass events to GLFW in response to many window system function calls. * GLFW will pass those events on to the application callbacks before * returning. * * Event processing is not required for joystick input to work. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. * * @sa @ref events * @sa @ref glfwPollEvents * @sa @ref glfwWaitEventsTimeout * * @since Added in version 2.5. * * @ingroup window */ GLFWAPI void glfwWaitEvents(void); /*! @brief Waits with timeout until events are queued and processes them. * * This function puts the calling thread to sleep until at least one event is * available in the event queue, or until the specified timeout is reached. If * one or more events are available, it behaves exactly like @ref * glfwPollEvents, i.e. the events in the queue are processed and the function * then returns immediately. Processing events will cause the window and input * callbacks associated with those events to be called. * * The timeout value must be a positive finite number. * * Since not all events are associated with callbacks, this function may return * without a callback having been called even if you are monitoring all * callbacks. * * On some platforms, a window move, resize or menu operation will cause event * processing to block. This is due to how event processing is designed on * those platforms. You can use the * [window refresh callback](@ref window_refresh) to redraw the contents of * your window when necessary during such operations. * * Do not assume that callbacks you set will _only_ be called in response to * event processing functions like this one. While it is necessary to poll for * events, window systems that require GLFW to register callbacks of its own * can pass events to GLFW in response to many window system function calls. * GLFW will pass those events on to the application callbacks before * returning. * * Event processing is not required for joystick input to work. * * @param[in] timeout The maximum amount of time, in seconds, to wait. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. * * @sa @ref events * @sa @ref glfwPollEvents * @sa @ref glfwWaitEvents * * @since Added in version 3.2. * * @ingroup window */ GLFWAPI void glfwWaitEventsTimeout(double timeout); /*! @brief Posts an empty event to the event queue. * * This function posts an empty event from the current thread to the event * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function may be called from any thread. * * @sa @ref events * @sa @ref glfwWaitEvents * @sa @ref glfwWaitEventsTimeout * * @since Added in version 3.1. * * @ingroup window */ GLFWAPI void glfwPostEmptyEvent(void); /*! @brief Returns the value of an input option for the specified window. * * This function returns the value of an input option for the specified window. * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or * @ref GLFW_RAW_MOUSE_MOTION. * * @param[in] window The window to query. * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or * `GLFW_RAW_MOUSE_MOTION`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @thread_safety This function must only be called from the main thread. * * @sa @ref glfwSetInputMode * * @since Added in version 3.0. * * @ingroup input */ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); /*! @brief Sets an input option for the specified window. * * This function sets an input mode option for the specified window. The mode * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or * @ref GLFW_RAW_MOUSE_MOTION. * * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor * modes: * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the * content area of the window but does not restrict the cursor from leaving. * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual * and unlimited cursor movement. This is useful for implementing for * example 3D camera controls. * * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` * the next time it is called even if the key had been released before the * call. This is useful when you are only interested in whether keys have been * pressed but not when or in which order. * * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. * If sticky mouse buttons are enabled, a mouse button press will ensure that * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even * if the mouse button had been released before the call. This is useful when * you are only interested in whether mouse buttons have been pressed but not * when or in which order. * * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, * callbacks that receive modifier bits will also have the @ref * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. * * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE` * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported, * attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref * glfwRawMouseMotionSupported to check for support. * * @param[in] window The window whose input mode to set. * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or * `GLFW_RAW_MOUSE_MOTION`. * @param[in] value The new value of the specified input mode. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref glfwGetInputMode * * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. * * @ingroup input */ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); /*! @brief Returns whether raw mouse motion is supported. * * This function returns whether raw mouse motion is supported on the current * system. This status does not change after GLFW has been initialized so you * only need to check this once. If you attempt to enable raw motion on * a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted. * * Raw mouse motion is closer to the actual motion of the mouse across * a surface. It is not affected by the scaling and acceleration applied to * the motion of the desktop cursor. That processing is suitable for a cursor * while raw motion is better for controlling for example a 3D camera. Because * of this, raw mouse motion is only provided when the cursor is disabled. * * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine, * or `GLFW_FALSE` otherwise. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref raw_mouse_motion * @sa @ref glfwSetInputMode * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI int glfwRawMouseMotionSupported(void); /*! @brief Returns the layout-specific name of the specified printable key. * * This function returns the name of the specified printable key, encoded as * UTF-8. This is typically the character that key would produce without any * modifier keys, intended for displaying key bindings to the user. For dead * keys, it is typically the diacritic it would add to a character. * * __Do not use this function__ for [text input](@ref input_char). You will * break text input for many languages even if it happens to work for yours. * * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, * otherwise the scancode is ignored. If you specify a non-printable key, or * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this * function returns `NULL` but does not emit an error. * * This behavior allows you to always pass in the arguments in the * [key callback](@ref input_key) without modification. * * The printable keys are: * - `GLFW_KEY_APOSTROPHE` * - `GLFW_KEY_COMMA` * - `GLFW_KEY_MINUS` * - `GLFW_KEY_PERIOD` * - `GLFW_KEY_SLASH` * - `GLFW_KEY_SEMICOLON` * - `GLFW_KEY_EQUAL` * - `GLFW_KEY_LEFT_BRACKET` * - `GLFW_KEY_RIGHT_BRACKET` * - `GLFW_KEY_BACKSLASH` * - `GLFW_KEY_WORLD_1` * - `GLFW_KEY_WORLD_2` * - `GLFW_KEY_0` to `GLFW_KEY_9` * - `GLFW_KEY_A` to `GLFW_KEY_Z` * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` * - `GLFW_KEY_KP_DECIMAL` * - `GLFW_KEY_KP_DIVIDE` * - `GLFW_KEY_KP_MULTIPLY` * - `GLFW_KEY_KP_SUBTRACT` * - `GLFW_KEY_KP_ADD` * - `GLFW_KEY_KP_EQUAL` * * Names for printable keys depend on keyboard layout, while names for * non-printable keys are the same across layouts but depend on the application * language and should be localized along with other user interface text. * * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. * @param[in] scancode The scancode of the key to query. * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark The contents of the returned string may change when a keyboard * layout change event is received. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_key_name * * @since Added in version 3.2. * * @ingroup input */ GLFWAPI const char* glfwGetKeyName(int key, int scancode); /*! @brief Returns the platform-specific scancode of the specified key. * * This function returns the platform-specific scancode of the specified key. * * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this * method will return `-1`. * * @param[in] key Any [named key](@ref keys). * @return The platform-specific scancode for the key, or `-1` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function may be called from any thread. * * @sa @ref input_key * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI int glfwGetKeyScancode(int key); /*! @brief Returns the last reported state of a keyboard key for the specified * window. * * This function returns the last state reported for the specified key to the * specified window. The returned state is one of `GLFW_PRESS` or * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to * the key callback. * * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns * `GLFW_PRESS` the first time you call it for a key that was pressed, even if * that key has already been released. * * The key functions deal with physical keys, with [key tokens](@ref keys) * named after their use on the standard US keyboard layout. If you want to * input text, use the Unicode character callback instead. * * The [modifier key bit masks](@ref mods) are not key tokens and cannot be * used with this function. * * __Do not use this function__ to implement [text input](@ref input_char). * * @param[in] window The desired window. * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is * not a valid key for this function. * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_key * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup input */ GLFWAPI int glfwGetKey(GLFWwindow* window, int key); /*! @brief Returns the last reported state of a mouse button for the specified * window. * * This function returns the last state reported for the specified mouse button * to the specified window. The returned state is one of `GLFW_PRESS` or * `GLFW_RELEASE`. * * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function * returns `GLFW_PRESS` the first time you call it for a mouse button that was * pressed, even if that mouse button has already been released. * * @param[in] window The desired window. * @param[in] button The desired [mouse button](@ref buttons). * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_mouse_button * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup input */ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); /*! @brief Retrieves the position of the cursor relative to the content area of * the window. * * This function returns the position of the cursor, in screen coordinates, * relative to the upper-left corner of the content area of the specified * window. * * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor * position is unbounded and limited only by the minimum and maximum values of * a `double`. * * The coordinate can be converted to their integer equivalents with the * `floor` function. Casting directly to an integer type works for positive * coordinates, but fails for negative ones. * * Any or all of the position arguments may be `NULL`. If an error occurs, all * non-`NULL` position arguments will be set to zero. * * @param[in] window The desired window. * @param[out] xpos Where to store the cursor x-coordinate, relative to the * left edge of the content area, or `NULL`. * @param[out] ypos Where to store the cursor y-coordinate, relative to the to * top edge of the content area, or `NULL`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_pos * @sa @ref glfwSetCursorPos * * @since Added in version 3.0. Replaces `glfwGetMousePos`. * * @ingroup input */ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); /*! @brief Sets the position of the cursor, relative to the content area of the * window. * * This function sets the position, in screen coordinates, of the cursor * relative to the upper-left corner of the content area of the specified * window. The window must have input focus. If the window does not have * input focus when this function is called, it fails silently. * * __Do not use this function__ to implement things like camera controls. GLFW * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the * cursor, transparently re-centers it and provides unconstrained cursor * motion. See @ref glfwSetInputMode for more information. * * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is * unconstrained and limited only by the minimum and maximum values of * a `double`. * * @param[in] window The desired window. * @param[in] xpos The desired x-coordinate, relative to the left edge of the * content area. * @param[in] ypos The desired y-coordinate, relative to the top edge of the * content area. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @remark @wayland This function will only work when the cursor mode is * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_pos * @sa @ref glfwGetCursorPos * * @since Added in version 3.0. Replaces `glfwSetMousePos`. * * @ingroup input */ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); /*! @brief Creates a custom cursor. * * Creates a new custom cursor image that can be set for a window with @ref * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. * Any remaining cursors are destroyed by @ref glfwTerminate. * * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight * bits per channel with the red channel first. They are arranged canonically * as packed sequential rows, starting from the top-left corner. * * The cursor hotspot is specified in pixels, relative to the upper-left corner * of the cursor image. Like all other coordinate systems in GLFW, the X-axis * points to the right and the Y-axis points down. * * @param[in] image The desired cursor image. * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot. * @return The handle of the created cursor, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified image data is copied before this function * returns. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_object * @sa @ref glfwDestroyCursor * @sa @ref glfwCreateStandardCursor * * @since Added in version 3.1. * * @ingroup input */ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); /*! @brief Creates a cursor with a standard shape. * * Returns a cursor with a [standard shape](@ref shapes), that can be set for * a window with @ref glfwSetCursor. * * @param[in] shape One of the [standard shapes](@ref shapes). * @return A new cursor ready to use or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_object * @sa @ref glfwCreateCursor * * @since Added in version 3.1. * * @ingroup input */ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); /*! @brief Destroys a cursor. * * This function destroys a cursor previously created with @ref * glfwCreateCursor. Any remaining cursors will be destroyed by @ref * glfwTerminate. * * If the specified cursor is current for any window, that window will be * reverted to the default cursor. This does not affect the cursor mode. * * @param[in] cursor The cursor object to destroy. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_object * @sa @ref glfwCreateCursor * * @since Added in version 3.1. * * @ingroup input */ GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); /*! @brief Sets the cursor for the window. * * This function sets the cursor image to be used when the cursor is over the * content area of the specified window. The set cursor will only be visible * when the [cursor mode](@ref cursor_mode) of the window is * `GLFW_CURSOR_NORMAL`. * * On some platforms, the set cursor may not be visible unless the window also * has input focus. * * @param[in] window The window to set the cursor for. * @param[in] cursor The cursor to set, or `NULL` to switch back to the default * arrow cursor. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_object * * @since Added in version 3.1. * * @ingroup input */ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); /*! @brief Sets the key callback. * * This function sets the key callback of the specified window, which is called * when a key is pressed, repeated or released. * * The key functions deal with physical keys, with layout independent * [key tokens](@ref keys) named after their values in the standard US keyboard * layout. If you want to input text, use the * [character callback](@ref glfwSetCharCallback) instead. * * When a window loses input focus, it will generate synthetic key release * events for all pressed keys. You can tell these events from user-generated * events by the fact that the synthetic ones are generated after the focus * loss event has been processed, i.e. after the * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. * * The scancode of a key is specific to that platform or sometimes even to that * machine. Scancodes are intended to allow users to bind keys that don't have * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their * state is not saved and so it cannot be queried with @ref glfwGetKey. * * Sometimes GLFW needs to generate synthetic key events, in which case the * scancode may be zero. * * @param[in] window The window whose callback to set. * @param[in] callback The new key callback, or `NULL` to remove the currently * set callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWkeyfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_key * * @since Added in version 1.0. * @glfw3 Added window handle parameter and return value. * * @ingroup input */ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback); /*! @brief Sets the Unicode character callback. * * This function sets the character callback of the specified window, which is * called when a Unicode character is input. * * The character callback is intended for Unicode text input. As it deals with * characters, it is keyboard layout dependent, whereas the * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 * to physical keys, as a key may produce zero, one or more characters. If you * want to know whether a specific physical key was pressed or released, see * the key callback instead. * * The character callback behaves as system text input normally does and will * not be called if modifier keys are held down that would prevent normal text * input on that platform, for example a Super (Command) key on macOS or Alt key * on Windows. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, unsigned int codepoint) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWcharfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_char * * @since Added in version 2.4. * @glfw3 Added window handle parameter and return value. * * @ingroup input */ GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback); /*! @brief Sets the Unicode character with modifiers callback. * * This function sets the character with modifiers callback of the specified * window, which is called when a Unicode character is input regardless of what * modifier keys are used. * * The character with modifiers callback is intended for implementing custom * Unicode character input. For regular Unicode text input, see the * [character callback](@ref glfwSetCharCallback). Like the character * callback, the character with modifiers callback deals with characters and is * keyboard layout dependent. Characters do not map 1:1 to physical keys, as * a key may produce zero, one or more characters. If you want to know whether * a specific physical key was pressed or released, see the * [key callback](@ref glfwSetKeyCallback) instead. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or an * [error](@ref error_handling) occurred. * * @callback_signature * @code * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWcharmodsfun). * * @deprecated Scheduled for removal in version 4.0. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_char * * @since Added in version 3.1. * * @ingroup input */ GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback); /*! @brief Sets the mouse button callback. * * This function sets the mouse button callback of the specified window, which * is called when a mouse button is pressed or released. * * When a window loses input focus, it will generate synthetic mouse button * release events for all pressed mouse buttons. You can tell these events * from user-generated events by the fact that the synthetic ones are generated * after the focus loss event has been processed, i.e. after the * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int button, int action, int mods) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWmousebuttonfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref input_mouse_button * * @since Added in version 1.0. * @glfw3 Added window handle parameter and return value. * * @ingroup input */ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback); /*! @brief Sets the cursor position callback. * * This function sets the cursor position callback of the specified window, * which is called when the cursor is moved. The callback is provided with the * position, in screen coordinates, relative to the upper-left corner of the * content area of the window. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, double xpos, double ypos); * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWcursorposfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_pos * * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. * * @ingroup input */ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback); /*! @brief Sets the cursor enter/leave callback. * * This function sets the cursor boundary crossing callback of the specified * window, which is called when the cursor enters or leaves the content area of * the window. * * @param[in] window The window whose callback to set. * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int entered) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWcursorenterfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref cursor_enter * * @since Added in version 3.0. * * @ingroup input */ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback); /*! @brief Sets the scroll callback. * * This function sets the scroll callback of the specified window, which is * called when a scrolling device is used, such as a mouse wheel or scrolling * area of a touchpad. * * The scroll callback receives all scrolling input, like that from a mouse * wheel or a touchpad scrolling area. * * @param[in] window The window whose callback to set. * @param[in] callback The new scroll callback, or `NULL` to remove the * currently set callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, double xoffset, double yoffset) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWscrollfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref scrolling * * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. * * @ingroup input */ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback); /*! @brief Sets the path drop callback. * * This function sets the path drop callback of the specified window, which is * called when one or more dragged paths are dropped on the window. * * Because the path array and its strings may have been generated specifically * for that event, they are not guaranteed to be valid after the callback has * returned. If you wish to use them after the callback returns, you need to * make a deep copy. * * @param[in] window The window whose callback to set. * @param[in] callback The new file drop callback, or `NULL` to remove the * currently set callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(GLFWwindow* window, int path_count, const char* paths[]) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWdropfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @remark @wayland File drop is currently unimplemented. * * @thread_safety This function must only be called from the main thread. * * @sa @ref path_drop * * @since Added in version 3.1. * * @ingroup input */ GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback); /*! @brief Returns whether the specified joystick is present. * * This function returns whether the specified joystick is present. * * There is no need to call this function before other functions that accept * a joystick ID, as they all check for presence before performing any other * work. * * @param[in] jid The [joystick](@ref joysticks) to query. * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function must only be called from the main thread. * * @sa @ref joystick * * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. * * @ingroup input */ GLFWAPI int glfwJoystickPresent(int jid); /*! @brief Returns the values of all axes of the specified joystick. * * This function returns the values of all axes of the specified joystick. * Each element in the array is a value between -1.0 and 1.0. * * If the specified joystick is not present this function will return `NULL` * but will not generate an error. This can be used instead of first calling * @ref glfwJoystickPresent. * * @param[in] jid The [joystick](@ref joysticks) to query. * @param[out] count Where to store the number of axis values in the returned * array. This is set to zero if the joystick is not present or an error * occurred. * @return An array of axis values, or `NULL` if the joystick is not present or * an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref joystick_axis * * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. * * @ingroup input */ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); /*! @brief Returns the state of all buttons of the specified joystick. * * This function returns the state of all buttons of the specified joystick. * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. * * For backward compatibility with earlier versions that did not have @ref * glfwGetJoystickHats, the button array also includes all hats, each * represented as four buttons. The hats are in the same order as returned by * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and * _left_. To disable these extra buttons, set the @ref * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. * * If the specified joystick is not present this function will return `NULL` * but will not generate an error. This can be used instead of first calling * @ref glfwJoystickPresent. * * @param[in] jid The [joystick](@ref joysticks) to query. * @param[out] count Where to store the number of button states in the returned * array. This is set to zero if the joystick is not present or an error * occurred. * @return An array of button states, or `NULL` if the joystick is not present * or an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref joystick_button * * @since Added in version 2.2. * @glfw3 Changed to return a dynamic array. * * @ingroup input */ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); /*! @brief Returns the state of all hats of the specified joystick. * * This function returns the state of all hats of the specified joystick. * Each element in the array is one of the following values: * * Name | Value * ---- | ----- * `GLFW_HAT_CENTERED` | 0 * `GLFW_HAT_UP` | 1 * `GLFW_HAT_RIGHT` | 2 * `GLFW_HAT_DOWN` | 4 * `GLFW_HAT_LEFT` | 8 * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` * * The diagonal directions are bitwise combinations of the primary (up, right, * down and left) directions and you can test for these individually by ANDing * it with the corresponding direction. * * @code * if (hats[2] & GLFW_HAT_RIGHT) * { * // State of hat 2 could be right-up, right or right-down * } * @endcode * * If the specified joystick is not present this function will return `NULL` * but will not generate an error. This can be used instead of first calling * @ref glfwJoystickPresent. * * @param[in] jid The [joystick](@ref joysticks) to query. * @param[out] count Where to store the number of hat states in the returned * array. This is set to zero if the joystick is not present or an error * occurred. * @return An array of hat states, or `NULL` if the joystick is not present * or an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected, this function is called again for that joystick or the library * is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref joystick_hat * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count); /*! @brief Returns the name of the specified joystick. * * This function returns the name, encoded as UTF-8, of the specified joystick. * The returned string is allocated and freed by GLFW. You should not free it * yourself. * * If the specified joystick is not present this function will return `NULL` * but will not generate an error. This can be used instead of first calling * @ref glfwJoystickPresent. * * @param[in] jid The [joystick](@ref joysticks) to query. * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick * is not present or an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref joystick_name * * @since Added in version 3.0. * * @ingroup input */ GLFWAPI const char* glfwGetJoystickName(int jid); /*! @brief Returns the SDL compatible GUID of the specified joystick. * * This function returns the SDL compatible GUID, as a UTF-8 encoded * hexadecimal string, of the specified joystick. The returned string is * allocated and freed by GLFW. You should not free it yourself. * * The GUID is what connects a joystick to a gamepad mapping. A connected * joystick will always have a GUID even if there is no gamepad mapping * assigned to it. * * If the specified joystick is not present this function will return `NULL` * but will not generate an error. This can be used instead of first calling * @ref glfwJoystickPresent. * * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to * uniquely identify the make and model of a joystick but does not identify * a specific unit, e.g. all wired Xbox 360 controllers will have the same * GUID on that platform. The GUID for a unit may vary between platforms * depending on what hardware information the platform specific APIs provide. * * @param[in] jid The [joystick](@ref joysticks) to query. * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick * is not present or an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref gamepad * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI const char* glfwGetJoystickGUID(int jid); /*! @brief Sets the user pointer of the specified joystick. * * This function sets the user-defined pointer of the specified joystick. The * current value is retained until the joystick is disconnected. The initial * value is `NULL`. * * This function may be called from the joystick callback, even for a joystick * that is being disconnected. * * @param[in] jid The joystick whose pointer to set. * @param[in] pointer The new value. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref joystick_userptr * @sa @ref glfwGetJoystickUserPointer * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer); /*! @brief Returns the user pointer of the specified joystick. * * This function returns the current value of the user-defined pointer of the * specified joystick. The initial value is `NULL`. * * This function may be called from the joystick callback, even for a joystick * that is being disconnected. * * @param[in] jid The joystick whose pointer to return. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @sa @ref joystick_userptr * @sa @ref glfwSetJoystickUserPointer * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI void* glfwGetJoystickUserPointer(int jid); /*! @brief Returns whether the specified joystick has a gamepad mapping. * * This function returns whether the specified joystick is both present and has * a gamepad mapping. * * If the specified joystick is present but does not have a gamepad mapping * this function will return `GLFW_FALSE` but will not generate an error. Call * @ref glfwJoystickPresent to check if a joystick is present regardless of * whether it has a mapping. * * @param[in] jid The [joystick](@ref joysticks) to query. * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, * or `GLFW_FALSE` otherwise. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @thread_safety This function must only be called from the main thread. * * @sa @ref gamepad * @sa @ref glfwGetGamepadState * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI int glfwJoystickIsGamepad(int jid); /*! @brief Sets the joystick configuration callback. * * This function sets the joystick configuration callback, or removes the * currently set callback. This is called when a joystick is connected to or * disconnected from the system. * * For joystick connection and disconnection events to be delivered on all * platforms, you need to call one of the [event processing](@ref events) * functions. Joystick disconnection may also be detected and the callback * called by joystick functions. The function will then return whatever it * returns if the joystick is not present. * * @param[in] callback The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set or the * library had not been [initialized](@ref intro_init). * * @callback_signature * @code * void function_name(int jid, int event) * @endcode * For more information about the callback parameters, see the * [function pointer type](@ref GLFWjoystickfun). * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function must only be called from the main thread. * * @sa @ref joystick_event * * @since Added in version 3.2. * * @ingroup input */ GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback); /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings. * * This function parses the specified ASCII encoded string and updates the * internal list with any gamepad mappings it finds. This string may * contain either a single gamepad mapping or many mappings separated by * newlines. The parser supports the full format of the `gamecontrollerdb.txt` * source file including empty lines and comments. * * See @ref gamepad_mapping for a description of the format. * * If there is already a gamepad mapping for a given GUID in the internal list, * it will be replaced by the one passed to this function. If the library is * terminated and re-initialized the internal list will revert to the built-in * default. * * @param[in] string The string containing the gamepad mappings. * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_VALUE. * * @thread_safety This function must only be called from the main thread. * * @sa @ref gamepad * @sa @ref glfwJoystickIsGamepad * @sa @ref glfwGetGamepadName * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI int glfwUpdateGamepadMappings(const char* string); /*! @brief Returns the human-readable gamepad name for the specified joystick. * * This function returns the human-readable name of the gamepad from the * gamepad mapping assigned to the specified joystick. * * If the specified joystick is not present or does not have a gamepad mapping * this function will return `NULL` but will not generate an error. Call * @ref glfwJoystickPresent to check whether it is present regardless of * whether it has a mapping. * * @param[in] jid The [joystick](@ref joysticks) to query. * @return The UTF-8 encoded name of the gamepad, or `NULL` if the * joystick is not present, does not have a mapping or an * [error](@ref error_handling) occurred. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected, the gamepad mappings are updated or the library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref gamepad * @sa @ref glfwJoystickIsGamepad * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI const char* glfwGetGamepadName(int jid); /*! @brief Retrieves the state of the specified joystick remapped as a gamepad. * * This function retrieves the state of the specified joystick remapped to * an Xbox-like gamepad. * * If the specified joystick is not present or does not have a gamepad mapping * this function will return `GLFW_FALSE` but will not generate an error. Call * @ref glfwJoystickPresent to check whether it is present regardless of * whether it has a mapping. * * The Guide button may not be available for input as it is often hooked by the * system or the Steam client. * * Not all devices have all the buttons or axes provided by @ref * GLFWgamepadstate. Unavailable buttons and axes will always report * `GLFW_RELEASE` and 0.0 respectively. * * @param[in] jid The [joystick](@ref joysticks) to query. * @param[out] state The gamepad input state of the joystick. * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is * connected, it has no gamepad mapping or an [error](@ref error_handling) * occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * * @thread_safety This function must only be called from the main thread. * * @sa @ref gamepad * @sa @ref glfwUpdateGamepadMappings * @sa @ref glfwJoystickIsGamepad * * @since Added in version 3.3. * * @ingroup input */ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); /*! @brief Sets the clipboard to the specified string. * * This function sets the system clipboard to the specified, UTF-8 encoded * string. * * @param[in] window Deprecated. Any valid window or `NULL`. * @param[in] string A UTF-8 encoded string. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified string is copied before this function * returns. * * @thread_safety This function must only be called from the main thread. * * @sa @ref clipboard * @sa @ref glfwGetClipboardString * * @since Added in version 3.0. * * @ingroup input */ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); /*! @brief Returns the contents of the clipboard as a string. * * This function returns the contents of the system clipboard, if it contains * or is convertible to a UTF-8 encoded string. If the clipboard is empty or * if its contents cannot be converted, `NULL` is returned and a @ref * GLFW_FORMAT_UNAVAILABLE error is generated. * * @param[in] window Deprecated. Any valid window or `NULL`. * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` * if an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the next call to @ref * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library * is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref clipboard * @sa @ref glfwSetClipboardString * * @since Added in version 3.0. * * @ingroup input */ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); /*! @brief Returns the GLFW time. * * This function returns the current GLFW time, in seconds. Unless the time * has been set using @ref glfwSetTime it measures time elapsed since GLFW was * initialized. * * This function and @ref glfwSetTime are helper functions on top of @ref * glfwGetTimerFrequency and @ref glfwGetTimerValue. * * The resolution of the timer is system dependent, but is usually on the order * of a few micro- or nanoseconds. It uses the highest-resolution monotonic * time source on each supported platform. * * @return The current time, in seconds, or zero if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. Reading and * writing of the internal base time is not atomic, so it needs to be * externally synchronized with calls to @ref glfwSetTime. * * @sa @ref time * * @since Added in version 1.0. * * @ingroup input */ GLFWAPI double glfwGetTime(void); /*! @brief Sets the GLFW time. * * This function sets the current GLFW time, in seconds. The value must be * a positive finite number less than or equal to 18446744073.0, which is * approximately 584.5 years. * * This function and @ref glfwGetTime are helper functions on top of @ref * glfwGetTimerFrequency and @ref glfwGetTimerValue. * * @param[in] time The new value, in seconds. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_VALUE. * * @remark The upper limit of GLFW time is calculated as * floor((264 - 1) / 109) and is due to implementations * storing nanoseconds in 64 bits. The limit may be increased in the future. * * @thread_safety This function may be called from any thread. Reading and * writing of the internal base time is not atomic, so it needs to be * externally synchronized with calls to @ref glfwGetTime. * * @sa @ref time * * @since Added in version 2.2. * * @ingroup input */ GLFWAPI void glfwSetTime(double time); /*! @brief Returns the current value of the raw timer. * * This function returns the current value of the raw timer, measured in * 1 / frequency seconds. To get the frequency, call @ref * glfwGetTimerFrequency. * * @return The value of the timer, or zero if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. * * @sa @ref time * @sa @ref glfwGetTimerFrequency * * @since Added in version 3.2. * * @ingroup input */ GLFWAPI uint64_t glfwGetTimerValue(void); /*! @brief Returns the frequency, in Hz, of the raw timer. * * This function returns the frequency, in Hz, of the raw timer. * * @return The frequency of the timer, in Hz, or zero if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. * * @sa @ref time * @sa @ref glfwGetTimerValue * * @since Added in version 3.2. * * @ingroup input */ GLFWAPI uint64_t glfwGetTimerFrequency(void); /*! @brief Makes the context of the specified window current for the calling * thread. * * This function makes the OpenGL or OpenGL ES context of the specified window * current on the calling thread. A context must only be made current on * a single thread at a time and each thread can have only a single current * context at a time. * * When moving a context between threads, you must make it non-current on the * old thread before making it current on the new one. * * By default, making a context non-current implicitly forces a pipeline flush. * On machines that support `GL_KHR_context_flush_control`, you can control * whether a context performs this flush by setting the * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) * hint. * * The specified window must have an OpenGL or OpenGL ES context. Specifying * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT * error. * * @param[in] window The window whose context to make current, or `NULL` to * detach the current context. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. * * @thread_safety This function may be called from any thread. * * @sa @ref context_current * @sa @ref glfwGetCurrentContext * * @since Added in version 3.0. * * @ingroup context */ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); /*! @brief Returns the window whose context is current on the calling thread. * * This function returns the window whose OpenGL or OpenGL ES context is * current on the calling thread. * * @return The window whose context is current, or `NULL` if no window's * context is current. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. * * @sa @ref context_current * @sa @ref glfwMakeContextCurrent * * @since Added in version 3.0. * * @ingroup context */ GLFWAPI GLFWwindow* glfwGetCurrentContext(void); /*! @brief Swaps the front and back buffers of the specified window. * * This function swaps the front and back buffers of the specified window when * rendering with OpenGL or OpenGL ES. If the swap interval is greater than * zero, the GPU driver waits the specified number of screen updates before * swapping the buffers. * * The specified window must have an OpenGL or OpenGL ES context. Specifying * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT * error. * * This function does not apply to Vulkan. If you are rendering with Vulkan, * see `vkQueuePresentKHR` instead. * * @param[in] window The window whose buffers to swap. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. * * @remark __EGL:__ The context of the specified window must be current on the * calling thread. * * @thread_safety This function may be called from any thread. * * @sa @ref buffer_swap * @sa @ref glfwSwapInterval * * @since Added in version 1.0. * @glfw3 Added window handle parameter. * * @ingroup window */ GLFWAPI void glfwSwapBuffers(GLFWwindow* window); /*! @brief Sets the swap interval for the current context. * * This function sets the swap interval for the current OpenGL or OpenGL ES * context, i.e. the number of screen updates to wait from the time @ref * glfwSwapBuffers was called before swapping the buffers and returning. This * is sometimes called _vertical synchronization_, _vertical retrace * synchronization_ or just _vsync_. * * A context that supports either of the `WGL_EXT_swap_control_tear` and * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap * intervals, which allows the driver to swap immediately even if a frame * arrives a little bit late. You can check for these extensions with @ref * glfwExtensionSupported. * * A context must be current on the calling thread. Calling this function * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. * * This function does not apply to Vulkan. If you are rendering with Vulkan, * see the present mode of your swapchain instead. * * @param[in] interval The minimum number of screen updates to wait for * until the buffers are swapped by @ref glfwSwapBuffers. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. * * @remark This function is not called during context creation, leaving the * swap interval set to whatever is the default on that platform. This is done * because some swap interval extensions used by GLFW do not allow the swap * interval to be reset to zero once it has been set to a non-zero value. * * @remark Some GPU drivers do not honor the requested swap interval, either * because of a user setting that overrides the application's request or due to * bugs in the driver. * * @thread_safety This function may be called from any thread. * * @sa @ref buffer_swap * @sa @ref glfwSwapBuffers * * @since Added in version 1.0. * * @ingroup context */ GLFWAPI void glfwSwapInterval(int interval); /*! @brief Returns whether the specified extension is available. * * This function returns whether the specified * [API extension](@ref context_glext) is supported by the current OpenGL or * OpenGL ES context. It searches both for client API extension and context * creation API extensions. * * A context must be current on the calling thread. Calling this function * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. * * As this functions retrieves and searches one or more extension strings each * call, it is recommended that you cache its results if it is going to be used * frequently. The extension strings will not change during the lifetime of * a context, so there is no danger in doing this. * * This function does not apply to Vulkan. If you are using Vulkan, see @ref * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` * and `vkEnumerateDeviceExtensionProperties` instead. * * @param[in] extension The ASCII encoded name of the extension. * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` * otherwise. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref * GLFW_PLATFORM_ERROR. * * @thread_safety This function may be called from any thread. * * @sa @ref context_glext * @sa @ref glfwGetProcAddress * * @since Added in version 1.0. * * @ingroup context */ GLFWAPI int glfwExtensionSupported(const char* extension); /*! @brief Returns the address of the specified function for the current * context. * * This function returns the address of the specified OpenGL or OpenGL ES * [core or extension function](@ref context_glext), if it is supported * by the current context. * * A context must be current on the calling thread. Calling this function * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. * * This function does not apply to Vulkan. If you are rendering with Vulkan, * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and * `vkGetDeviceProcAddr` instead. * * @param[in] procname The ASCII encoded name of the function. * @return The address of the function, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. * * @remark The address of a given function is not guaranteed to be the same * between contexts. * * @remark This function may return a non-`NULL` address despite the * associated version or extension not being available. Always check the * context version or extension string first. * * @pointer_lifetime The returned function pointer is valid until the context * is destroyed or the library is terminated. * * @thread_safety This function may be called from any thread. * * @sa @ref context_glext * @sa @ref glfwExtensionSupported * * @since Added in version 1.0. * * @ingroup context */ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); /*! @brief Returns whether the Vulkan loader and an ICD have been found. * * This function returns whether the Vulkan loader and any minimally functional * ICD have been found. * * The availability of a Vulkan loader and even an ICD does not by itself * guarantee that surface creation or even instance creation is possible. * For example, on Fermi systems Nvidia will install an ICD that provides no * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check * whether the extensions necessary for Vulkan surface creation are available * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue * family of a physical device supports image presentation. * * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` * otherwise. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * * @thread_safety This function may be called from any thread. * * @sa @ref vulkan_support * * @since Added in version 3.2. * * @ingroup vulkan */ GLFWAPI int glfwVulkanSupported(void); /*! @brief Returns the Vulkan instance extensions required by GLFW. * * This function returns an array of names of Vulkan instance extensions required * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the * list will always contain `VK_KHR_surface`, so if you don't require any * additional extensions you can pass this list directly to the * `VkInstanceCreateInfo` struct. * * If Vulkan is not available on the machine, this function returns `NULL` and * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported * to check whether Vulkan is at least minimally available. * * If Vulkan is available but no set of extensions allowing window surface * creation was found, this function returns `NULL`. You may still use Vulkan * for off-screen rendering and compute work. * * @param[out] count Where to store the number of extensions in the returned * array. This is set to zero if an error occurred. * @return An array of ASCII encoded extension names, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_API_UNAVAILABLE. * * @remark Additional extensions may be required by future versions of GLFW. * You should check if any extensions you wish to enable are already in the * returned array, as it is an error to specify an extension more than once in * the `VkInstanceCreateInfo` struct. * * @remark @macos This function currently supports either the * `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface` * extension. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is guaranteed to be valid only until the * library is terminated. * * @thread_safety This function may be called from any thread. * * @sa @ref vulkan_ext * @sa @ref glfwCreateWindowSurface * * @since Added in version 3.2. * * @ingroup vulkan */ GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); #if defined(VK_VERSION_1_0) /*! @brief Returns the address of the specified Vulkan instance function. * * This function returns the address of the specified Vulkan core or extension * function for the specified instance. If instance is set to `NULL` it can * return any function exported from the Vulkan loader, including at least the * following functions: * * - `vkEnumerateInstanceExtensionProperties` * - `vkEnumerateInstanceLayerProperties` * - `vkCreateInstance` * - `vkGetInstanceProcAddr` * * If Vulkan is not available on the machine, this function returns `NULL` and * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported * to check whether Vulkan is at least minimally available. * * This function is equivalent to calling `vkGetInstanceProcAddr` with * a platform-specific query of the Vulkan loader as a fallback. * * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve * functions related to instance creation. * @param[in] procname The ASCII encoded name of the function. * @return The address of the function, or `NULL` if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_API_UNAVAILABLE. * * @pointer_lifetime The returned function pointer is valid until the library * is terminated. * * @thread_safety This function may be called from any thread. * * @sa @ref vulkan_proc * * @since Added in version 3.2. * * @ingroup vulkan */ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); /*! @brief Returns whether the specified queue family can present images. * * This function returns whether the specified queue family of the specified * physical device supports presentation to the platform GLFW was built for. * * If Vulkan or the required window surface creation instance extensions are * not available on the machine, or if the specified instance was not created * with the required extensions, this function returns `GLFW_FALSE` and * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported * to check whether Vulkan is at least minimally available and @ref * glfwGetRequiredInstanceExtensions to check what instance extensions are * required. * * @param[in] instance The instance that the physical device belongs to. * @param[in] device The physical device that the queue family belongs to. * @param[in] queuefamily The index of the queue family to query. * @return `GLFW_TRUE` if the queue family supports presentation, or * `GLFW_FALSE` otherwise. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * * @remark @macos This function currently always returns `GLFW_TRUE`, as the * `VK_MVK_macos_surface` extension does not provide * a `vkGetPhysicalDevice*PresentationSupport` type function. * * @thread_safety This function may be called from any thread. For * synchronization details of Vulkan objects, see the Vulkan specification. * * @sa @ref vulkan_present * * @since Added in version 3.2. * * @ingroup vulkan */ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); /*! @brief Creates a Vulkan surface for the specified window. * * This function creates a Vulkan surface for the specified window. * * If the Vulkan loader or at least one minimally functional ICD were not found, * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether * Vulkan is at least minimally available. * * If the required window surface creation instance extensions are not * available or if the specified instance was not created with these extensions * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref * glfwGetRequiredInstanceExtensions to check what instance extensions are * required. * * The window surface cannot be shared with another API so the window must * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib) * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`. * * The window surface must be destroyed before the specified Vulkan instance. * It is the responsibility of the caller to destroy the window surface. GLFW * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the * surface. * * @param[in] instance The Vulkan instance to create the surface in. * @param[in] window The window to create the surface for. * @param[in] allocator The allocator to use, or `NULL` to use the default * allocator. * @param[out] surface Where to store the handle of the surface. This is set * to `VK_NULL_HANDLE` if an error occurred. * @return `VK_SUCCESS` if successful, or a Vulkan error code if an * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE * * @remark If an error occurs before the creation call is made, GLFW returns * the Vulkan error code most appropriate for the error. Appropriate use of * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should * eliminate almost all occurrences of these errors. * * @remark @macos This function currently only supports the * `VK_MVK_macos_surface` extension from MoltenVK. * * @remark @macos This function creates and sets a `CAMetalLayer` instance for * the window content view, which is required for MoltenVK to function. * * @thread_safety This function may be called from any thread. For * synchronization details of Vulkan objects, see the Vulkan specification. * * @sa @ref vulkan_surface * @sa @ref glfwGetRequiredInstanceExtensions * * @since Added in version 3.2. * * @ingroup vulkan */ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); #endif /*VK_VERSION_1_0*/ /************************************************************************* * Global definition cleanup *************************************************************************/ /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ #ifdef GLFW_WINGDIAPI_DEFINED #undef WINGDIAPI #undef GLFW_WINGDIAPI_DEFINED #endif #ifdef GLFW_CALLBACK_DEFINED #undef CALLBACK #undef GLFW_CALLBACK_DEFINED #endif /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally * defined by some gl.h variants (OpenBSD) so define it after if needed. */ #ifndef GLAPIENTRY #define GLAPIENTRY APIENTRY #endif /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ #ifdef __cplusplus } #endif #endif /* _glfw3_h_ */ ================================================ FILE: thirdparty/glfw/include/GLFW/glfw3native.h ================================================ /************************************************************************* * GLFW 3.3 - www.glfw.org * A library for OpenGL, window and input *------------------------------------------------------------------------ * Copyright (c) 2002-2006 Marcus Geelnard * Copyright (c) 2006-2018 Camilla Löwy * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would * be appreciated but is not required. * * 2. Altered source versions must be plainly marked as 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 _glfw3_native_h_ #define _glfw3_native_h_ #ifdef __cplusplus extern "C" { #endif /************************************************************************* * Doxygen documentation *************************************************************************/ /*! @file glfw3native.h * @brief The header of the native access functions. * * This is the header file of the native access functions. See @ref native for * more information. */ /*! @defgroup native Native access * @brief Functions related to accessing native handles. * * **By using the native access functions you assert that you know what you're * doing and how to fix problems caused by using them. If you don't, you * shouldn't be using them.** * * Before the inclusion of @ref glfw3native.h, you may define zero or more * window system API macro and zero or more context creation API macros. * * The chosen backends must match those the library was compiled for. Failure * to do this will cause a link-time error. * * The available window API macros are: * * `GLFW_EXPOSE_NATIVE_WIN32` * * `GLFW_EXPOSE_NATIVE_COCOA` * * `GLFW_EXPOSE_NATIVE_X11` * * `GLFW_EXPOSE_NATIVE_WAYLAND` * * The available context API macros are: * * `GLFW_EXPOSE_NATIVE_WGL` * * `GLFW_EXPOSE_NATIVE_NSGL` * * `GLFW_EXPOSE_NATIVE_GLX` * * `GLFW_EXPOSE_NATIVE_EGL` * * `GLFW_EXPOSE_NATIVE_OSMESA` * * These macros select which of the native access functions that are declared * and which platform-specific headers to include. It is then up your (by * definition platform-specific) code to handle which of these should be * defined. */ /************************************************************************* * System headers and types *************************************************************************/ #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // example to allow applications to correctly declare a GL_ARB_debug_output // callback) but windows.h assumes no one will define APIENTRY before it does #if defined(GLFW_APIENTRY_DEFINED) #undef APIENTRY #undef GLFW_APIENTRY_DEFINED #endif #include #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) #if defined(__OBJC__) #import #else #include typedef void* id; #endif #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) #include #include #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) #include #endif #if defined(GLFW_EXPOSE_NATIVE_WGL) /* WGL is declared by windows.h */ #endif #if defined(GLFW_EXPOSE_NATIVE_NSGL) /* NSGL is declared by Cocoa.h */ #endif #if defined(GLFW_EXPOSE_NATIVE_GLX) #include #endif #if defined(GLFW_EXPOSE_NATIVE_EGL) #include #endif #if defined(GLFW_EXPOSE_NATIVE_OSMESA) #include #endif /************************************************************************* * Functions *************************************************************************/ #if defined(GLFW_EXPOSE_NATIVE_WIN32) /*! @brief Returns the adapter device name of the specified monitor. * * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`) * of the specified monitor, or `NULL` if an [error](@ref error_handling) * occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.1. * * @ingroup native */ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor); /*! @brief Returns the display device name of the specified monitor. * * @return The UTF-8 encoded display device name (for example * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.1. * * @ingroup native */ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor); /*! @brief Returns the `HWND` of the specified window. * * @return The `HWND` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_WGL) /*! @brief Returns the `HGLRC` of the specified window. * * @return The `HGLRC` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_COCOA) /*! @brief Returns the `CGDirectDisplayID` of the specified monitor. * * @return The `CGDirectDisplayID` of the specified monitor, or * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.1. * * @ingroup native */ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor); /*! @brief Returns the `NSWindow` of the specified window. * * @return The `NSWindow` of the specified window, or `nil` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_NSGL) /*! @brief Returns the `NSOpenGLContext` of the specified window. * * @return The `NSOpenGLContext` of the specified window, or `nil` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_X11) /*! @brief Returns the `Display` used by GLFW. * * @return The `Display` used by GLFW, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI Display* glfwGetX11Display(void); /*! @brief Returns the `RRCrtc` of the specified monitor. * * @return The `RRCrtc` of the specified monitor, or `None` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.1. * * @ingroup native */ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor); /*! @brief Returns the `RROutput` of the specified monitor. * * @return The `RROutput` of the specified monitor, or `None` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.1. * * @ingroup native */ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor); /*! @brief Returns the `Window` of the specified window. * * @return The `Window` of the specified window, or `None` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI Window glfwGetX11Window(GLFWwindow* window); /*! @brief Sets the current primary selection to the specified string. * * @param[in] string A UTF-8 encoded string. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified string is copied before this function * returns. * * @thread_safety This function must only be called from the main thread. * * @sa @ref clipboard * @sa glfwGetX11SelectionString * @sa glfwSetClipboardString * * @since Added in version 3.3. * * @ingroup native */ GLFWAPI void glfwSetX11SelectionString(const char* string); /*! @brief Returns the contents of the current primary selection as a string. * * If the selection is empty or if its contents cannot be converted, `NULL` * is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated. * * @return The contents of the selection as a UTF-8 encoded string, or `NULL` * if an [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the next call to @ref * glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the * library is terminated. * * @thread_safety This function must only be called from the main thread. * * @sa @ref clipboard * @sa glfwSetX11SelectionString * @sa glfwGetClipboardString * * @since Added in version 3.3. * * @ingroup native */ GLFWAPI const char* glfwGetX11SelectionString(void); #endif #if defined(GLFW_EXPOSE_NATIVE_GLX) /*! @brief Returns the `GLXContext` of the specified window. * * @return The `GLXContext` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); /*! @brief Returns the `GLXWindow` of the specified window. * * @return The `GLXWindow` of the specified window, or `None` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.2. * * @ingroup native */ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_WAYLAND) /*! @brief Returns the `struct wl_display*` used by GLFW. * * @return The `struct wl_display*` used by GLFW, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.2. * * @ingroup native */ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void); /*! @brief Returns the `struct wl_output*` of the specified monitor. * * @return The `struct wl_output*` of the specified monitor, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.2. * * @ingroup native */ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor); /*! @brief Returns the main `struct wl_surface*` of the specified window. * * @return The main `struct wl_surface*` of the specified window, or `NULL` if * an [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.2. * * @ingroup native */ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_EGL) /*! @brief Returns the `EGLDisplay` used by GLFW. * * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI EGLDisplay glfwGetEGLDisplay(void); /*! @brief Returns the `EGLContext` of the specified window. * * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window); /*! @brief Returns the `EGLSurface` of the specified window. * * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.0. * * @ingroup native */ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_OSMESA) /*! @brief Retrieves the color buffer associated with the specified window. * * @param[in] window The window whose color buffer to retrieve. * @param[out] width Where to store the width of the color buffer, or `NULL`. * @param[out] height Where to store the height of the color buffer, or `NULL`. * @param[out] format Where to store the OSMesa pixel format of the color * buffer, or `NULL`. * @param[out] buffer Where to store the address of the color buffer, or * `NULL`. * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.3. * * @ingroup native */ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer); /*! @brief Retrieves the depth buffer associated with the specified window. * * @param[in] window The window whose depth buffer to retrieve. * @param[out] width Where to store the width of the depth buffer, or `NULL`. * @param[out] height Where to store the height of the depth buffer, or `NULL`. * @param[out] bytesPerValue Where to store the number of bytes per depth * buffer element, or `NULL`. * @param[out] buffer Where to store the address of the depth buffer, or * `NULL`. * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.3. * * @ingroup native */ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer); /*! @brief Returns the `OSMesaContext` of the specified window. * * @return The `OSMesaContext` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * * @thread_safety This function may be called from any thread. Access is not * synchronized. * * @since Added in version 3.3. * * @ingroup native */ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window); #endif #ifdef __cplusplus } #endif #endif /* _glfw3_native_h_ */ ================================================ FILE: thirdparty/glfw/src/CMakeLists.txt ================================================ set(common_HEADERS internal.h mappings.h "${GLFW_BINARY_DIR}/src/glfw_config.h" "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h" "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c) if (_GLFW_COCOA) set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h posix_thread.h nsgl_context.h egl_context.h osmesa_context.h) set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_joystick.m cocoa_monitor.m cocoa_window.m cocoa_time.c posix_thread.c nsgl_context.m egl_context.c osmesa_context.c) elseif (_GLFW_WIN32) set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_joystick.h wgl_context.h egl_context.h osmesa_context.h) set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_joystick.c win32_monitor.c win32_time.c win32_thread.c win32_window.c wgl_context.c egl_context.c osmesa_context.c) elseif (_GLFW_X11) set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h posix_time.h posix_thread.h glx_context.h egl_context.h osmesa_context.h) set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c xkb_unicode.c posix_time.c posix_thread.c glx_context.c egl_context.c osmesa_context.c) elseif (_GLFW_WAYLAND) set(glfw_HEADERS ${common_HEADERS} wl_platform.h posix_time.h posix_thread.h xkb_unicode.h egl_context.h osmesa_context.h) set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c posix_time.c posix_thread.c xkb_unicode.c egl_context.c osmesa_context.c) ecm_add_wayland_client_protocol(glfw_SOURCES PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml" BASENAME xdg-shell) ecm_add_wayland_client_protocol(glfw_SOURCES PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" BASENAME xdg-decoration) ecm_add_wayland_client_protocol(glfw_SOURCES PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml" BASENAME viewporter) ecm_add_wayland_client_protocol(glfw_SOURCES PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml" BASENAME relative-pointer-unstable-v1) ecm_add_wayland_client_protocol(glfw_SOURCES PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" BASENAME pointer-constraints-unstable-v1) ecm_add_wayland_client_protocol(glfw_SOURCES PROTOCOL "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" BASENAME idle-inhibit-unstable-v1) elseif (_GLFW_OSMESA) set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h posix_time.h posix_thread.h osmesa_context.h) set(glfw_SOURCES ${common_SOURCES} null_init.c null_monitor.c null_window.c null_joystick.c posix_time.c posix_thread.c osmesa_context.c) endif() if (_GLFW_X11 OR _GLFW_WAYLAND) if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h) set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c) else() set(glfw_HEADERS ${glfw_HEADERS} null_joystick.h) set(glfw_SOURCES ${glfw_SOURCES} null_joystick.c) endif() endif() if (APPLE) # For some reason CMake didn't know about .m until version 3.16 set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m cocoa_window.m nsgl_context.m PROPERTIES LANGUAGE C) endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) set_target_properties(glfw PROPERTIES OUTPUT_NAME ${GLFW_LIB_NAME} VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR} SOVERSION ${GLFW_VERSION_MAJOR} POSITION_INDEPENDENT_CODE ON FOLDER "GLFW3") if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.1.0") set_target_properties(glfw PROPERTIES C_STANDARD 99) else() # Remove this fallback when removing support for CMake version less than 3.1 target_compile_options(glfw PRIVATE "$<$:-std=c99>" "$<$:-std=c99>" "$<$:-std=c99>") endif() target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H) target_include_directories(glfw PUBLIC "$" "$") target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/src" "${GLFW_BINARY_DIR}/src" ${glfw_INCLUDE_DIRS}) target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES}) if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") # Make GCC and Clang warn about declarations that VS 2010 and 2012 won't # accept for all source files that VS will build set_source_files_properties(context.c init.c input.c monitor.c vulkan.c window.c win32_init.c win32_joystick.c win32_monitor.c win32_time.c win32_thread.c win32_window.c wgl_context.c egl_context.c osmesa_context.c PROPERTIES COMPILE_FLAGS -Wdeclaration-after-statement) # Enable a reasonable set of warnings (no, -Wextra is not reasonable) target_compile_options(glfw PRIVATE "-Wall") endif() if (WIN32) target_compile_definitions(glfw PRIVATE _UNICODE) endif() # HACK: When building on MinGW, WINVER and UNICODE need to be defined before # the inclusion of stddef.h (by glfw3.h), which is itself included before # win32_platform.h. We define them here until a saner solution can be found # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. if (MINGW) target_compile_definitions(glfw PRIVATE UNICODE WINVER=0x0501) endif() if (BUILD_SHARED_LIBS) if (WIN32) if (MINGW) # Remove the dependency on the shared version of libgcc # NOTE: MinGW-w64 has the correct default but MinGW needs this target_link_libraries(glfw PRIVATE "-static-libgcc") # Remove the lib prefix on the DLL (but not the import library) set_target_properties(glfw PROPERTIES PREFIX "") # Add a suffix to the import library to avoid naming conflicts set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.a") else() # Add a suffix to the import library to avoid naming conflicts set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib") endif() target_compile_definitions(glfw INTERFACE GLFW_DLL) elseif (APPLE) # Add -fno-common to work around a bug in Apple's GCC target_compile_options(glfw PRIVATE "-fno-common") set_target_properties(glfw PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}") endif() if (UNIX) # Hide symbols not explicitly tagged for export from the shared library target_compile_options(glfw PRIVATE "-fvisibility=hidden") endif() endif() if (MSVC) target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) endif() if (GLFW_INSTALL) install(TARGETS glfw EXPORT glfwTargets RUNTIME DESTINATION "bin" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() ================================================ FILE: thirdparty/glfw/src/cocoa_init.m ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include // For MAXPATHLEN // Needed for _NSGetProgname #include // Change to our application bundle's resources directory, if present // static void changeToResourcesDirectory(void) { char resourcesPath[MAXPATHLEN]; CFBundleRef bundle = CFBundleGetMainBundle(); if (!bundle) return; CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(bundle); CFStringRef last = CFURLCopyLastPathComponent(resourcesURL); if (CFStringCompare(CFSTR("Resources"), last, 0) != kCFCompareEqualTo) { CFRelease(last); CFRelease(resourcesURL); return; } CFRelease(last); if (!CFURLGetFileSystemRepresentation(resourcesURL, true, (UInt8*) resourcesPath, MAXPATHLEN)) { CFRelease(resourcesURL); return; } CFRelease(resourcesURL); chdir(resourcesPath); } // Set up the menu bar (manually) // This is nasty, nasty stuff -- calls to undocumented semi-private APIs that // could go away at any moment, lots of stuff that really should be // localize(d|able), etc. Add a nib to save us this horror. // static void createMenuBar(void) { size_t i; NSString* appName = nil; NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary]; NSString* nameKeys[] = { @"CFBundleDisplayName", @"CFBundleName", @"CFBundleExecutable", }; // Try to figure out what the calling application is called for (i = 0; i < sizeof(nameKeys) / sizeof(nameKeys[0]); i++) { id name = bundleInfo[nameKeys[i]]; if (name && [name isKindOfClass:[NSString class]] && ![name isEqualToString:@""]) { appName = name; break; } } if (!appName) { char** progname = _NSGetProgname(); if (progname && *progname) appName = @(*progname); else appName = @"GLFW Application"; } NSMenu* bar = [[NSMenu alloc] init]; [NSApp setMainMenu:bar]; NSMenuItem* appMenuItem = [bar addItemWithTitle:@"" action:NULL keyEquivalent:@""]; NSMenu* appMenu = [[NSMenu alloc] init]; [appMenuItem setSubmenu:appMenu]; [appMenu addItemWithTitle:[NSString stringWithFormat:@"About %@", appName] action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; [appMenu addItem:[NSMenuItem separatorItem]]; NSMenu* servicesMenu = [[NSMenu alloc] init]; [NSApp setServicesMenu:servicesMenu]; [[appMenu addItemWithTitle:@"Services" action:NULL keyEquivalent:@""] setSubmenu:servicesMenu]; [servicesMenu release]; [appMenu addItem:[NSMenuItem separatorItem]]; [appMenu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", appName] action:@selector(hide:) keyEquivalent:@"h"]; [[appMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"] setKeyEquivalentModifierMask:NSEventModifierFlagOption | NSEventModifierFlagCommand]; [appMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; [appMenu addItem:[NSMenuItem separatorItem]]; [appMenu addItemWithTitle:[NSString stringWithFormat:@"Quit %@", appName] action:@selector(terminate:) keyEquivalent:@"q"]; NSMenuItem* windowMenuItem = [bar addItemWithTitle:@"" action:NULL keyEquivalent:@""]; [bar release]; NSMenu* windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; [NSApp setWindowsMenu:windowMenu]; [windowMenuItem setSubmenu:windowMenu]; [windowMenu addItemWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""]; [windowMenu addItem:[NSMenuItem separatorItem]]; [windowMenu addItemWithTitle:@"Bring All to Front" action:@selector(arrangeInFront:) keyEquivalent:@""]; // TODO: Make this appear at the bottom of the menu (for consistency) [windowMenu addItem:[NSMenuItem separatorItem]]; [[windowMenu addItemWithTitle:@"Enter Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"] setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; // Prior to Snow Leopard, we need to use this oddly-named semi-private API // to get the application menu working properly. SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:"); [NSApp performSelector:setAppleMenuSelector withObject:appMenu]; } // Create key code translation tables // static void createKeyTables(void) { int scancode; memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes)); memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes)); _glfw.ns.keycodes[0x1D] = GLFW_KEY_0; _glfw.ns.keycodes[0x12] = GLFW_KEY_1; _glfw.ns.keycodes[0x13] = GLFW_KEY_2; _glfw.ns.keycodes[0x14] = GLFW_KEY_3; _glfw.ns.keycodes[0x15] = GLFW_KEY_4; _glfw.ns.keycodes[0x17] = GLFW_KEY_5; _glfw.ns.keycodes[0x16] = GLFW_KEY_6; _glfw.ns.keycodes[0x1A] = GLFW_KEY_7; _glfw.ns.keycodes[0x1C] = GLFW_KEY_8; _glfw.ns.keycodes[0x19] = GLFW_KEY_9; _glfw.ns.keycodes[0x00] = GLFW_KEY_A; _glfw.ns.keycodes[0x0B] = GLFW_KEY_B; _glfw.ns.keycodes[0x08] = GLFW_KEY_C; _glfw.ns.keycodes[0x02] = GLFW_KEY_D; _glfw.ns.keycodes[0x0E] = GLFW_KEY_E; _glfw.ns.keycodes[0x03] = GLFW_KEY_F; _glfw.ns.keycodes[0x05] = GLFW_KEY_G; _glfw.ns.keycodes[0x04] = GLFW_KEY_H; _glfw.ns.keycodes[0x22] = GLFW_KEY_I; _glfw.ns.keycodes[0x26] = GLFW_KEY_J; _glfw.ns.keycodes[0x28] = GLFW_KEY_K; _glfw.ns.keycodes[0x25] = GLFW_KEY_L; _glfw.ns.keycodes[0x2E] = GLFW_KEY_M; _glfw.ns.keycodes[0x2D] = GLFW_KEY_N; _glfw.ns.keycodes[0x1F] = GLFW_KEY_O; _glfw.ns.keycodes[0x23] = GLFW_KEY_P; _glfw.ns.keycodes[0x0C] = GLFW_KEY_Q; _glfw.ns.keycodes[0x0F] = GLFW_KEY_R; _glfw.ns.keycodes[0x01] = GLFW_KEY_S; _glfw.ns.keycodes[0x11] = GLFW_KEY_T; _glfw.ns.keycodes[0x20] = GLFW_KEY_U; _glfw.ns.keycodes[0x09] = GLFW_KEY_V; _glfw.ns.keycodes[0x0D] = GLFW_KEY_W; _glfw.ns.keycodes[0x07] = GLFW_KEY_X; _glfw.ns.keycodes[0x10] = GLFW_KEY_Y; _glfw.ns.keycodes[0x06] = GLFW_KEY_Z; _glfw.ns.keycodes[0x27] = GLFW_KEY_APOSTROPHE; _glfw.ns.keycodes[0x2A] = GLFW_KEY_BACKSLASH; _glfw.ns.keycodes[0x2B] = GLFW_KEY_COMMA; _glfw.ns.keycodes[0x18] = GLFW_KEY_EQUAL; _glfw.ns.keycodes[0x32] = GLFW_KEY_GRAVE_ACCENT; _glfw.ns.keycodes[0x21] = GLFW_KEY_LEFT_BRACKET; _glfw.ns.keycodes[0x1B] = GLFW_KEY_MINUS; _glfw.ns.keycodes[0x2F] = GLFW_KEY_PERIOD; _glfw.ns.keycodes[0x1E] = GLFW_KEY_RIGHT_BRACKET; _glfw.ns.keycodes[0x29] = GLFW_KEY_SEMICOLON; _glfw.ns.keycodes[0x2C] = GLFW_KEY_SLASH; _glfw.ns.keycodes[0x0A] = GLFW_KEY_WORLD_1; _glfw.ns.keycodes[0x33] = GLFW_KEY_BACKSPACE; _glfw.ns.keycodes[0x39] = GLFW_KEY_CAPS_LOCK; _glfw.ns.keycodes[0x75] = GLFW_KEY_DELETE; _glfw.ns.keycodes[0x7D] = GLFW_KEY_DOWN; _glfw.ns.keycodes[0x77] = GLFW_KEY_END; _glfw.ns.keycodes[0x24] = GLFW_KEY_ENTER; _glfw.ns.keycodes[0x35] = GLFW_KEY_ESCAPE; _glfw.ns.keycodes[0x7A] = GLFW_KEY_F1; _glfw.ns.keycodes[0x78] = GLFW_KEY_F2; _glfw.ns.keycodes[0x63] = GLFW_KEY_F3; _glfw.ns.keycodes[0x76] = GLFW_KEY_F4; _glfw.ns.keycodes[0x60] = GLFW_KEY_F5; _glfw.ns.keycodes[0x61] = GLFW_KEY_F6; _glfw.ns.keycodes[0x62] = GLFW_KEY_F7; _glfw.ns.keycodes[0x64] = GLFW_KEY_F8; _glfw.ns.keycodes[0x65] = GLFW_KEY_F9; _glfw.ns.keycodes[0x6D] = GLFW_KEY_F10; _glfw.ns.keycodes[0x67] = GLFW_KEY_F11; _glfw.ns.keycodes[0x6F] = GLFW_KEY_F12; _glfw.ns.keycodes[0x69] = GLFW_KEY_F13; _glfw.ns.keycodes[0x6B] = GLFW_KEY_F14; _glfw.ns.keycodes[0x71] = GLFW_KEY_F15; _glfw.ns.keycodes[0x6A] = GLFW_KEY_F16; _glfw.ns.keycodes[0x40] = GLFW_KEY_F17; _glfw.ns.keycodes[0x4F] = GLFW_KEY_F18; _glfw.ns.keycodes[0x50] = GLFW_KEY_F19; _glfw.ns.keycodes[0x5A] = GLFW_KEY_F20; _glfw.ns.keycodes[0x73] = GLFW_KEY_HOME; _glfw.ns.keycodes[0x72] = GLFW_KEY_INSERT; _glfw.ns.keycodes[0x7B] = GLFW_KEY_LEFT; _glfw.ns.keycodes[0x3A] = GLFW_KEY_LEFT_ALT; _glfw.ns.keycodes[0x3B] = GLFW_KEY_LEFT_CONTROL; _glfw.ns.keycodes[0x38] = GLFW_KEY_LEFT_SHIFT; _glfw.ns.keycodes[0x37] = GLFW_KEY_LEFT_SUPER; _glfw.ns.keycodes[0x6E] = GLFW_KEY_MENU; _glfw.ns.keycodes[0x47] = GLFW_KEY_NUM_LOCK; _glfw.ns.keycodes[0x79] = GLFW_KEY_PAGE_DOWN; _glfw.ns.keycodes[0x74] = GLFW_KEY_PAGE_UP; _glfw.ns.keycodes[0x7C] = GLFW_KEY_RIGHT; _glfw.ns.keycodes[0x3D] = GLFW_KEY_RIGHT_ALT; _glfw.ns.keycodes[0x3E] = GLFW_KEY_RIGHT_CONTROL; _glfw.ns.keycodes[0x3C] = GLFW_KEY_RIGHT_SHIFT; _glfw.ns.keycodes[0x36] = GLFW_KEY_RIGHT_SUPER; _glfw.ns.keycodes[0x31] = GLFW_KEY_SPACE; _glfw.ns.keycodes[0x30] = GLFW_KEY_TAB; _glfw.ns.keycodes[0x7E] = GLFW_KEY_UP; _glfw.ns.keycodes[0x52] = GLFW_KEY_KP_0; _glfw.ns.keycodes[0x53] = GLFW_KEY_KP_1; _glfw.ns.keycodes[0x54] = GLFW_KEY_KP_2; _glfw.ns.keycodes[0x55] = GLFW_KEY_KP_3; _glfw.ns.keycodes[0x56] = GLFW_KEY_KP_4; _glfw.ns.keycodes[0x57] = GLFW_KEY_KP_5; _glfw.ns.keycodes[0x58] = GLFW_KEY_KP_6; _glfw.ns.keycodes[0x59] = GLFW_KEY_KP_7; _glfw.ns.keycodes[0x5B] = GLFW_KEY_KP_8; _glfw.ns.keycodes[0x5C] = GLFW_KEY_KP_9; _glfw.ns.keycodes[0x45] = GLFW_KEY_KP_ADD; _glfw.ns.keycodes[0x41] = GLFW_KEY_KP_DECIMAL; _glfw.ns.keycodes[0x4B] = GLFW_KEY_KP_DIVIDE; _glfw.ns.keycodes[0x4C] = GLFW_KEY_KP_ENTER; _glfw.ns.keycodes[0x51] = GLFW_KEY_KP_EQUAL; _glfw.ns.keycodes[0x43] = GLFW_KEY_KP_MULTIPLY; _glfw.ns.keycodes[0x4E] = GLFW_KEY_KP_SUBTRACT; for (scancode = 0; scancode < 256; scancode++) { // Store the reverse translation for faster key name lookup if (_glfw.ns.keycodes[scancode] >= 0) _glfw.ns.scancodes[_glfw.ns.keycodes[scancode]] = scancode; } } // Retrieve Unicode data for the current keyboard layout // static GLFWbool updateUnicodeDataNS(void) { if (_glfw.ns.inputSource) { CFRelease(_glfw.ns.inputSource); _glfw.ns.inputSource = NULL; _glfw.ns.unicodeData = nil; } _glfw.ns.inputSource = TISCopyCurrentKeyboardLayoutInputSource(); if (!_glfw.ns.inputSource) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to retrieve keyboard layout input source"); return GLFW_FALSE; } _glfw.ns.unicodeData = TISGetInputSourceProperty(_glfw.ns.inputSource, kTISPropertyUnicodeKeyLayoutData); if (!_glfw.ns.unicodeData) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to retrieve keyboard layout Unicode data"); return GLFW_FALSE; } return GLFW_TRUE; } // Load HIToolbox.framework and the TIS symbols we need from it // static GLFWbool initializeTIS(void) { // This works only because Cocoa has already loaded it properly _glfw.ns.tis.bundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HIToolbox")); if (!_glfw.ns.tis.bundle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to load HIToolbox.framework"); return GLFW_FALSE; } CFStringRef* kPropertyUnicodeKeyLayoutData = CFBundleGetDataPointerForName(_glfw.ns.tis.bundle, CFSTR("kTISPropertyUnicodeKeyLayoutData")); _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource = CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle, CFSTR("TISCopyCurrentKeyboardLayoutInputSource")); _glfw.ns.tis.GetInputSourceProperty = CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle, CFSTR("TISGetInputSourceProperty")); _glfw.ns.tis.GetKbdType = CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle, CFSTR("LMGetKbdType")); if (!kPropertyUnicodeKeyLayoutData || !TISCopyCurrentKeyboardLayoutInputSource || !TISGetInputSourceProperty || !LMGetKbdType) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to load TIS API symbols"); return GLFW_FALSE; } _glfw.ns.tis.kPropertyUnicodeKeyLayoutData = *kPropertyUnicodeKeyLayoutData; return updateUnicodeDataNS(); } @interface GLFWHelper : NSObject @end @implementation GLFWHelper - (void)selectedKeyboardInputSourceChanged:(NSObject* )object { updateUnicodeDataNS(); } - (void)doNothing:(id)object { } @end // GLFWHelper @interface GLFWApplicationDelegate : NSObject @end @implementation GLFWApplicationDelegate - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { _GLFWwindow* window; for (window = _glfw.windowListHead; window; window = window->next) _glfwInputWindowCloseRequest(window); return NSTerminateCancel; } - (void)applicationDidChangeScreenParameters:(NSNotification *) notification { _GLFWwindow* window; for (window = _glfw.windowListHead; window; window = window->next) { if (window->context.client != GLFW_NO_API) [window->context.nsgl.object update]; } _glfwPollMonitorsNS(); } - (void)applicationWillFinishLaunching:(NSNotification *)notification { if (_glfw.hints.init.ns.menubar) { // In case we are unbundled, make us a proper UI application [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; // Menu bar setup must go between sharedApplication and finishLaunching // in order to properly emulate the behavior of NSApplicationMain if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"]) { [[NSBundle mainBundle] loadNibNamed:@"MainMenu" owner:NSApp topLevelObjects:&_glfw.ns.nibObjects]; } else createMenuBar(); } } - (void)applicationDidFinishLaunching:(NSNotification *)notification { _glfw.ns.finishedLaunching = GLFW_TRUE; _glfwPlatformPostEmptyEvent(); [NSApp stop:nil]; } - (void)applicationDidHide:(NSNotification *)notification { int i; for (i = 0; i < _glfw.monitorCount; i++) _glfwRestoreVideoModeNS(_glfw.monitors[i]); } @end // GLFWApplicationDelegate ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// void* _glfwLoadLocalVulkanLoaderNS(void) { CFBundleRef bundle = CFBundleGetMainBundle(); if (!bundle) return NULL; CFURLRef url = CFBundleCopyAuxiliaryExecutableURL(bundle, CFSTR("libvulkan.1.dylib")); if (!url) return NULL; char path[PATH_MAX]; void* handle = NULL; if (CFURLGetFileSystemRepresentation(url, true, (UInt8*) path, sizeof(path) - 1)) handle = _glfw_dlopen(path); CFRelease(url); return handle; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformInit(void) { @autoreleasepool { _glfw.ns.helper = [[GLFWHelper alloc] init]; [NSThread detachNewThreadSelector:@selector(doNothing:) toTarget:_glfw.ns.helper withObject:nil]; if (NSApp) _glfw.ns.finishedLaunching = GLFW_TRUE; [NSApplication sharedApplication]; _glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init]; if (_glfw.ns.delegate == nil) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create application delegate"); return GLFW_FALSE; } [NSApp setDelegate:_glfw.ns.delegate]; NSEvent* (^block)(NSEvent*) = ^ NSEvent* (NSEvent* event) { if ([event modifierFlags] & NSEventModifierFlagCommand) [[NSApp keyWindow] sendEvent:event]; return event; }; _glfw.ns.keyUpMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp handler:block]; if (_glfw.hints.init.ns.chdir) changeToResourcesDirectory(); // Press and Hold prevents some keys from emitting repeated characters NSDictionary* defaults = @{@"ApplePressAndHoldEnabled":@NO}; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; [[NSNotificationCenter defaultCenter] addObserver:_glfw.ns.helper selector:@selector(selectedKeyboardInputSourceChanged:) name:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil]; createKeyTables(); _glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState); if (!_glfw.ns.eventSource) return GLFW_FALSE; CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0); if (!initializeTIS()) return GLFW_FALSE; _glfwInitTimerNS(); _glfwInitJoysticksNS(); _glfwPollMonitorsNS(); return GLFW_TRUE; } // autoreleasepool } void _glfwPlatformTerminate(void) { @autoreleasepool { if (_glfw.ns.inputSource) { CFRelease(_glfw.ns.inputSource); _glfw.ns.inputSource = NULL; _glfw.ns.unicodeData = nil; } if (_glfw.ns.eventSource) { CFRelease(_glfw.ns.eventSource); _glfw.ns.eventSource = NULL; } if (_glfw.ns.delegate) { [NSApp setDelegate:nil]; [_glfw.ns.delegate release]; _glfw.ns.delegate = nil; } if (_glfw.ns.helper) { [[NSNotificationCenter defaultCenter] removeObserver:_glfw.ns.helper name:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:_glfw.ns.helper]; [_glfw.ns.helper release]; _glfw.ns.helper = nil; } if (_glfw.ns.keyUpMonitor) [NSEvent removeMonitor:_glfw.ns.keyUpMonitor]; free(_glfw.ns.clipboardString); _glfwTerminateNSGL(); _glfwTerminateJoysticksNS(); } // autoreleasepool } const char* _glfwPlatformGetVersionString(void) { return _GLFW_VERSION_NUMBER " Cocoa NSGL EGL OSMesa" #if defined(_GLFW_BUILD_DLL) " dynamic" #endif ; } ================================================ FILE: thirdparty/glfw/src/cocoa_joystick.h ================================================ //======================================================================== // GLFW 3.3 Cocoa - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; } #define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X" // Cocoa-specific per-joystick data // typedef struct _GLFWjoystickNS { IOHIDDeviceRef device; CFMutableArrayRef axes; CFMutableArrayRef buttons; CFMutableArrayRef hats; } _GLFWjoystickNS; void _glfwInitJoysticksNS(void); void _glfwTerminateJoysticksNS(void); ================================================ FILE: thirdparty/glfw/src/cocoa_joystick.m ================================================ //======================================================================== // GLFW 3.3 Cocoa - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy // Copyright (c) 2012 Torsten Walluhn // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include #include #include // Joystick element information // typedef struct _GLFWjoyelementNS { IOHIDElementRef native; uint32_t usage; int index; long minimum; long maximum; } _GLFWjoyelementNS; // Returns the value of the specified element of the specified joystick // static long getElementValue(_GLFWjoystick* js, _GLFWjoyelementNS* element) { IOHIDValueRef valueRef; long value = 0; if (js->ns.device) { if (IOHIDDeviceGetValue(js->ns.device, element->native, &valueRef) == kIOReturnSuccess) { value = IOHIDValueGetIntegerValue(valueRef); } } return value; } // Comparison function for matching the SDL element order // static CFComparisonResult compareElements(const void* fp, const void* sp, void* user) { const _GLFWjoyelementNS* fe = fp; const _GLFWjoyelementNS* se = sp; if (fe->usage < se->usage) return kCFCompareLessThan; if (fe->usage > se->usage) return kCFCompareGreaterThan; if (fe->index < se->index) return kCFCompareLessThan; if (fe->index > se->index) return kCFCompareGreaterThan; return kCFCompareEqualTo; } // Removes the specified joystick // static void closeJoystick(_GLFWjoystick* js) { int i; if (!js->present) return; for (i = 0; i < CFArrayGetCount(js->ns.axes); i++) free((void*) CFArrayGetValueAtIndex(js->ns.axes, i)); CFRelease(js->ns.axes); for (i = 0; i < CFArrayGetCount(js->ns.buttons); i++) free((void*) CFArrayGetValueAtIndex(js->ns.buttons, i)); CFRelease(js->ns.buttons); for (i = 0; i < CFArrayGetCount(js->ns.hats); i++) free((void*) CFArrayGetValueAtIndex(js->ns.hats, i)); CFRelease(js->ns.hats); _glfwFreeJoystick(js); _glfwInputJoystick(js, GLFW_DISCONNECTED); } // Callback for user-initiated joystick addition // static void matchCallback(void* context, IOReturn result, void* sender, IOHIDDeviceRef device) { int jid; char name[256]; char guid[33]; CFIndex i; CFTypeRef property; uint32_t vendor = 0, product = 0, version = 0; _GLFWjoystick* js; CFMutableArrayRef axes, buttons, hats; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { if (_glfw.joysticks[jid].ns.device == device) return; } axes = CFArrayCreateMutable(NULL, 0, NULL); buttons = CFArrayCreateMutable(NULL, 0, NULL); hats = CFArrayCreateMutable(NULL, 0, NULL); property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey)); if (property) { CFStringGetCString(property, name, sizeof(name), kCFStringEncodingUTF8); } else strncpy(name, "Unknown", sizeof(name)); property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)); if (property) CFNumberGetValue(property, kCFNumberSInt32Type, &vendor); property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey)); if (property) CFNumberGetValue(property, kCFNumberSInt32Type, &product); property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVersionNumberKey)); if (property) CFNumberGetValue(property, kCFNumberSInt32Type, &version); // Generate a joystick GUID that matches the SDL 2.0.5+ one if (vendor && product) { sprintf(guid, "03000000%02x%02x0000%02x%02x0000%02x%02x0000", (uint8_t) vendor, (uint8_t) (vendor >> 8), (uint8_t) product, (uint8_t) (product >> 8), (uint8_t) version, (uint8_t) (version >> 8)); } else { sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00", name[0], name[1], name[2], name[3], name[4], name[5], name[6], name[7], name[8], name[9], name[10]); } CFArrayRef elements = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone); for (i = 0; i < CFArrayGetCount(elements); i++) { IOHIDElementRef native = (IOHIDElementRef) CFArrayGetValueAtIndex(elements, i); if (CFGetTypeID(native) != IOHIDElementGetTypeID()) continue; const IOHIDElementType type = IOHIDElementGetType(native); if ((type != kIOHIDElementTypeInput_Axis) && (type != kIOHIDElementTypeInput_Button) && (type != kIOHIDElementTypeInput_Misc)) { continue; } CFMutableArrayRef target = NULL; const uint32_t usage = IOHIDElementGetUsage(native); const uint32_t page = IOHIDElementGetUsagePage(native); if (page == kHIDPage_GenericDesktop) { switch (usage) { case kHIDUsage_GD_X: case kHIDUsage_GD_Y: case kHIDUsage_GD_Z: case kHIDUsage_GD_Rx: case kHIDUsage_GD_Ry: case kHIDUsage_GD_Rz: case kHIDUsage_GD_Slider: case kHIDUsage_GD_Dial: case kHIDUsage_GD_Wheel: target = axes; break; case kHIDUsage_GD_Hatswitch: target = hats; break; case kHIDUsage_GD_DPadUp: case kHIDUsage_GD_DPadRight: case kHIDUsage_GD_DPadDown: case kHIDUsage_GD_DPadLeft: case kHIDUsage_GD_SystemMainMenu: case kHIDUsage_GD_Select: case kHIDUsage_GD_Start: target = buttons; break; } } else if (page == kHIDPage_Simulation) { switch (usage) { case kHIDUsage_Sim_Accelerator: case kHIDUsage_Sim_Brake: case kHIDUsage_Sim_Throttle: case kHIDUsage_Sim_Rudder: case kHIDUsage_Sim_Steering: target = axes; break; } } else if (page == kHIDPage_Button || page == kHIDPage_Consumer) target = buttons; if (target) { _GLFWjoyelementNS* element = calloc(1, sizeof(_GLFWjoyelementNS)); element->native = native; element->usage = usage; element->index = (int) CFArrayGetCount(target); element->minimum = IOHIDElementGetLogicalMin(native); element->maximum = IOHIDElementGetLogicalMax(native); CFArrayAppendValue(target, element); } } CFRelease(elements); CFArraySortValues(axes, CFRangeMake(0, CFArrayGetCount(axes)), compareElements, NULL); CFArraySortValues(buttons, CFRangeMake(0, CFArrayGetCount(buttons)), compareElements, NULL); CFArraySortValues(hats, CFRangeMake(0, CFArrayGetCount(hats)), compareElements, NULL); js = _glfwAllocJoystick(name, guid, (int) CFArrayGetCount(axes), (int) CFArrayGetCount(buttons), (int) CFArrayGetCount(hats)); js->ns.device = device; js->ns.axes = axes; js->ns.buttons = buttons; js->ns.hats = hats; _glfwInputJoystick(js, GLFW_CONNECTED); } // Callback for user-initiated joystick removal // static void removeCallback(void* context, IOReturn result, void* sender, IOHIDDeviceRef device) { int jid; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { if (_glfw.joysticks[jid].ns.device == device) { closeJoystick(_glfw.joysticks + jid); break; } } } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize joystick interface // void _glfwInitJoysticksNS(void) { CFMutableArrayRef matching; const long usages[] = { kHIDUsage_GD_Joystick, kHIDUsage_GD_GamePad, kHIDUsage_GD_MultiAxisController }; _glfw.ns.hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); matching = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); if (!matching) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create array"); return; } for (size_t i = 0; i < sizeof(usages) / sizeof(long); i++) { const long page = kHIDPage_GenericDesktop; CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); if (!dict) continue; CFNumberRef pageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberLongType, &page); CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberLongType, &usages[i]); if (pageRef && usageRef) { CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), pageRef); CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), usageRef); CFArrayAppendValue(matching, dict); } if (pageRef) CFRelease(pageRef); if (usageRef) CFRelease(usageRef); CFRelease(dict); } IOHIDManagerSetDeviceMatchingMultiple(_glfw.ns.hidManager, matching); CFRelease(matching); IOHIDManagerRegisterDeviceMatchingCallback(_glfw.ns.hidManager, &matchCallback, NULL); IOHIDManagerRegisterDeviceRemovalCallback(_glfw.ns.hidManager, &removeCallback, NULL); IOHIDManagerScheduleWithRunLoop(_glfw.ns.hidManager, CFRunLoopGetMain(), kCFRunLoopDefaultMode); IOHIDManagerOpen(_glfw.ns.hidManager, kIOHIDOptionsTypeNone); // Execute the run loop once in order to register any initially-attached // joysticks CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); } // Close all opened joystick handles // void _glfwTerminateJoysticksNS(void) { int jid; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) closeJoystick(_glfw.joysticks + jid); CFRelease(_glfw.ns.hidManager); _glfw.ns.hidManager = NULL; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) { if (mode & _GLFW_POLL_AXES) { CFIndex i; for (i = 0; i < CFArrayGetCount(js->ns.axes); i++) { _GLFWjoyelementNS* axis = (_GLFWjoyelementNS*) CFArrayGetValueAtIndex(js->ns.axes, i); const long raw = getElementValue(js, axis); // Perform auto calibration if (raw < axis->minimum) axis->minimum = raw; if (raw > axis->maximum) axis->maximum = raw; const long size = axis->maximum - axis->minimum; if (size == 0) _glfwInputJoystickAxis(js, (int) i, 0.f); else { const float value = (2.f * (raw - axis->minimum) / size) - 1.f; _glfwInputJoystickAxis(js, (int) i, value); } } } if (mode & _GLFW_POLL_BUTTONS) { CFIndex i; for (i = 0; i < CFArrayGetCount(js->ns.buttons); i++) { _GLFWjoyelementNS* button = (_GLFWjoyelementNS*) CFArrayGetValueAtIndex(js->ns.buttons, i); const char value = getElementValue(js, button) - button->minimum; const int state = (value > 0) ? GLFW_PRESS : GLFW_RELEASE; _glfwInputJoystickButton(js, (int) i, state); } for (i = 0; i < CFArrayGetCount(js->ns.hats); i++) { const int states[9] = { GLFW_HAT_UP, GLFW_HAT_RIGHT_UP, GLFW_HAT_RIGHT, GLFW_HAT_RIGHT_DOWN, GLFW_HAT_DOWN, GLFW_HAT_LEFT_DOWN, GLFW_HAT_LEFT, GLFW_HAT_LEFT_UP, GLFW_HAT_CENTERED }; _GLFWjoyelementNS* hat = (_GLFWjoyelementNS*) CFArrayGetValueAtIndex(js->ns.hats, i); long state = getElementValue(js, hat) - hat->minimum; if (state < 0 || state > 8) state = 8; _glfwInputJoystickHat(js, (int) i, states[state]); } } return js->present; } void _glfwPlatformUpdateGamepadGUID(char* guid) { if ((strncmp(guid + 4, "000000000000", 12) == 0) && (strncmp(guid + 20, "000000000000", 12) == 0)) { char original[33]; strncpy(original, guid, sizeof(original) - 1); sprintf(guid, "03000000%.4s0000%.4s000000000000", original, original + 16); } } ================================================ FILE: thirdparty/glfw/src/cocoa_monitor.m ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include // Get the name of the specified display, or NULL // static char* getDisplayName(CGDirectDisplayID displayID) { io_iterator_t it; io_service_t service; CFDictionaryRef info; if (IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IODisplayConnect"), &it) != 0) { // This may happen if a desktop Mac is running headless return NULL; } while ((service = IOIteratorNext(it)) != 0) { info = IODisplayCreateInfoDictionary(service, kIODisplayOnlyPreferredName); CFNumberRef vendorIDRef = CFDictionaryGetValue(info, CFSTR(kDisplayVendorID)); CFNumberRef productIDRef = CFDictionaryGetValue(info, CFSTR(kDisplayProductID)); if (!vendorIDRef || !productIDRef) { CFRelease(info); continue; } unsigned int vendorID, productID; CFNumberGetValue(vendorIDRef, kCFNumberIntType, &vendorID); CFNumberGetValue(productIDRef, kCFNumberIntType, &productID); if (CGDisplayVendorNumber(displayID) == vendorID && CGDisplayModelNumber(displayID) == productID) { // Info dictionary is used and freed below break; } CFRelease(info); } IOObjectRelease(it); if (!service) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find service port for display"); return NULL; } CFDictionaryRef names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName)); CFStringRef nameRef; if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"), (const void**) &nameRef)) { // This may happen if a desktop Mac is running headless CFRelease(info); return NULL; } const CFIndex size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef), kCFStringEncodingUTF8); char* name = calloc(size + 1, 1); CFStringGetCString(nameRef, name, size, kCFStringEncodingUTF8); CFRelease(info); return name; } // Check whether the display mode should be included in enumeration // static GLFWbool modeIsGood(CGDisplayModeRef mode) { uint32_t flags = CGDisplayModeGetIOFlags(mode); if (!(flags & kDisplayModeValidFlag) || !(flags & kDisplayModeSafeFlag)) return GLFW_FALSE; if (flags & kDisplayModeInterlacedFlag) return GLFW_FALSE; if (flags & kDisplayModeStretchedFlag) return GLFW_FALSE; #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100 CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) && CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0)) { CFRelease(format); return GLFW_FALSE; } CFRelease(format); #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ return GLFW_TRUE; } // Convert Core Graphics display mode to GLFW video mode // static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode, double fallbackRefreshRate) { GLFWvidmode result; result.width = (int) CGDisplayModeGetWidth(mode); result.height = (int) CGDisplayModeGetHeight(mode); result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode)); if (result.refreshRate == 0) result.refreshRate = (int) round(fallbackRefreshRate); #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100 CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0) { result.redBits = 5; result.greenBits = 5; result.blueBits = 5; } else #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ { result.redBits = 8; result.greenBits = 8; result.blueBits = 8; } #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100 CFRelease(format); #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ return result; } // Starts reservation for display fading // static CGDisplayFadeReservationToken beginFadeReservation(void) { CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken; if (CGAcquireDisplayFadeReservation(5, &token) == kCGErrorSuccess) { CGDisplayFade(token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE); } return token; } // Ends reservation for display fading // static void endFadeReservation(CGDisplayFadeReservationToken token) { if (token != kCGDisplayFadeReservationInvalidToken) { CGDisplayFade(token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE); CGReleaseDisplayFadeReservation(token); } } // Finds and caches the NSScreen corresponding to the specified monitor // static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor) { if (monitor->ns.screen) return GLFW_TRUE; for (NSScreen* screen in [NSScreen screens]) { NSNumber* displayID = [screen deviceDescription][@"NSScreenNumber"]; // HACK: Compare unit numbers instead of display IDs to work around // display replacement on machines with automatic graphics // switching if (monitor->ns.unitNumber == CGDisplayUnitNumber([displayID unsignedIntValue])) { monitor->ns.screen = screen; return GLFW_TRUE; } } _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find a screen for monitor"); return GLFW_FALSE; } // Returns the display refresh rate queried from the I/O registry // static double getFallbackRefreshRate(CGDirectDisplayID displayID) { double refreshRate = 60.0; io_iterator_t it; io_service_t service; if (IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IOFramebuffer"), &it) != 0) { return refreshRate; } while ((service = IOIteratorNext(it)) != 0) { const CFNumberRef indexRef = IORegistryEntryCreateCFProperty(service, CFSTR("IOFramebufferOpenGLIndex"), kCFAllocatorDefault, kNilOptions); if (!indexRef) continue; uint32_t index = 0; CFNumberGetValue(indexRef, kCFNumberIntType, &index); CFRelease(indexRef); if (CGOpenGLDisplayMaskToDisplayID(1 << index) != displayID) continue; const CFNumberRef clockRef = IORegistryEntryCreateCFProperty(service, CFSTR("IOFBCurrentPixelClock"), kCFAllocatorDefault, kNilOptions); const CFNumberRef countRef = IORegistryEntryCreateCFProperty(service, CFSTR("IOFBCurrentPixelCount"), kCFAllocatorDefault, kNilOptions); if (!clockRef || !countRef) break; uint32_t clock = 0, count = 0; CFNumberGetValue(clockRef, kCFNumberIntType, &clock); CFNumberGetValue(countRef, kCFNumberIntType, &count); CFRelease(clockRef); CFRelease(countRef); if (clock > 0 && count > 0) refreshRate = clock / (double) count; break; } IOObjectRelease(it); return refreshRate; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Poll for changes in the set of connected monitors // void _glfwPollMonitorsNS(void) { uint32_t displayCount; CGGetOnlineDisplayList(0, NULL, &displayCount); CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID)); CGGetOnlineDisplayList(displayCount, displays, &displayCount); for (int i = 0; i < _glfw.monitorCount; i++) _glfw.monitors[i]->ns.screen = nil; _GLFWmonitor** disconnected = NULL; uint32_t disconnectedCount = _glfw.monitorCount; if (disconnectedCount) { disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*)); memcpy(disconnected, _glfw.monitors, _glfw.monitorCount * sizeof(_GLFWmonitor*)); } for (uint32_t i = 0; i < displayCount; i++) { if (CGDisplayIsAsleep(displays[i])) continue; // HACK: Compare unit numbers instead of display IDs to work around // display replacement on machines with automatic graphics // switching const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]); for (uint32_t j = 0; j < disconnectedCount; j++) { if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber) { disconnected[j] = NULL; break; } } const CGSize size = CGDisplayScreenSize(displays[i]); char* name = getDisplayName(displays[i]); if (!name) name = _glfw_strdup("Unknown"); _GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height); monitor->ns.displayID = displays[i]; monitor->ns.unitNumber = unitNumber; free(name); CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]); if (CGDisplayModeGetRefreshRate(mode) == 0.0) monitor->ns.fallbackRefreshRate = getFallbackRefreshRate(displays[i]); CGDisplayModeRelease(mode); _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); } for (uint32_t i = 0; i < disconnectedCount; i++) { if (disconnected[i]) _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0); } free(disconnected); free(displays); } // Change the current video mode // void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired) { GLFWvidmode current; _glfwPlatformGetVideoMode(monitor, ¤t); const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired); if (_glfwCompareVideoModes(¤t, best) == 0) return; CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL); const CFIndex count = CFArrayGetCount(modes); CGDisplayModeRef native = NULL; for (CFIndex i = 0; i < count; i++) { CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); if (!modeIsGood(dm)) continue; const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate); if (_glfwCompareVideoModes(best, &mode) == 0) { native = dm; break; } } if (native) { if (monitor->ns.previousMode == NULL) monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID); CGDisplayFadeReservationToken token = beginFadeReservation(); CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL); endFadeReservation(token); } CFRelease(modes); } // Restore the previously saved (original) video mode // void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor) { if (monitor->ns.previousMode) { CGDisplayFadeReservationToken token = beginFadeReservation(); CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL); endFadeReservation(token); CGDisplayModeRelease(monitor->ns.previousMode); monitor->ns.previousMode = NULL; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) { } void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { @autoreleasepool { const CGRect bounds = CGDisplayBounds(monitor->ns.displayID); if (xpos) *xpos = (int) bounds.origin.x; if (ypos) *ypos = (int) bounds.origin.y; } // autoreleasepool } void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale) { @autoreleasepool { if (!refreshMonitorScreen(monitor)) return; const NSRect points = [monitor->ns.screen frame]; const NSRect pixels = [monitor->ns.screen convertRectToBacking:points]; if (xscale) *xscale = (float) (pixels.size.width / points.size.width); if (yscale) *yscale = (float) (pixels.size.height / points.size.height); } // autoreleasepool } void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height) { @autoreleasepool { if (!refreshMonitorScreen(monitor)) return; const NSRect frameRect = [monitor->ns.screen visibleFrame]; if (xpos) *xpos = frameRect.origin.x; if (ypos) *ypos = _glfwTransformYNS(frameRect.origin.y + frameRect.size.height - 1); if (width) *width = frameRect.size.width; if (height) *height = frameRect.size.height; } // autoreleasepool } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) { @autoreleasepool { *count = 0; CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL); const CFIndex found = CFArrayGetCount(modes); GLFWvidmode* result = calloc(found, sizeof(GLFWvidmode)); for (CFIndex i = 0; i < found; i++) { CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); if (!modeIsGood(dm)) continue; const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate); CFIndex j; for (j = 0; j < *count; j++) { if (_glfwCompareVideoModes(result + j, &mode) == 0) break; } // Skip duplicate modes if (i < *count) continue; (*count)++; result[*count - 1] = mode; } CFRelease(modes); return result; } // autoreleasepool } void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode) { @autoreleasepool { CGDisplayModeRef native = CGDisplayCopyDisplayMode(monitor->ns.displayID); *mode = vidmodeFromCGDisplayMode(native, monitor->ns.fallbackRefreshRate); CGDisplayModeRelease(native); } // autoreleasepool } GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { @autoreleasepool { uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID); CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue)); CGGetDisplayTransferByTable(monitor->ns.displayID, size, values, values + size, values + size * 2, &size); _glfwAllocGammaArrays(ramp, size); for (uint32_t i = 0; i < size; i++) { ramp->red[i] = (unsigned short) (values[i] * 65535); ramp->green[i] = (unsigned short) (values[i + size] * 65535); ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535); } free(values); return GLFW_TRUE; } // autoreleasepool } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { @autoreleasepool { CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue)); for (unsigned int i = 0; i < ramp->size; i++) { values[i] = ramp->red[i] / 65535.f; values[i + ramp->size] = ramp->green[i] / 65535.f; values[i + ramp->size * 2] = ramp->blue[i] / 65535.f; } CGSetDisplayTransferByTable(monitor->ns.displayID, ramp->size, values, values + ramp->size, values + ramp->size * 2); free(values); } // autoreleasepool } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay); return monitor->ns.displayID; } ================================================ FILE: thirdparty/glfw/src/cocoa_platform.h ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 // NOTE: All of NSGL was deprecated in the 10.14 SDK // This disables the pointless warnings for every symbol we use #define GL_SILENCE_DEPRECATION #if defined(__OBJC__) #import #else typedef void* id; #endif // NOTE: Many Cocoa enum values have been renamed and we need to build across // SDK versions where one is unavailable or the other deprecated // We use the newer names in code and these macros to handle compatibility #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat #define NSEventMaskAny NSAnyEventMask #define NSEventMaskKeyUp NSKeyUpMask #define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask #define NSEventModifierFlagCommand NSCommandKeyMask #define NSEventModifierFlagControl NSControlKeyMask #define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask #define NSEventModifierFlagOption NSAlternateKeyMask #define NSEventModifierFlagShift NSShiftKeyMask #define NSEventTypeApplicationDefined NSApplicationDefined #define NSWindowStyleMaskBorderless NSBorderlessWindowMask #define NSWindowStyleMaskClosable NSClosableWindowMask #define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask #define NSWindowStyleMaskResizable NSResizableWindowMask #define NSWindowStyleMaskTitled NSTitledWindowMask #endif typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; typedef VkFlags VkMetalSurfaceCreateFlagsEXT; typedef struct VkMacOSSurfaceCreateInfoMVK { VkStructureType sType; const void* pNext; VkMacOSSurfaceCreateFlagsMVK flags; const void* pView; } VkMacOSSurfaceCreateInfoMVK; typedef struct VkMetalSurfaceCreateInfoEXT { VkStructureType sType; const void* pNext; VkMetalSurfaceCreateFlagsEXT flags; const void* pLayer; } VkMetalSurfaceCreateInfoEXT; typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMetalSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*); #include "posix_thread.h" #include "cocoa_joystick.h" #include "nsgl_context.h" #include "egl_context.h" #include "osmesa_context.h" #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlsym(handle, name) dlsym(handle, name) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.view) #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns #define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerNS ns #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNS ns #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns // HIToolbox.framework pointer typedefs #define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void); #define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef); #define TISGetInputSourceProperty _glfw.ns.tis.GetInputSourceProperty typedef UInt8 (*PFN_LMGetKbdType)(void); #define LMGetKbdType _glfw.ns.tis.GetKbdType // Cocoa-specific per-window data // typedef struct _GLFWwindowNS { id object; id delegate; id view; id layer; GLFWbool maximized; GLFWbool retina; // Cached window properties to filter out duplicate events int width, height; int fbWidth, fbHeight; float xscale, yscale; // The total sum of the distances the cursor has been warped // since the last cursor motion event was processed // This is kept to counteract Cocoa doing the same internally double cursorWarpDeltaX, cursorWarpDeltaY; } _GLFWwindowNS; // Cocoa-specific global data // typedef struct _GLFWlibraryNS { CGEventSourceRef eventSource; id delegate; GLFWbool finishedLaunching; GLFWbool cursorHidden; TISInputSourceRef inputSource; IOHIDManagerRef hidManager; id unicodeData; id helper; id keyUpMonitor; id nibObjects; char keynames[GLFW_KEY_LAST + 1][17]; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; char* clipboardString; CGPoint cascadePoint; // Where to place the cursor when re-enabled double restoreCursorPosX, restoreCursorPosY; // The window whose disabled cursor mode is active _GLFWwindow* disabledCursorWindow; struct { CFBundleRef bundle; PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource; PFN_TISGetInputSourceProperty GetInputSourceProperty; PFN_LMGetKbdType GetKbdType; CFStringRef kPropertyUnicodeKeyLayoutData; } tis; } _GLFWlibraryNS; // Cocoa-specific per-monitor data // typedef struct _GLFWmonitorNS { CGDirectDisplayID displayID; CGDisplayModeRef previousMode; uint32_t unitNumber; id screen; double fallbackRefreshRate; } _GLFWmonitorNS; // Cocoa-specific per-cursor data // typedef struct _GLFWcursorNS { id object; } _GLFWcursorNS; // Cocoa-specific global timer data // typedef struct _GLFWtimerNS { uint64_t frequency; } _GLFWtimerNS; void _glfwInitTimerNS(void); void _glfwPollMonitorsNS(void); void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor); float _glfwTransformYNS(float y); void* _glfwLoadLocalVulkanLoaderNS(void); ================================================ FILE: thirdparty/glfw/src/cocoa_time.c ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2016 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialise timer // void _glfwInitTimerNS(void) { mach_timebase_info_data_t info; mach_timebase_info(&info); _glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// uint64_t _glfwPlatformGetTimerValue(void) { return mach_absolute_time(); } uint64_t _glfwPlatformGetTimerFrequency(void) { return _glfw.timer.ns.frequency; } ================================================ FILE: thirdparty/glfw/src/cocoa_window.m ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include // Returns the style mask corresponding to the window settings // static NSUInteger getStyleMask(_GLFWwindow* window) { NSUInteger styleMask = NSWindowStyleMaskMiniaturizable; if (window->monitor || !window->decorated) styleMask |= NSWindowStyleMaskBorderless; else { styleMask |= NSWindowStyleMaskTitled | NSWindowStyleMaskClosable; if (window->resizable) styleMask |= NSWindowStyleMaskResizable; } return styleMask; } // Returns whether the cursor is in the content area of the specified window // static GLFWbool cursorInContentArea(_GLFWwindow* window) { const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; return [window->ns.view mouse:pos inRect:[window->ns.view frame]]; } // Hides the cursor if not already hidden // static void hideCursor(_GLFWwindow* window) { if (!_glfw.ns.cursorHidden) { [NSCursor hide]; _glfw.ns.cursorHidden = GLFW_TRUE; } } // Shows the cursor if not already shown // static void showCursor(_GLFWwindow* window) { if (_glfw.ns.cursorHidden) { [NSCursor unhide]; _glfw.ns.cursorHidden = GLFW_FALSE; } } // Updates the cursor image according to its cursor mode // static void updateCursorImage(_GLFWwindow* window) { if (window->cursorMode == GLFW_CURSOR_NORMAL) { showCursor(window); if (window->cursor) [(NSCursor*) window->cursor->ns.object set]; else [[NSCursor arrowCursor] set]; } else hideCursor(window); } // Apply chosen cursor mode to a focused window // static void updateCursorMode(_GLFWwindow* window) { if (window->cursorMode == GLFW_CURSOR_DISABLED) { _glfw.ns.disabledCursorWindow = window; _glfwPlatformGetCursorPos(window, &_glfw.ns.restoreCursorPosX, &_glfw.ns.restoreCursorPosY); _glfwCenterCursorInContentArea(window); CGAssociateMouseAndMouseCursorPosition(false); } else if (_glfw.ns.disabledCursorWindow == window) { _glfw.ns.disabledCursorWindow = NULL; CGAssociateMouseAndMouseCursorPosition(true); _glfwPlatformSetCursorPos(window, _glfw.ns.restoreCursorPosX, _glfw.ns.restoreCursorPosY); } if (cursorInContentArea(window)) updateCursorImage(window); } // Make the specified window and its video mode active on its monitor // static void acquireMonitor(_GLFWwindow* window) { _glfwSetVideoModeNS(window->monitor, &window->videoMode); const CGRect bounds = CGDisplayBounds(window->monitor->ns.displayID); const NSRect frame = NSMakeRect(bounds.origin.x, _glfwTransformYNS(bounds.origin.y + bounds.size.height - 1), bounds.size.width, bounds.size.height); [window->ns.object setFrame:frame display:YES]; _glfwInputMonitorWindow(window->monitor, window); } // Remove the window and restore the original video mode // static void releaseMonitor(_GLFWwindow* window) { if (window->monitor->window != window) return; _glfwInputMonitorWindow(window->monitor, NULL); _glfwRestoreVideoModeNS(window->monitor); } // Translates macOS key modifiers into GLFW ones // static int translateFlags(NSUInteger flags) { int mods = 0; if (flags & NSEventModifierFlagShift) mods |= GLFW_MOD_SHIFT; if (flags & NSEventModifierFlagControl) mods |= GLFW_MOD_CONTROL; if (flags & NSEventModifierFlagOption) mods |= GLFW_MOD_ALT; if (flags & NSEventModifierFlagCommand) mods |= GLFW_MOD_SUPER; if (flags & NSEventModifierFlagCapsLock) mods |= GLFW_MOD_CAPS_LOCK; return mods; } // Translates a macOS keycode to a GLFW keycode // static int translateKey(unsigned int key) { if (key >= sizeof(_glfw.ns.keycodes) / sizeof(_glfw.ns.keycodes[0])) return GLFW_KEY_UNKNOWN; return _glfw.ns.keycodes[key]; } // Translate a GLFW keycode to a Cocoa modifier flag // static NSUInteger translateKeyToModifierFlag(int key) { switch (key) { case GLFW_KEY_LEFT_SHIFT: case GLFW_KEY_RIGHT_SHIFT: return NSEventModifierFlagShift; case GLFW_KEY_LEFT_CONTROL: case GLFW_KEY_RIGHT_CONTROL: return NSEventModifierFlagControl; case GLFW_KEY_LEFT_ALT: case GLFW_KEY_RIGHT_ALT: return NSEventModifierFlagOption; case GLFW_KEY_LEFT_SUPER: case GLFW_KEY_RIGHT_SUPER: return NSEventModifierFlagCommand; case GLFW_KEY_CAPS_LOCK: return NSEventModifierFlagCapsLock; } return 0; } // Defines a constant for empty ranges in NSTextInputClient // static const NSRange kEmptyRange = { NSNotFound, 0 }; //------------------------------------------------------------------------ // Delegate for window related notifications //------------------------------------------------------------------------ @interface GLFWWindowDelegate : NSObject { _GLFWwindow* window; } - (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow; @end @implementation GLFWWindowDelegate - (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow { self = [super init]; if (self != nil) window = initWindow; return self; } - (BOOL)windowShouldClose:(id)sender { _glfwInputWindowCloseRequest(window); return NO; } - (void)windowDidResize:(NSNotification *)notification { if (window->context.client != GLFW_NO_API) [window->context.nsgl.object update]; if (_glfw.ns.disabledCursorWindow == window) _glfwCenterCursorInContentArea(window); const int maximized = [window->ns.object isZoomed]; if (window->ns.maximized != maximized) { window->ns.maximized = maximized; _glfwInputWindowMaximize(window, maximized); } const NSRect contentRect = [window->ns.view frame]; const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; if (fbRect.size.width != window->ns.fbWidth || fbRect.size.height != window->ns.fbHeight) { window->ns.fbWidth = fbRect.size.width; window->ns.fbHeight = fbRect.size.height; _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); } if (contentRect.size.width != window->ns.width || contentRect.size.height != window->ns.height) { window->ns.width = contentRect.size.width; window->ns.height = contentRect.size.height; _glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height); } } - (void)windowDidMove:(NSNotification *)notification { if (window->context.client != GLFW_NO_API) [window->context.nsgl.object update]; if (_glfw.ns.disabledCursorWindow == window) _glfwCenterCursorInContentArea(window); int x, y; _glfwPlatformGetWindowPos(window, &x, &y); _glfwInputWindowPos(window, x, y); } - (void)windowDidMiniaturize:(NSNotification *)notification { if (window->monitor) releaseMonitor(window); _glfwInputWindowIconify(window, GLFW_TRUE); } - (void)windowDidDeminiaturize:(NSNotification *)notification { if (window->monitor) acquireMonitor(window); _glfwInputWindowIconify(window, GLFW_FALSE); } - (void)windowDidBecomeKey:(NSNotification *)notification { if (_glfw.ns.disabledCursorWindow == window) _glfwCenterCursorInContentArea(window); _glfwInputWindowFocus(window, GLFW_TRUE); updateCursorMode(window); } - (void)windowDidResignKey:(NSNotification *)notification { if (window->monitor && window->autoIconify) _glfwPlatformIconifyWindow(window); _glfwInputWindowFocus(window, GLFW_FALSE); } @end //------------------------------------------------------------------------ // Content view class for the GLFW window //------------------------------------------------------------------------ @interface GLFWContentView : NSView { _GLFWwindow* window; NSTrackingArea* trackingArea; NSMutableAttributedString* markedText; } - (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow; @end @implementation GLFWContentView - (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow { self = [super init]; if (self != nil) { window = initWindow; trackingArea = nil; markedText = [[NSMutableAttributedString alloc] init]; [self updateTrackingAreas]; // NOTE: kUTTypeURL corresponds to NSPasteboardTypeURL but is available // on 10.7 without having been deprecated yet [self registerForDraggedTypes:@[(__bridge NSString*) kUTTypeURL]]; } return self; } - (void)dealloc { [trackingArea release]; [markedText release]; [super dealloc]; } - (BOOL)isOpaque { return [window->ns.object isOpaque]; } - (BOOL)canBecomeKeyView { return YES; } - (BOOL)acceptsFirstResponder { return YES; } - (BOOL)wantsUpdateLayer { return YES; } - (void)updateLayer { if (window->context.client != GLFW_NO_API) [window->context.nsgl.object update]; _glfwInputWindowDamage(window); } - (void)cursorUpdate:(NSEvent *)event { updateCursorImage(window); } - (BOOL)acceptsFirstMouse:(NSEvent *)event { return YES; } - (void)mouseDown:(NSEvent *)event { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, translateFlags([event modifierFlags])); } - (void)mouseDragged:(NSEvent *)event { [self mouseMoved:event]; } - (void)mouseUp:(NSEvent *)event { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, translateFlags([event modifierFlags])); } - (void)mouseMoved:(NSEvent *)event { if (window->cursorMode == GLFW_CURSOR_DISABLED) { const double dx = [event deltaX] - window->ns.cursorWarpDeltaX; const double dy = [event deltaY] - window->ns.cursorWarpDeltaY; _glfwInputCursorPos(window, window->virtualCursorPosX + dx, window->virtualCursorPosY + dy); } else { const NSRect contentRect = [window->ns.view frame]; // NOTE: The returned location uses base 0,1 not 0,0 const NSPoint pos = [event locationInWindow]; _glfwInputCursorPos(window, pos.x, contentRect.size.height - pos.y); } window->ns.cursorWarpDeltaX = 0; window->ns.cursorWarpDeltaY = 0; } - (void)rightMouseDown:(NSEvent *)event { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, translateFlags([event modifierFlags])); } - (void)rightMouseDragged:(NSEvent *)event { [self mouseMoved:event]; } - (void)rightMouseUp:(NSEvent *)event { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE, translateFlags([event modifierFlags])); } - (void)otherMouseDown:(NSEvent *)event { _glfwInputMouseClick(window, (int) [event buttonNumber], GLFW_PRESS, translateFlags([event modifierFlags])); } - (void)otherMouseDragged:(NSEvent *)event { [self mouseMoved:event]; } - (void)otherMouseUp:(NSEvent *)event { _glfwInputMouseClick(window, (int) [event buttonNumber], GLFW_RELEASE, translateFlags([event modifierFlags])); } - (void)mouseExited:(NSEvent *)event { if (window->cursorMode == GLFW_CURSOR_HIDDEN) showCursor(window); _glfwInputCursorEnter(window, GLFW_FALSE); } - (void)mouseEntered:(NSEvent *)event { if (window->cursorMode == GLFW_CURSOR_HIDDEN) hideCursor(window); _glfwInputCursorEnter(window, GLFW_TRUE); } - (void)viewDidChangeBackingProperties { const NSRect contentRect = [window->ns.view frame]; const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; if (fbRect.size.width != window->ns.fbWidth || fbRect.size.height != window->ns.fbHeight) { window->ns.fbWidth = fbRect.size.width; window->ns.fbHeight = fbRect.size.height; _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); } const float xscale = fbRect.size.width / contentRect.size.width; const float yscale = fbRect.size.height / contentRect.size.height; if (xscale != window->ns.xscale || yscale != window->ns.yscale) { window->ns.xscale = xscale; window->ns.yscale = yscale; _glfwInputWindowContentScale(window, xscale, yscale); if (window->ns.retina && window->ns.layer) [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]]; } } - (void)drawRect:(NSRect)rect { _glfwInputWindowDamage(window); } - (void)updateTrackingAreas { if (trackingArea != nil) { [self removeTrackingArea:trackingArea]; [trackingArea release]; } const NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingEnabledDuringMouseDrag | NSTrackingCursorUpdate | NSTrackingInVisibleRect | NSTrackingAssumeInside; trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] options:options owner:self userInfo:nil]; [self addTrackingArea:trackingArea]; [super updateTrackingAreas]; } - (void)keyDown:(NSEvent *)event { const int key = translateKey([event keyCode]); const int mods = translateFlags([event modifierFlags]); _glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods); [self interpretKeyEvents:@[event]]; } - (void)flagsChanged:(NSEvent *)event { int action; const unsigned int modifierFlags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask; const int key = translateKey([event keyCode]); const int mods = translateFlags(modifierFlags); const NSUInteger keyFlag = translateKeyToModifierFlag(key); if (keyFlag & modifierFlags) { if (window->keys[key] == GLFW_PRESS) action = GLFW_RELEASE; else action = GLFW_PRESS; } else action = GLFW_RELEASE; _glfwInputKey(window, key, [event keyCode], action, mods); } - (void)keyUp:(NSEvent *)event { const int key = translateKey([event keyCode]); const int mods = translateFlags([event modifierFlags]); _glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods); } - (void)scrollWheel:(NSEvent *)event { double deltaX = [event scrollingDeltaX]; double deltaY = [event scrollingDeltaY]; if ([event hasPreciseScrollingDeltas]) { deltaX *= 0.1; deltaY *= 0.1; } if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0) _glfwInputScroll(window, deltaX, deltaY); } - (NSDragOperation)draggingEntered:(id )sender { // HACK: We don't know what to say here because we don't know what the // application wants to do with the paths return NSDragOperationGeneric; } - (BOOL)performDragOperation:(id )sender { const NSRect contentRect = [window->ns.view frame]; // NOTE: The returned location uses base 0,1 not 0,0 const NSPoint pos = [sender draggingLocation]; _glfwInputCursorPos(window, pos.x, contentRect.size.height - pos.y); NSPasteboard* pasteboard = [sender draggingPasteboard]; NSDictionary* options = @{NSPasteboardURLReadingFileURLsOnlyKey:@YES}; NSArray* urls = [pasteboard readObjectsForClasses:@[[NSURL class]] options:options]; const NSUInteger count = [urls count]; if (count) { char** paths = calloc(count, sizeof(char*)); for (NSUInteger i = 0; i < count; i++) paths[i] = _glfw_strdup([urls[i] fileSystemRepresentation]); _glfwInputDrop(window, (int) count, (const char**) paths); for (NSUInteger i = 0; i < count; i++) free(paths[i]); free(paths); } return YES; } - (BOOL)hasMarkedText { return [markedText length] > 0; } - (NSRange)markedRange { if ([markedText length] > 0) return NSMakeRange(0, [markedText length] - 1); else return kEmptyRange; } - (NSRange)selectedRange { return kEmptyRange; } - (void)setMarkedText:(id)string selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { [markedText release]; if ([string isKindOfClass:[NSAttributedString class]]) markedText = [[NSMutableAttributedString alloc] initWithAttributedString:string]; else markedText = [[NSMutableAttributedString alloc] initWithString:string]; } - (void)unmarkText { [[markedText mutableString] setString:@""]; } - (NSArray*)validAttributesForMarkedText { return [NSArray array]; } - (NSAttributedString*)attributedSubstringForProposedRange:(NSRange)range actualRange:(NSRangePointer)actualRange { return nil; } - (NSUInteger)characterIndexForPoint:(NSPoint)point { return 0; } - (NSRect)firstRectForCharacterRange:(NSRange)range actualRange:(NSRangePointer)actualRange { const NSRect frame = [window->ns.view frame]; return NSMakeRect(frame.origin.x, frame.origin.y, 0.0, 0.0); } - (void)insertText:(id)string replacementRange:(NSRange)replacementRange { NSString* characters; NSEvent* event = [NSApp currentEvent]; const int mods = translateFlags([event modifierFlags]); const int plain = !(mods & GLFW_MOD_SUPER); if ([string isKindOfClass:[NSAttributedString class]]) characters = [string string]; else characters = (NSString*) string; const NSUInteger length = [characters length]; for (NSUInteger i = 0; i < length; i++) { const unichar codepoint = [characters characterAtIndex:i]; if ((codepoint & 0xff00) == 0xf700) continue; _glfwInputChar(window, codepoint, mods, plain); } } - (void)doCommandBySelector:(SEL)selector { } @end //------------------------------------------------------------------------ // GLFW window class //------------------------------------------------------------------------ @interface GLFWWindow : NSWindow {} @end @implementation GLFWWindow - (BOOL)canBecomeKeyWindow { // Required for NSWindowStyleMaskBorderless windows return YES; } - (BOOL)canBecomeMainWindow { return YES; } @end // Create the Cocoa window // static GLFWbool createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig) { window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window]; if (window->ns.delegate == nil) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create window delegate"); return GLFW_FALSE; } NSRect contentRect; if (window->monitor) { GLFWvidmode mode; int xpos, ypos; _glfwPlatformGetVideoMode(window->monitor, &mode); _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); contentRect = NSMakeRect(xpos, ypos, mode.width, mode.height); } else contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); window->ns.object = [[GLFWWindow alloc] initWithContentRect:contentRect styleMask:getStyleMask(window) backing:NSBackingStoreBuffered defer:NO]; if (window->ns.object == nil) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create window"); return GLFW_FALSE; } if (window->monitor) [window->ns.object setLevel:NSMainMenuWindowLevel + 1]; else { [(NSWindow*) window->ns.object center]; _glfw.ns.cascadePoint = NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint: NSPointFromCGPoint(_glfw.ns.cascadePoint)]); if (wndconfig->resizable) { const NSWindowCollectionBehavior behavior = NSWindowCollectionBehaviorFullScreenPrimary | NSWindowCollectionBehaviorManaged; [window->ns.object setCollectionBehavior:behavior]; } if (wndconfig->floating) [window->ns.object setLevel:NSFloatingWindowLevel]; if (wndconfig->maximized) [window->ns.object zoom:nil]; } if (strlen(wndconfig->ns.frameName)) [window->ns.object setFrameAutosaveName:@(wndconfig->ns.frameName)]; window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window]; window->ns.retina = wndconfig->ns.retina; if (fbconfig->transparent) { [window->ns.object setOpaque:NO]; [window->ns.object setHasShadow:NO]; [window->ns.object setBackgroundColor:[NSColor clearColor]]; } [window->ns.object setContentView:window->ns.view]; [window->ns.object makeFirstResponder:window->ns.view]; [window->ns.object setTitle:@(wndconfig->title)]; [window->ns.object setDelegate:window->ns.delegate]; [window->ns.object setAcceptsMouseMovedEvents:YES]; [window->ns.object setRestorable:NO]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 if ([window->ns.object respondsToSelector:@selector(setTabbingMode:)]) [window->ns.object setTabbingMode:NSWindowTabbingModeDisallowed]; #endif _glfwPlatformGetWindowSize(window, &window->ns.width, &window->ns.height); _glfwPlatformGetFramebufferSize(window, &window->ns.fbWidth, &window->ns.fbHeight); return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Transforms a y-coordinate between the CG display and NS screen spaces // float _glfwTransformYNS(float y) { return CGDisplayBounds(CGMainDisplayID()).size.height - y - 1; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { @autoreleasepool { if (!_glfw.ns.finishedLaunching) [NSApp run]; if (!createNativeWindow(window, wndconfig, fbconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) { if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { if (!_glfwInitNSGL()) return GLFW_FALSE; if (!_glfwCreateContextNSGL(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) { if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { if (!_glfwInitOSMesa()) return GLFW_FALSE; if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } } if (window->monitor) { _glfwPlatformShowWindow(window); _glfwPlatformFocusWindow(window); acquireMonitor(window); } return GLFW_TRUE; } // autoreleasepool } void _glfwPlatformDestroyWindow(_GLFWwindow* window) { @autoreleasepool { if (_glfw.ns.disabledCursorWindow == window) _glfw.ns.disabledCursorWindow = NULL; [window->ns.object orderOut:nil]; if (window->monitor) releaseMonitor(window); if (window->context.destroy) window->context.destroy(window); [window->ns.object setDelegate:nil]; [window->ns.delegate release]; window->ns.delegate = nil; [window->ns.view release]; window->ns.view = nil; [window->ns.object close]; window->ns.object = nil; // HACK: Allow Cocoa to catch up before returning _glfwPlatformPollEvents(); } // autoreleasepool } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { @autoreleasepool { NSString* string = @(title); [window->ns.object setTitle:string]; // HACK: Set the miniwindow title explicitly as setTitle: doesn't update it // if the window lacks NSWindowStyleMaskTitled [window->ns.object setMiniwindowTitle:string]; } // autoreleasepool } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images) { // Regular windows do not have icons } void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { @autoreleasepool { const NSRect contentRect = [window->ns.object contentRectForFrameRect:[window->ns.object frame]]; if (xpos) *xpos = contentRect.origin.x; if (ypos) *ypos = _glfwTransformYNS(contentRect.origin.y + contentRect.size.height - 1); } // autoreleasepool } void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y) { @autoreleasepool { const NSRect contentRect = [window->ns.view frame]; const NSRect dummyRect = NSMakeRect(x, _glfwTransformYNS(y + contentRect.size.height - 1), 0, 0); const NSRect frameRect = [window->ns.object frameRectForContentRect:dummyRect]; [window->ns.object setFrameOrigin:frameRect.origin]; } // autoreleasepool } void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { @autoreleasepool { const NSRect contentRect = [window->ns.view frame]; if (width) *width = contentRect.size.width; if (height) *height = contentRect.size.height; } // autoreleasepool } void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { @autoreleasepool { if (window->monitor) { if (window->monitor->window == window) acquireMonitor(window); } else { NSRect contentRect = [window->ns.object contentRectForFrameRect:[window->ns.object frame]]; contentRect.origin.y += contentRect.size.height - height; contentRect.size = NSMakeSize(width, height); [window->ns.object setFrame:[window->ns.object frameRectForContentRect:contentRect] display:YES]; } } // autoreleasepool } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { @autoreleasepool { if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) [window->ns.object setContentMinSize:NSMakeSize(0, 0)]; else [window->ns.object setContentMinSize:NSMakeSize(minwidth, minheight)]; if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE) [window->ns.object setContentMaxSize:NSMakeSize(DBL_MAX, DBL_MAX)]; else [window->ns.object setContentMaxSize:NSMakeSize(maxwidth, maxheight)]; } // autoreleasepool } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom) { @autoreleasepool { if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE) [window->ns.object setResizeIncrements:NSMakeSize(1.0, 1.0)]; else [window->ns.object setContentAspectRatio:NSMakeSize(numer, denom)]; } // autoreleasepool } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { @autoreleasepool { const NSRect contentRect = [window->ns.view frame]; const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; if (width) *width = (int) fbRect.size.width; if (height) *height = (int) fbRect.size.height; } // autoreleasepool } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { @autoreleasepool { const NSRect contentRect = [window->ns.view frame]; const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect]; if (left) *left = contentRect.origin.x - frameRect.origin.x; if (top) *top = frameRect.origin.y + frameRect.size.height - contentRect.origin.y - contentRect.size.height; if (right) *right = frameRect.origin.x + frameRect.size.width - contentRect.origin.x - contentRect.size.width; if (bottom) *bottom = contentRect.origin.y - frameRect.origin.y; } // autoreleasepool } void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale) { @autoreleasepool { const NSRect points = [window->ns.view frame]; const NSRect pixels = [window->ns.view convertRectToBacking:points]; if (xscale) *xscale = (float) (pixels.size.width / points.size.width); if (yscale) *yscale = (float) (pixels.size.height / points.size.height); } // autoreleasepool } void _glfwPlatformIconifyWindow(_GLFWwindow* window) { @autoreleasepool { [window->ns.object miniaturize:nil]; } // autoreleasepool } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { @autoreleasepool { if ([window->ns.object isMiniaturized]) [window->ns.object deminiaturize:nil]; else if ([window->ns.object isZoomed]) [window->ns.object zoom:nil]; } // autoreleasepool } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { @autoreleasepool { if (![window->ns.object isZoomed]) [window->ns.object zoom:nil]; } // autoreleasepool } void _glfwPlatformShowWindow(_GLFWwindow* window) { @autoreleasepool { [window->ns.object orderFront:nil]; } // autoreleasepool } void _glfwPlatformHideWindow(_GLFWwindow* window) { @autoreleasepool { [window->ns.object orderOut:nil]; } // autoreleasepool } void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { @autoreleasepool { [NSApp requestUserAttention:NSInformationalRequest]; } // autoreleasepool } void _glfwPlatformFocusWindow(_GLFWwindow* window) { @autoreleasepool { // Make us the active application // HACK: This is here to prevent applications using only hidden windows from // being activated, but should probably not be done every time any // window is shown [NSApp activateIgnoringOtherApps:YES]; [window->ns.object makeKeyAndOrderFront:nil]; } // autoreleasepool } void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate) { @autoreleasepool { if (window->monitor == monitor) { if (monitor) { if (monitor->window == window) acquireMonitor(window); } else { const NSRect contentRect = NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height); const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect styleMask:getStyleMask(window)]; [window->ns.object setFrame:frameRect display:YES]; } return; } if (window->monitor) releaseMonitor(window); _glfwInputWindowMonitor(window, monitor); // HACK: Allow the state cached in Cocoa to catch up to reality // TODO: Solve this in a less terrible way _glfwPlatformPollEvents(); const NSUInteger styleMask = getStyleMask(window); [window->ns.object setStyleMask:styleMask]; // HACK: Changing the style mask can cause the first responder to be cleared [window->ns.object makeFirstResponder:window->ns.view]; if (window->monitor) { [window->ns.object setLevel:NSMainMenuWindowLevel + 1]; [window->ns.object setHasShadow:NO]; acquireMonitor(window); } else { NSRect contentRect = NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height); NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect styleMask:styleMask]; [window->ns.object setFrame:frameRect display:YES]; if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) { [window->ns.object setContentAspectRatio:NSMakeSize(window->numer, window->denom)]; } if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) { [window->ns.object setContentMinSize:NSMakeSize(window->minwidth, window->minheight)]; } if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) { [window->ns.object setContentMaxSize:NSMakeSize(window->maxwidth, window->maxheight)]; } if (window->floating) [window->ns.object setLevel:NSFloatingWindowLevel]; else [window->ns.object setLevel:NSNormalWindowLevel]; [window->ns.object setHasShadow:YES]; // HACK: Clearing NSWindowStyleMaskTitled resets and disables the window // title property but the miniwindow title property is unaffected [window->ns.object setTitle:[window->ns.object miniwindowTitle]]; } } // autoreleasepool } int _glfwPlatformWindowFocused(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isKeyWindow]; } // autoreleasepool } int _glfwPlatformWindowIconified(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isMiniaturized]; } // autoreleasepool } int _glfwPlatformWindowVisible(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isVisible]; } // autoreleasepool } int _glfwPlatformWindowMaximized(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isZoomed]; } // autoreleasepool } int _glfwPlatformWindowHovered(_GLFWwindow* window) { @autoreleasepool { const NSPoint point = [NSEvent mouseLocation]; if ([NSWindow windowNumberAtPoint:point belowWindowWithWindowNumber:0] != [window->ns.object windowNumber]) { return GLFW_FALSE; } return NSMouseInRect(point, [window->ns.object convertRectToScreen:[window->ns.view frame]], NO); } // autoreleasepool } int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { @autoreleasepool { return ![window->ns.object isOpaque] && ![window->ns.view isOpaque]; } // autoreleasepool } void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { [window->ns.object setStyleMask:getStyleMask(window)]; } // autoreleasepool } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { [window->ns.object setStyleMask:getStyleMask(window)]; [window->ns.object makeFirstResponder:window->ns.view]; } // autoreleasepool } void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { if (enabled) [window->ns.object setLevel:NSFloatingWindowLevel]; else [window->ns.object setLevel:NSNormalWindowLevel]; } // autoreleasepool } float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { @autoreleasepool { return (float) [window->ns.object alphaValue]; } // autoreleasepool } void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { @autoreleasepool { [window->ns.object setAlphaValue:opacity]; } // autoreleasepool } void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled) { } GLFWbool _glfwPlatformRawMouseMotionSupported(void) { return GLFW_FALSE; } void _glfwPlatformPollEvents(void) { @autoreleasepool { if (!_glfw.ns.finishedLaunching) [NSApp run]; for (;;) { NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; if (event == nil) break; [NSApp sendEvent:event]; } } // autoreleasepool } void _glfwPlatformWaitEvents(void) { @autoreleasepool { if (!_glfw.ns.finishedLaunching) [NSApp run]; // I wanted to pass NO to dequeue:, and rely on PollEvents to // dequeue and send. For reasons not at all clear to me, passing // NO to dequeue: causes this method never to return. NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]; [NSApp sendEvent:event]; _glfwPlatformPollEvents(); } // autoreleasepool } void _glfwPlatformWaitEventsTimeout(double timeout) { @autoreleasepool { if (!_glfw.ns.finishedLaunching) [NSApp run]; NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout]; NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:date inMode:NSDefaultRunLoopMode dequeue:YES]; if (event) [NSApp sendEvent:event]; _glfwPlatformPollEvents(); } // autoreleasepool } void _glfwPlatformPostEmptyEvent(void) { @autoreleasepool { if (!_glfw.ns.finishedLaunching) [NSApp run]; NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; [NSApp postEvent:event atStart:YES]; } // autoreleasepool } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { @autoreleasepool { const NSRect contentRect = [window->ns.view frame]; // NOTE: The returned location uses base 0,1 not 0,0 const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; if (xpos) *xpos = pos.x; if (ypos) *ypos = contentRect.size.height - pos.y; } // autoreleasepool } void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { @autoreleasepool { updateCursorImage(window); const NSRect contentRect = [window->ns.view frame]; // NOTE: The returned location uses base 0,1 not 0,0 const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; window->ns.cursorWarpDeltaX += x - pos.x; window->ns.cursorWarpDeltaY += y - contentRect.size.height + pos.y; if (window->monitor) { CGDisplayMoveCursorToPoint(window->monitor->ns.displayID, CGPointMake(x, y)); } else { const NSRect localRect = NSMakeRect(x, contentRect.size.height - y - 1, 0, 0); const NSRect globalRect = [window->ns.object convertRectToScreen:localRect]; const NSPoint globalPoint = globalRect.origin; CGWarpMouseCursorPosition(CGPointMake(globalPoint.x, _glfwTransformYNS(globalPoint.y))); } } // autoreleasepool } void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { @autoreleasepool { if (_glfwPlatformWindowFocused(window)) updateCursorMode(window); } // autoreleasepool } const char* _glfwPlatformGetScancodeName(int scancode) { @autoreleasepool { if (scancode < 0 || scancode > 0xff || _glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); return NULL; } const int key = _glfw.ns.keycodes[scancode]; UInt32 deadKeyState = 0; UniChar characters[4]; UniCharCount characterCount = 0; if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes], scancode, kUCKeyActionDisplay, 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, sizeof(characters) / sizeof(characters[0]), &characterCount, characters) != noErr) { return NULL; } if (!characterCount) return NULL; CFStringRef string = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, characterCount, kCFAllocatorNull); CFStringGetCString(string, _glfw.ns.keynames[key], sizeof(_glfw.ns.keynames[key]), kCFStringEncodingUTF8); CFRelease(string); return _glfw.ns.keynames[key]; } // autoreleasepool } int _glfwPlatformGetKeyScancode(int key) { return _glfw.ns.scancodes[key]; } int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) { @autoreleasepool { NSImage* native; NSBitmapImageRep* rep; rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:image->width pixelsHigh:image->height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:NSBitmapFormatAlphaNonpremultiplied bytesPerRow:image->width * 4 bitsPerPixel:32]; if (rep == nil) return GLFW_FALSE; memcpy([rep bitmapData], image->pixels, image->width * image->height * 4); native = [[NSImage alloc] initWithSize:NSMakeSize(image->width, image->height)]; [native addRepresentation:rep]; cursor->ns.object = [[NSCursor alloc] initWithImage:native hotSpot:NSMakePoint(xhot, yhot)]; [native release]; [rep release]; if (cursor->ns.object == nil) return GLFW_FALSE; return GLFW_TRUE; } // autoreleasepool } int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { @autoreleasepool { if (shape == GLFW_ARROW_CURSOR) cursor->ns.object = [NSCursor arrowCursor]; else if (shape == GLFW_IBEAM_CURSOR) cursor->ns.object = [NSCursor IBeamCursor]; else if (shape == GLFW_CROSSHAIR_CURSOR) cursor->ns.object = [NSCursor crosshairCursor]; else if (shape == GLFW_HAND_CURSOR) cursor->ns.object = [NSCursor pointingHandCursor]; else if (shape == GLFW_HRESIZE_CURSOR) cursor->ns.object = [NSCursor resizeLeftRightCursor]; else if (shape == GLFW_VRESIZE_CURSOR) cursor->ns.object = [NSCursor resizeUpDownCursor]; if (!cursor->ns.object) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to retrieve standard cursor"); return GLFW_FALSE; } [cursor->ns.object retain]; return GLFW_TRUE; } // autoreleasepool } void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) { @autoreleasepool { if (cursor->ns.object) [(NSCursor*) cursor->ns.object release]; } // autoreleasepool } void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { @autoreleasepool { if (cursorInContentArea(window)) updateCursorImage(window); } // autoreleasepool } void _glfwPlatformSetClipboardString(const char* string) { @autoreleasepool { NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; [pasteboard declareTypes:@[NSPasteboardTypeString] owner:nil]; [pasteboard setString:@(string) forType:NSPasteboardTypeString]; } // autoreleasepool } const char* _glfwPlatformGetClipboardString(void) { @autoreleasepool { NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; if (![[pasteboard types] containsObject:NSPasteboardTypeString]) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "Cocoa: Failed to retrieve string from pasteboard"); return NULL; } NSString* object = [pasteboard stringForType:NSPasteboardTypeString]; if (!object) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to retrieve object from pasteboard"); return NULL; } free(_glfw.ns.clipboardString); _glfw.ns.clipboardString = _glfw_strdup([object UTF8String]); return _glfw.ns.clipboardString; } // autoreleasepool } void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) { if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface) { extensions[0] = "VK_KHR_surface"; extensions[1] = "VK_EXT_metal_surface"; } else if (_glfw.vk.KHR_surface && _glfw.vk.MVK_macos_surface) { extensions[0] = "VK_KHR_surface"; extensions[1] = "VK_MVK_macos_surface"; } } int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { return GLFW_TRUE; } VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { @autoreleasepool { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 // HACK: Dynamically load Core Animation to avoid adding an extra // dependency for the majority who don't use MoltenVK NSBundle* bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/QuartzCore.framework"]; if (!bundle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find QuartzCore.framework"); return VK_ERROR_EXTENSION_NOT_PRESENT; } // NOTE: Create the layer here as makeBackingLayer should not return nil window->ns.layer = [[bundle classNamed:@"CAMetalLayer"] layer]; if (!window->ns.layer) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create layer for view"); return VK_ERROR_EXTENSION_NOT_PRESENT; } if (window->ns.retina) [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]]; [window->ns.view setLayer:window->ns.layer]; [window->ns.view setWantsLayer:YES]; VkResult err; if (_glfw.vk.EXT_metal_surface) { VkMetalSurfaceCreateInfoEXT sci; PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; vkCreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT) vkGetInstanceProcAddr(instance, "vkCreateMetalSurfaceEXT"); if (!vkCreateMetalSurfaceEXT) { _glfwInputError(GLFW_API_UNAVAILABLE, "Cocoa: Vulkan instance missing VK_EXT_metal_surface extension"); return VK_ERROR_EXTENSION_NOT_PRESENT; } memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT; sci.pLayer = window->ns.layer; err = vkCreateMetalSurfaceEXT(instance, &sci, allocator, surface); } else { VkMacOSSurfaceCreateInfoMVK sci; PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK; vkCreateMacOSSurfaceMVK = (PFN_vkCreateMacOSSurfaceMVK) vkGetInstanceProcAddr(instance, "vkCreateMacOSSurfaceMVK"); if (!vkCreateMacOSSurfaceMVK) { _glfwInputError(GLFW_API_UNAVAILABLE, "Cocoa: Vulkan instance missing VK_MVK_macos_surface extension"); return VK_ERROR_EXTENSION_NOT_PRESENT; } memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; sci.pView = window->ns.view; err = vkCreateMacOSSurfaceMVK(instance, &sci, allocator, surface); } if (err) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create Vulkan surface: %s", _glfwGetVulkanResultString(err)); } return err; #else return VK_ERROR_EXTENSION_NOT_PRESENT; #endif } // autoreleasepool } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(nil); return window->ns.object; } ================================================ FILE: thirdparty/glfw/src/context.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2016 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include #include ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Checks whether the desired context attributes are valid // // This function checks things like whether the specified client API version // exists and whether all relevant options have supported and non-conflicting // values // GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) { if (ctxconfig->share) { if (ctxconfig->client == GLFW_NO_API || ctxconfig->share->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return GLFW_FALSE; } } if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API && ctxconfig->source != GLFW_EGL_CONTEXT_API && ctxconfig->source != GLFW_OSMESA_CONTEXT_API) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid context creation API 0x%08X", ctxconfig->source); return GLFW_FALSE; } if (ctxconfig->client != GLFW_NO_API && ctxconfig->client != GLFW_OPENGL_API && ctxconfig->client != GLFW_OPENGL_ES_API) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid client API 0x%08X", ctxconfig->client); return GLFW_FALSE; } if (ctxconfig->client == GLFW_OPENGL_API) { if ((ctxconfig->major < 1 || ctxconfig->minor < 0) || (ctxconfig->major == 1 && ctxconfig->minor > 5) || (ctxconfig->major == 2 && ctxconfig->minor > 1) || (ctxconfig->major == 3 && ctxconfig->minor > 3)) { // OpenGL 1.0 is the smallest valid version // OpenGL 1.x series ended with version 1.5 // OpenGL 2.x series ended with version 2.1 // OpenGL 3.x series ended with version 3.3 // For now, let everything else through _glfwInputError(GLFW_INVALID_VALUE, "Invalid OpenGL version %i.%i", ctxconfig->major, ctxconfig->minor); return GLFW_FALSE; } if (ctxconfig->profile) { if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE && ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid OpenGL profile 0x%08X", ctxconfig->profile); return GLFW_FALSE; } if (ctxconfig->major <= 2 || (ctxconfig->major == 3 && ctxconfig->minor < 2)) { // Desktop OpenGL context profiles are only defined for version 3.2 // and above _glfwInputError(GLFW_INVALID_VALUE, "Context profiles are only defined for OpenGL version 3.2 and above"); return GLFW_FALSE; } } if (ctxconfig->forward && ctxconfig->major <= 2) { // Forward-compatible contexts are only defined for OpenGL version 3.0 and above _glfwInputError(GLFW_INVALID_VALUE, "Forward-compatibility is only defined for OpenGL version 3.0 and above"); return GLFW_FALSE; } } else if (ctxconfig->client == GLFW_OPENGL_ES_API) { if (ctxconfig->major < 1 || ctxconfig->minor < 0 || (ctxconfig->major == 1 && ctxconfig->minor > 1) || (ctxconfig->major == 2 && ctxconfig->minor > 0)) { // OpenGL ES 1.0 is the smallest valid version // OpenGL ES 1.x series ended with version 1.1 // OpenGL ES 2.x series ended with version 2.0 // For now, let everything else through _glfwInputError(GLFW_INVALID_VALUE, "Invalid OpenGL ES version %i.%i", ctxconfig->major, ctxconfig->minor); return GLFW_FALSE; } } if (ctxconfig->robustness) { if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION && ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid context robustness mode 0x%08X", ctxconfig->robustness); return GLFW_FALSE; } } if (ctxconfig->release) { if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE && ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid context release behavior 0x%08X", ctxconfig->release); return GLFW_FALSE; } } return GLFW_TRUE; } // Chooses the framebuffer config that best matches the desired one // const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, const _GLFWfbconfig* alternatives, unsigned int count) { unsigned int i; unsigned int missing, leastMissing = UINT_MAX; unsigned int colorDiff, leastColorDiff = UINT_MAX; unsigned int extraDiff, leastExtraDiff = UINT_MAX; const _GLFWfbconfig* current; const _GLFWfbconfig* closest = NULL; for (i = 0; i < count; i++) { current = alternatives + i; if (desired->stereo > 0 && current->stereo == 0) { // Stereo is a hard constraint continue; } if (desired->doublebuffer != current->doublebuffer) { // Double buffering is a hard constraint continue; } // Count number of missing buffers { missing = 0; if (desired->alphaBits > 0 && current->alphaBits == 0) missing++; if (desired->depthBits > 0 && current->depthBits == 0) missing++; if (desired->stencilBits > 0 && current->stencilBits == 0) missing++; if (desired->auxBuffers > 0 && current->auxBuffers < desired->auxBuffers) { missing += desired->auxBuffers - current->auxBuffers; } if (desired->samples > 0 && current->samples == 0) { // Technically, several multisampling buffers could be // involved, but that's a lower level implementation detail and // not important to us here, so we count them as one missing++; } if (desired->transparent != current->transparent) missing++; } // These polynomials make many small channel size differences matter // less than one large channel size difference // Calculate color channel size difference value { colorDiff = 0; if (desired->redBits != GLFW_DONT_CARE) { colorDiff += (desired->redBits - current->redBits) * (desired->redBits - current->redBits); } if (desired->greenBits != GLFW_DONT_CARE) { colorDiff += (desired->greenBits - current->greenBits) * (desired->greenBits - current->greenBits); } if (desired->blueBits != GLFW_DONT_CARE) { colorDiff += (desired->blueBits - current->blueBits) * (desired->blueBits - current->blueBits); } } // Calculate non-color channel size difference value { extraDiff = 0; if (desired->alphaBits != GLFW_DONT_CARE) { extraDiff += (desired->alphaBits - current->alphaBits) * (desired->alphaBits - current->alphaBits); } if (desired->depthBits != GLFW_DONT_CARE) { extraDiff += (desired->depthBits - current->depthBits) * (desired->depthBits - current->depthBits); } if (desired->stencilBits != GLFW_DONT_CARE) { extraDiff += (desired->stencilBits - current->stencilBits) * (desired->stencilBits - current->stencilBits); } if (desired->accumRedBits != GLFW_DONT_CARE) { extraDiff += (desired->accumRedBits - current->accumRedBits) * (desired->accumRedBits - current->accumRedBits); } if (desired->accumGreenBits != GLFW_DONT_CARE) { extraDiff += (desired->accumGreenBits - current->accumGreenBits) * (desired->accumGreenBits - current->accumGreenBits); } if (desired->accumBlueBits != GLFW_DONT_CARE) { extraDiff += (desired->accumBlueBits - current->accumBlueBits) * (desired->accumBlueBits - current->accumBlueBits); } if (desired->accumAlphaBits != GLFW_DONT_CARE) { extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) * (desired->accumAlphaBits - current->accumAlphaBits); } if (desired->samples != GLFW_DONT_CARE) { extraDiff += (desired->samples - current->samples) * (desired->samples - current->samples); } if (desired->sRGB && !current->sRGB) extraDiff++; } // Figure out if the current one is better than the best one found so far // Least number of missing buffers is the most important heuristic, // then color buffer size match and lastly size match for other buffers if (missing < leastMissing) closest = current; else if (missing == leastMissing) { if ((colorDiff < leastColorDiff) || (colorDiff == leastColorDiff && extraDiff < leastExtraDiff)) { closest = current; } } if (current == closest) { leastMissing = missing; leastColorDiff = colorDiff; leastExtraDiff = extraDiff; } } return closest; } // Retrieves the attributes of the current context // GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig) { int i; _GLFWwindow* previous; const char* version; const char* prefixes[] = { "OpenGL ES-CM ", "OpenGL ES-CL ", "OpenGL ES ", NULL }; window->context.source = ctxconfig->source; window->context.client = GLFW_OPENGL_API; previous = _glfwPlatformGetTls(&_glfw.contextSlot); glfwMakeContextCurrent((GLFWwindow*) window); window->context.GetIntegerv = (PFNGLGETINTEGERVPROC) window->context.getProcAddress("glGetIntegerv"); window->context.GetString = (PFNGLGETSTRINGPROC) window->context.getProcAddress("glGetString"); if (!window->context.GetIntegerv || !window->context.GetString) { _glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken"); glfwMakeContextCurrent((GLFWwindow*) previous); return GLFW_FALSE; } version = (const char*) window->context.GetString(GL_VERSION); if (!version) { if (ctxconfig->client == GLFW_OPENGL_API) { _glfwInputError(GLFW_PLATFORM_ERROR, "OpenGL version string retrieval is broken"); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "OpenGL ES version string retrieval is broken"); } glfwMakeContextCurrent((GLFWwindow*) previous); return GLFW_FALSE; } for (i = 0; prefixes[i]; i++) { const size_t length = strlen(prefixes[i]); if (strncmp(version, prefixes[i], length) == 0) { version += length; window->context.client = GLFW_OPENGL_ES_API; break; } } if (!sscanf(version, "%d.%d.%d", &window->context.major, &window->context.minor, &window->context.revision)) { if (window->context.client == GLFW_OPENGL_API) { _glfwInputError(GLFW_PLATFORM_ERROR, "No version found in OpenGL version string"); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "No version found in OpenGL ES version string"); } glfwMakeContextCurrent((GLFWwindow*) previous); return GLFW_FALSE; } if (window->context.major < ctxconfig->major || (window->context.major == ctxconfig->major && window->context.minor < ctxconfig->minor)) { // The desired OpenGL version is greater than the actual version // This only happens if the machine lacks {GLX|WGL}_ARB_create_context // /and/ the user has requested an OpenGL version greater than 1.0 // For API consistency, we emulate the behavior of the // {GLX|WGL}_ARB_create_context extension and fail here if (window->context.client == GLFW_OPENGL_API) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "Requested OpenGL version %i.%i, got version %i.%i", ctxconfig->major, ctxconfig->minor, window->context.major, window->context.minor); } else { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "Requested OpenGL ES version %i.%i, got version %i.%i", ctxconfig->major, ctxconfig->minor, window->context.major, window->context.minor); } glfwMakeContextCurrent((GLFWwindow*) previous); return GLFW_FALSE; } if (window->context.major >= 3) { // OpenGL 3.0+ uses a different function for extension string retrieval // We cache it here instead of in glfwExtensionSupported mostly to alert // users as early as possible that their build may be broken window->context.GetStringi = (PFNGLGETSTRINGIPROC) window->context.getProcAddress("glGetStringi"); if (!window->context.GetStringi) { _glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken"); glfwMakeContextCurrent((GLFWwindow*) previous); return GLFW_FALSE; } } if (window->context.client == GLFW_OPENGL_API) { // Read back context flags (OpenGL 3.0 and above) if (window->context.major >= 3) { GLint flags; window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags); if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) window->context.forward = GLFW_TRUE; if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) window->context.debug = GLFW_TRUE; else if (glfwExtensionSupported("GL_ARB_debug_output") && ctxconfig->debug) { // HACK: This is a workaround for older drivers (pre KHR_debug) // not setting the debug bit in the context flags for // debug contexts window->context.debug = GLFW_TRUE; } if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR) window->context.noerror = GLFW_TRUE; } // Read back OpenGL context profile (OpenGL 3.2 and above) if (window->context.major >= 4 || (window->context.major == 3 && window->context.minor >= 2)) { GLint mask; window->context.GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) window->context.profile = GLFW_OPENGL_COMPAT_PROFILE; else if (mask & GL_CONTEXT_CORE_PROFILE_BIT) window->context.profile = GLFW_OPENGL_CORE_PROFILE; else if (glfwExtensionSupported("GL_ARB_compatibility")) { // HACK: This is a workaround for the compatibility profile bit // not being set in the context flags if an OpenGL 3.2+ // context was created without having requested a specific // version window->context.profile = GLFW_OPENGL_COMPAT_PROFILE; } } // Read back robustness strategy if (glfwExtensionSupported("GL_ARB_robustness")) { // NOTE: We avoid using the context flags for detection, as they are // only present from 3.0 while the extension applies from 1.1 GLint strategy; window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy); if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB) window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET; else if (strategy == GL_NO_RESET_NOTIFICATION_ARB) window->context.robustness = GLFW_NO_RESET_NOTIFICATION; } } else { // Read back robustness strategy if (glfwExtensionSupported("GL_EXT_robustness")) { // NOTE: The values of these constants match those of the OpenGL ARB // one, so we can reuse them here GLint strategy; window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy); if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB) window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET; else if (strategy == GL_NO_RESET_NOTIFICATION_ARB) window->context.robustness = GLFW_NO_RESET_NOTIFICATION; } } if (glfwExtensionSupported("GL_KHR_context_flush_control")) { GLint behavior; window->context.GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior); if (behavior == GL_NONE) window->context.release = GLFW_RELEASE_BEHAVIOR_NONE; else if (behavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH; } // Clearing the front buffer to black to avoid garbage pixels left over from // previous uses of our bit of VRAM { PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) window->context.getProcAddress("glClear"); glClear(GL_COLOR_BUFFER_BIT); window->context.swapBuffers(window); } glfwMakeContextCurrent((GLFWwindow*) previous); return GLFW_TRUE; } // Searches an extension string for the specified extension // GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions) { const char* start = extensions; for (;;) { const char* where; const char* terminator; where = strstr(start, string); if (!where) return GLFW_FALSE; terminator = where + strlen(string); if (where == start || *(where - 1) == ' ') { if (*terminator == ' ' || *terminator == '\0') break; } start = terminator; } return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* previous = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFW_REQUIRE_INIT(); if (window && window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, "Cannot make current with a window that has no OpenGL or OpenGL ES context"); return; } if (previous) { if (!window || window->context.source != previous->context.source) previous->context.makeCurrent(NULL); } if (window) window->context.makeCurrent(window); } GLFWAPI GLFWwindow* glfwGetCurrentContext(void) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return _glfwPlatformGetTls(&_glfw.contextSlot); } GLFWAPI void glfwSwapBuffers(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, "Cannot swap buffers of a window that has no OpenGL or OpenGL ES context"); return; } window->context.swapBuffers(window); } GLFWAPI void glfwSwapInterval(int interval) { _GLFWwindow* window; _GLFW_REQUIRE_INIT(); window = _glfwPlatformGetTls(&_glfw.contextSlot); if (!window) { _glfwInputError(GLFW_NO_CURRENT_CONTEXT, "Cannot set swap interval without a current OpenGL or OpenGL ES context"); return; } window->context.swapInterval(interval); } GLFWAPI int glfwExtensionSupported(const char* extension) { _GLFWwindow* window; assert(extension != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); window = _glfwPlatformGetTls(&_glfw.contextSlot); if (!window) { _glfwInputError(GLFW_NO_CURRENT_CONTEXT, "Cannot query extension without a current OpenGL or OpenGL ES context"); return GLFW_FALSE; } if (*extension == '\0') { _glfwInputError(GLFW_INVALID_VALUE, "Extension name cannot be an empty string"); return GLFW_FALSE; } if (window->context.major >= 3) { int i; GLint count; // Check if extension is in the modern OpenGL extensions string list window->context.GetIntegerv(GL_NUM_EXTENSIONS, &count); for (i = 0; i < count; i++) { const char* en = (const char*) window->context.GetStringi(GL_EXTENSIONS, i); if (!en) { _glfwInputError(GLFW_PLATFORM_ERROR, "Extension string retrieval is broken"); return GLFW_FALSE; } if (strcmp(en, extension) == 0) return GLFW_TRUE; } } else { // Check if extension is in the old style OpenGL extensions string const char* extensions = (const char*) window->context.GetString(GL_EXTENSIONS); if (!extensions) { _glfwInputError(GLFW_PLATFORM_ERROR, "Extension string retrieval is broken"); return GLFW_FALSE; } if (_glfwStringInExtensionString(extension, extensions)) return GLFW_TRUE; } // Check if extension is in the platform-specific string return window->context.extensionSupported(extension); } GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname) { _GLFWwindow* window; assert(procname != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); window = _glfwPlatformGetTls(&_glfw.contextSlot); if (!window) { _glfwInputError(GLFW_NO_CURRENT_CONTEXT, "Cannot query entry point without a current OpenGL or OpenGL ES context"); return NULL; } return window->context.getProcAddress(procname); } ================================================ FILE: thirdparty/glfw/src/egl_context.c ================================================ //======================================================================== // GLFW 3.3 EGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include // Return a description of the specified EGL error // static const char* getEGLErrorString(EGLint error) { switch (error) { case EGL_SUCCESS: return "Success"; case EGL_NOT_INITIALIZED: return "EGL is not or could not be initialized"; case EGL_BAD_ACCESS: return "EGL cannot access a requested resource"; case EGL_BAD_ALLOC: return "EGL failed to allocate resources for the requested operation"; case EGL_BAD_ATTRIBUTE: return "An unrecognized attribute or attribute value was passed in the attribute list"; case EGL_BAD_CONTEXT: return "An EGLContext argument does not name a valid EGL rendering context"; case EGL_BAD_CONFIG: return "An EGLConfig argument does not name a valid EGL frame buffer configuration"; case EGL_BAD_CURRENT_SURFACE: return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid"; case EGL_BAD_DISPLAY: return "An EGLDisplay argument does not name a valid EGL display connection"; case EGL_BAD_SURFACE: return "An EGLSurface argument does not name a valid surface configured for GL rendering"; case EGL_BAD_MATCH: return "Arguments are inconsistent"; case EGL_BAD_PARAMETER: return "One or more argument values are invalid"; case EGL_BAD_NATIVE_PIXMAP: return "A NativePixmapType argument does not refer to a valid native pixmap"; case EGL_BAD_NATIVE_WINDOW: return "A NativeWindowType argument does not refer to a valid native window"; case EGL_CONTEXT_LOST: return "The application must destroy all contexts and reinitialise"; default: return "ERROR: UNKNOWN EGL ERROR"; } } // Returns the specified attribute of the specified EGLConfig // static int getEGLConfigAttrib(EGLConfig config, int attrib) { int value; eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value); return value; } // Return the EGLConfig most closely matching the specified hints // static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* desired, EGLConfig* result) { EGLConfig* nativeConfigs; _GLFWfbconfig* usableConfigs; const _GLFWfbconfig* closest; int i, nativeCount, usableCount; eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount); if (!nativeCount) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned"); return GLFW_FALSE; } nativeConfigs = calloc(nativeCount, sizeof(EGLConfig)); eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount); usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig)); usableCount = 0; for (i = 0; i < nativeCount; i++) { const EGLConfig n = nativeConfigs[i]; _GLFWfbconfig* u = usableConfigs + usableCount; // Only consider RGB(A) EGLConfigs if (getEGLConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) != EGL_RGB_BUFFER) continue; // Only consider window EGLConfigs if (!(getEGLConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT)) continue; #if defined(_GLFW_X11) { XVisualInfo vi = {0}; // Only consider EGLConfigs with associated Visuals vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID); if (!vi.visualid) continue; if (desired->transparent) { int count; XVisualInfo* vis = XGetVisualInfo(_glfw.x11.display, VisualIDMask, &vi, &count); if (vis) { u->transparent = _glfwIsVisualTransparentX11(vis[0].visual); XFree(vis); } } } #endif // _GLFW_X11 if (ctxconfig->client == GLFW_OPENGL_ES_API) { if (ctxconfig->major == 1) { if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT)) continue; } else { if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT)) continue; } } else if (ctxconfig->client == GLFW_OPENGL_API) { if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT)) continue; } u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE); u->greenBits = getEGLConfigAttrib(n, EGL_GREEN_SIZE); u->blueBits = getEGLConfigAttrib(n, EGL_BLUE_SIZE); u->alphaBits = getEGLConfigAttrib(n, EGL_ALPHA_SIZE); u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE); u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); u->doublebuffer = GLFW_TRUE; u->handle = (uintptr_t) n; usableCount++; } closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount); if (closest) *result = (EGLConfig) closest->handle; free(nativeConfigs); free(usableConfigs); return closest != NULL; } static void makeContextCurrentEGL(_GLFWwindow* window) { if (window) { if (!eglMakeCurrent(_glfw.egl.display, window->context.egl.surface, window->context.egl.surface, window->context.egl.handle)) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to make context current: %s", getEGLErrorString(eglGetError())); return; } } else { if (!eglMakeCurrent(_glfw.egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to clear current context: %s", getEGLErrorString(eglGetError())); return; } } _glfwPlatformSetTls(&_glfw.contextSlot, window); } static void swapBuffersEGL(_GLFWwindow* window) { if (window != _glfwPlatformGetTls(&_glfw.contextSlot)) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: The context must be current on the calling thread when swapping buffers"); return; } eglSwapBuffers(_glfw.egl.display, window->context.egl.surface); } static void swapIntervalEGL(int interval) { eglSwapInterval(_glfw.egl.display, interval); } static int extensionSupportedEGL(const char* extension) { const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS); if (extensions) { if (_glfwStringInExtensionString(extension, extensions)) return GLFW_TRUE; } return GLFW_FALSE; } static GLFWglproc getProcAddressEGL(const char* procname) { _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); if (window->context.egl.client) { GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->context.egl.client, procname); if (proc) return proc; } return eglGetProcAddress(procname); } static void destroyContextEGL(_GLFWwindow* window) { #if defined(_GLFW_X11) // NOTE: Do not unload libGL.so.1 while the X11 display is still open, // as it will make XCloseDisplay segfault if (window->context.client != GLFW_OPENGL_API) #endif // _GLFW_X11 { if (window->context.egl.client) { _glfw_dlclose(window->context.egl.client); window->context.egl.client = NULL; } } if (window->context.egl.surface) { eglDestroySurface(_glfw.egl.display, window->context.egl.surface); window->context.egl.surface = EGL_NO_SURFACE; } if (window->context.egl.handle) { eglDestroyContext(_glfw.egl.display, window->context.egl.handle); window->context.egl.handle = EGL_NO_CONTEXT; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize EGL // GLFWbool _glfwInitEGL(void) { int i; const char* sonames[] = { #if defined(_GLFW_EGL_LIBRARY) _GLFW_EGL_LIBRARY, #elif defined(_GLFW_WIN32) "libEGL.dll", "EGL.dll", #elif defined(_GLFW_COCOA) "libEGL.dylib", #elif defined(__CYGWIN__) "libEGL-1.so", #else "libEGL.so.1", #endif NULL }; if (_glfw.egl.handle) return GLFW_TRUE; for (i = 0; sonames[i]; i++) { _glfw.egl.handle = _glfw_dlopen(sonames[i]); if (_glfw.egl.handle) break; } if (!_glfw.egl.handle) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Library not found"); return GLFW_FALSE; } _glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0); _glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib) _glfw_dlsym(_glfw.egl.handle, "eglGetConfigAttrib"); _glfw.egl.GetConfigs = (PFN_eglGetConfigs) _glfw_dlsym(_glfw.egl.handle, "eglGetConfigs"); _glfw.egl.GetDisplay = (PFN_eglGetDisplay) _glfw_dlsym(_glfw.egl.handle, "eglGetDisplay"); _glfw.egl.GetError = (PFN_eglGetError) _glfw_dlsym(_glfw.egl.handle, "eglGetError"); _glfw.egl.Initialize = (PFN_eglInitialize) _glfw_dlsym(_glfw.egl.handle, "eglInitialize"); _glfw.egl.Terminate = (PFN_eglTerminate) _glfw_dlsym(_glfw.egl.handle, "eglTerminate"); _glfw.egl.BindAPI = (PFN_eglBindAPI) _glfw_dlsym(_glfw.egl.handle, "eglBindAPI"); _glfw.egl.CreateContext = (PFN_eglCreateContext) _glfw_dlsym(_glfw.egl.handle, "eglCreateContext"); _glfw.egl.DestroySurface = (PFN_eglDestroySurface) _glfw_dlsym(_glfw.egl.handle, "eglDestroySurface"); _glfw.egl.DestroyContext = (PFN_eglDestroyContext) _glfw_dlsym(_glfw.egl.handle, "eglDestroyContext"); _glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface) _glfw_dlsym(_glfw.egl.handle, "eglCreateWindowSurface"); _glfw.egl.MakeCurrent = (PFN_eglMakeCurrent) _glfw_dlsym(_glfw.egl.handle, "eglMakeCurrent"); _glfw.egl.SwapBuffers = (PFN_eglSwapBuffers) _glfw_dlsym(_glfw.egl.handle, "eglSwapBuffers"); _glfw.egl.SwapInterval = (PFN_eglSwapInterval) _glfw_dlsym(_glfw.egl.handle, "eglSwapInterval"); _glfw.egl.QueryString = (PFN_eglQueryString) _glfw_dlsym(_glfw.egl.handle, "eglQueryString"); _glfw.egl.GetProcAddress = (PFN_eglGetProcAddress) _glfw_dlsym(_glfw.egl.handle, "eglGetProcAddress"); if (!_glfw.egl.GetConfigAttrib || !_glfw.egl.GetConfigs || !_glfw.egl.GetDisplay || !_glfw.egl.GetError || !_glfw.egl.Initialize || !_glfw.egl.Terminate || !_glfw.egl.BindAPI || !_glfw.egl.CreateContext || !_glfw.egl.DestroySurface || !_glfw.egl.DestroyContext || !_glfw.egl.CreateWindowSurface || !_glfw.egl.MakeCurrent || !_glfw.egl.SwapBuffers || !_glfw.egl.SwapInterval || !_glfw.egl.QueryString || !_glfw.egl.GetProcAddress) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to load required entry points"); _glfwTerminateEGL(); return GLFW_FALSE; } _glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY); if (_glfw.egl.display == EGL_NO_DISPLAY) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to get EGL display: %s", getEGLErrorString(eglGetError())); _glfwTerminateEGL(); return GLFW_FALSE; } if (!eglInitialize(_glfw.egl.display, &_glfw.egl.major, &_glfw.egl.minor)) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to initialize EGL: %s", getEGLErrorString(eglGetError())); _glfwTerminateEGL(); return GLFW_FALSE; } _glfw.egl.KHR_create_context = extensionSupportedEGL("EGL_KHR_create_context"); _glfw.egl.KHR_create_context_no_error = extensionSupportedEGL("EGL_KHR_create_context_no_error"); _glfw.egl.KHR_gl_colorspace = extensionSupportedEGL("EGL_KHR_gl_colorspace"); _glfw.egl.KHR_get_all_proc_addresses = extensionSupportedEGL("EGL_KHR_get_all_proc_addresses"); _glfw.egl.KHR_context_flush_control = extensionSupportedEGL("EGL_KHR_context_flush_control"); return GLFW_TRUE; } // Terminate EGL // void _glfwTerminateEGL(void) { if (_glfw.egl.display) { eglTerminate(_glfw.egl.display); _glfw.egl.display = EGL_NO_DISPLAY; } if (_glfw.egl.handle) { _glfw_dlclose(_glfw.egl.handle); _glfw.egl.handle = NULL; } } #define setAttrib(a, v) \ { \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } // Create the OpenGL or OpenGL ES context // GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { EGLint attribs[40]; EGLConfig config; EGLContext share = NULL; int index = 0; if (!_glfw.egl.display) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: API not available"); return GLFW_FALSE; } if (ctxconfig->share) share = ctxconfig->share->context.egl.handle; if (!chooseEGLConfig(ctxconfig, fbconfig, &config)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Failed to find a suitable EGLConfig"); return GLFW_FALSE; } if (ctxconfig->client == GLFW_OPENGL_ES_API) { if (!eglBindAPI(EGL_OPENGL_ES_API)) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to bind OpenGL ES: %s", getEGLErrorString(eglGetError())); return GLFW_FALSE; } } else { if (!eglBindAPI(EGL_OPENGL_API)) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to bind OpenGL: %s", getEGLErrorString(eglGetError())); return GLFW_FALSE; } } if (_glfw.egl.KHR_create_context) { int mask = 0, flags = 0; if (ctxconfig->client == GLFW_OPENGL_API) { if (ctxconfig->forward) flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; } if (ctxconfig->debug) flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; if (ctxconfig->robustness) { if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) { setAttrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_NO_RESET_NOTIFICATION_KHR); } else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) { setAttrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_LOSE_CONTEXT_ON_RESET_KHR); } flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; } if (ctxconfig->noerror) { if (_glfw.egl.KHR_create_context_no_error) setAttrib(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE); } if (ctxconfig->major != 1 || ctxconfig->minor != 0) { setAttrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major); setAttrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor); } if (mask) setAttrib(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask); if (flags) setAttrib(EGL_CONTEXT_FLAGS_KHR, flags); } else { if (ctxconfig->client == GLFW_OPENGL_ES_API) setAttrib(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major); } if (_glfw.egl.KHR_context_flush_control) { if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE) { setAttrib(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR, EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR); } else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH) { setAttrib(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR, EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR); } } setAttrib(EGL_NONE, EGL_NONE); window->context.egl.handle = eglCreateContext(_glfw.egl.display, config, share, attribs); if (window->context.egl.handle == EGL_NO_CONTEXT) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "EGL: Failed to create context: %s", getEGLErrorString(eglGetError())); return GLFW_FALSE; } // Set up attributes for surface creation { int index = 0; if (fbconfig->sRGB) { if (_glfw.egl.KHR_gl_colorspace) setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR); } setAttrib(EGL_NONE, EGL_NONE); } window->context.egl.surface = eglCreateWindowSurface(_glfw.egl.display, config, _GLFW_EGL_NATIVE_WINDOW, attribs); if (window->context.egl.surface == EGL_NO_SURFACE) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to create window surface: %s", getEGLErrorString(eglGetError())); return GLFW_FALSE; } window->context.egl.config = config; // Load the appropriate client library if (!_glfw.egl.KHR_get_all_proc_addresses) { int i; const char** sonames; const char* es1sonames[] = { #if defined(_GLFW_GLESV1_LIBRARY) _GLFW_GLESV1_LIBRARY, #elif defined(_GLFW_WIN32) "GLESv1_CM.dll", "libGLES_CM.dll", #elif defined(_GLFW_COCOA) "libGLESv1_CM.dylib", #else "libGLESv1_CM.so.1", "libGLES_CM.so.1", #endif NULL }; const char* es2sonames[] = { #if defined(_GLFW_GLESV2_LIBRARY) _GLFW_GLESV2_LIBRARY, #elif defined(_GLFW_WIN32) "GLESv2.dll", "libGLESv2.dll", #elif defined(_GLFW_COCOA) "libGLESv2.dylib", #elif defined(__CYGWIN__) "libGLESv2-2.so", #else "libGLESv2.so.2", #endif NULL }; const char* glsonames[] = { #if defined(_GLFW_OPENGL_LIBRARY) _GLFW_OPENGL_LIBRARY, #elif defined(_GLFW_WIN32) #elif defined(_GLFW_COCOA) #else "libGL.so.1", #endif NULL }; if (ctxconfig->client == GLFW_OPENGL_ES_API) { if (ctxconfig->major == 1) sonames = es1sonames; else sonames = es2sonames; } else sonames = glsonames; for (i = 0; sonames[i]; i++) { // HACK: Match presence of lib prefix to increase chance of finding // a matching pair in the jungle that is Win32 EGL/GLES if (_glfw.egl.prefix != (strncmp(sonames[i], "lib", 3) == 0)) continue; window->context.egl.client = _glfw_dlopen(sonames[i]); if (window->context.egl.client) break; } if (!window->context.egl.client) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to load client library"); return GLFW_FALSE; } } window->context.makeCurrent = makeContextCurrentEGL; window->context.swapBuffers = swapBuffersEGL; window->context.swapInterval = swapIntervalEGL; window->context.extensionSupported = extensionSupportedEGL; window->context.getProcAddress = getProcAddressEGL; window->context.destroy = destroyContextEGL; return GLFW_TRUE; } #undef setAttrib // Returns the Visual and depth of the chosen EGLConfig // #if defined(_GLFW_X11) GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth) { XVisualInfo* result; XVisualInfo desired; EGLConfig native; EGLint visualID = 0, count = 0; const long vimask = VisualScreenMask | VisualIDMask; if (!chooseEGLConfig(ctxconfig, fbconfig, &native)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Failed to find a suitable EGLConfig"); return GLFW_FALSE; } eglGetConfigAttrib(_glfw.egl.display, native, EGL_NATIVE_VISUAL_ID, &visualID); desired.screen = _glfw.x11.screen; desired.visualid = visualID; result = XGetVisualInfo(_glfw.x11.display, vimask, &desired, &count); if (!result) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to retrieve Visual for EGLConfig"); return GLFW_FALSE; } *visual = result->visual; *depth = result->depth; XFree(result); return GLFW_TRUE; } #endif // _GLFW_X11 ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI EGLDisplay glfwGetEGLDisplay(void) { _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_DISPLAY); return _glfw.egl.display; } GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return EGL_NO_CONTEXT; } return window->context.egl.handle; } GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return EGL_NO_SURFACE; } return window->context.egl.surface; } ================================================ FILE: thirdparty/glfw/src/egl_context.h ================================================ //======================================================================== // GLFW 3.3 EGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== #if defined(_GLFW_USE_EGLPLATFORM_H) #include #elif defined(_GLFW_WIN32) #define EGLAPIENTRY __stdcall typedef HDC EGLNativeDisplayType; typedef HWND EGLNativeWindowType; #elif defined(_GLFW_COCOA) #define EGLAPIENTRY typedef void* EGLNativeDisplayType; typedef id EGLNativeWindowType; #elif defined(_GLFW_X11) #define EGLAPIENTRY typedef Display* EGLNativeDisplayType; typedef Window EGLNativeWindowType; #elif defined(_GLFW_WAYLAND) #define EGLAPIENTRY typedef struct wl_display* EGLNativeDisplayType; typedef struct wl_egl_window* EGLNativeWindowType; #else #error "No supported EGL platform selected" #endif #define EGL_SUCCESS 0x3000 #define EGL_NOT_INITIALIZED 0x3001 #define EGL_BAD_ACCESS 0x3002 #define EGL_BAD_ALLOC 0x3003 #define EGL_BAD_ATTRIBUTE 0x3004 #define EGL_BAD_CONFIG 0x3005 #define EGL_BAD_CONTEXT 0x3006 #define EGL_BAD_CURRENT_SURFACE 0x3007 #define EGL_BAD_DISPLAY 0x3008 #define EGL_BAD_MATCH 0x3009 #define EGL_BAD_NATIVE_PIXMAP 0x300a #define EGL_BAD_NATIVE_WINDOW 0x300b #define EGL_BAD_PARAMETER 0x300c #define EGL_BAD_SURFACE 0x300d #define EGL_CONTEXT_LOST 0x300e #define EGL_COLOR_BUFFER_TYPE 0x303f #define EGL_RGB_BUFFER 0x308e #define EGL_SURFACE_TYPE 0x3033 #define EGL_WINDOW_BIT 0x0004 #define EGL_RENDERABLE_TYPE 0x3040 #define EGL_OPENGL_ES_BIT 0x0001 #define EGL_OPENGL_ES2_BIT 0x0004 #define EGL_OPENGL_BIT 0x0008 #define EGL_ALPHA_SIZE 0x3021 #define EGL_BLUE_SIZE 0x3022 #define EGL_GREEN_SIZE 0x3023 #define EGL_RED_SIZE 0x3024 #define EGL_DEPTH_SIZE 0x3025 #define EGL_STENCIL_SIZE 0x3026 #define EGL_SAMPLES 0x3031 #define EGL_OPENGL_ES_API 0x30a0 #define EGL_OPENGL_API 0x30a2 #define EGL_NONE 0x3038 #define EGL_EXTENSIONS 0x3055 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_NATIVE_VISUAL_ID 0x302e #define EGL_NO_SURFACE ((EGLSurface) 0) #define EGL_NO_DISPLAY ((EGLDisplay) 0) #define EGL_NO_CONTEXT ((EGLContext) 0) #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0) #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd #define EGL_NO_RESET_NOTIFICATION_KHR 0x31be #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd #define EGL_CONTEXT_FLAGS_KHR 0x30fc #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3 #define EGL_GL_COLORSPACE_KHR 0x309d #define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 #define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 #define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 #define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 typedef int EGLint; typedef unsigned int EGLBoolean; typedef unsigned int EGLenum; typedef void* EGLConfig; typedef void* EGLContext; typedef void* EGLDisplay; typedef void* EGLSurface; // EGL function pointer typedefs typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*); typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*); typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType); typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void); typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*); typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay); typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum); typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface); typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext); typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface); typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint); typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint); typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*); #define eglGetConfigAttrib _glfw.egl.GetConfigAttrib #define eglGetConfigs _glfw.egl.GetConfigs #define eglGetDisplay _glfw.egl.GetDisplay #define eglGetError _glfw.egl.GetError #define eglInitialize _glfw.egl.Initialize #define eglTerminate _glfw.egl.Terminate #define eglBindAPI _glfw.egl.BindAPI #define eglCreateContext _glfw.egl.CreateContext #define eglDestroySurface _glfw.egl.DestroySurface #define eglDestroyContext _glfw.egl.DestroyContext #define eglCreateWindowSurface _glfw.egl.CreateWindowSurface #define eglMakeCurrent _glfw.egl.MakeCurrent #define eglSwapBuffers _glfw.egl.SwapBuffers #define eglSwapInterval _glfw.egl.SwapInterval #define eglQueryString _glfw.egl.QueryString #define eglGetProcAddress _glfw.egl.GetProcAddress #define _GLFW_EGL_CONTEXT_STATE _GLFWcontextEGL egl #define _GLFW_EGL_LIBRARY_CONTEXT_STATE _GLFWlibraryEGL egl // EGL-specific per-context data // typedef struct _GLFWcontextEGL { EGLConfig config; EGLContext handle; EGLSurface surface; void* client; } _GLFWcontextEGL; // EGL-specific global data // typedef struct _GLFWlibraryEGL { EGLDisplay display; EGLint major, minor; GLFWbool prefix; GLFWbool KHR_create_context; GLFWbool KHR_create_context_no_error; GLFWbool KHR_gl_colorspace; GLFWbool KHR_get_all_proc_addresses; GLFWbool KHR_context_flush_control; void* handle; PFN_eglGetConfigAttrib GetConfigAttrib; PFN_eglGetConfigs GetConfigs; PFN_eglGetDisplay GetDisplay; PFN_eglGetError GetError; PFN_eglInitialize Initialize; PFN_eglTerminate Terminate; PFN_eglBindAPI BindAPI; PFN_eglCreateContext CreateContext; PFN_eglDestroySurface DestroySurface; PFN_eglDestroyContext DestroyContext; PFN_eglCreateWindowSurface CreateWindowSurface; PFN_eglMakeCurrent MakeCurrent; PFN_eglSwapBuffers SwapBuffers; PFN_eglSwapInterval SwapInterval; PFN_eglQueryString QueryString; PFN_eglGetProcAddress GetProcAddress; } _GLFWlibraryEGL; GLFWbool _glfwInitEGL(void); void _glfwTerminateEGL(void); GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); #if defined(_GLFW_X11) GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth); #endif /*_GLFW_X11*/ ================================================ FILE: thirdparty/glfw/src/glfw3.pc.in ================================================ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ Name: GLFW Description: A multi-platform library for OpenGL, window and input Version: @GLFW_VERSION@ URL: https://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs.private: @GLFW_PKG_LIBS@ Cflags: -I${includedir} ================================================ FILE: thirdparty/glfw/src/glfw3Config.cmake.in ================================================ include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake") ================================================ FILE: thirdparty/glfw/src/glfw_config.h.in ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2010-2016 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // As glfw_config.h.in, this file is used by CMake to produce the // glfw_config.h configuration header file. If you are adding a feature // requiring conditional compilation, this is where to add the macro. //======================================================================== // As glfw_config.h, this file defines compile-time option macros for a // specific platform and development environment. If you are using the // GLFW CMake files, modify glfw_config.h.in instead of this file. If you // are using your own build system, make this file define the appropriate // macros in whatever way is suitable. //======================================================================== // Define this to 1 if building GLFW for X11 #cmakedefine _GLFW_X11 // Define this to 1 if building GLFW for Win32 #cmakedefine _GLFW_WIN32 // Define this to 1 if building GLFW for Cocoa #cmakedefine _GLFW_COCOA // Define this to 1 if building GLFW for Wayland #cmakedefine _GLFW_WAYLAND // Define this to 1 if building GLFW for OSMesa #cmakedefine _GLFW_OSMESA // Define this to 1 if building as a shared library / dynamic library / DLL #cmakedefine _GLFW_BUILD_DLL // Define this to 1 to use Vulkan loader linked statically into application #cmakedefine _GLFW_VULKAN_STATIC // Define this to 1 to force use of high-performance GPU on hybrid systems #cmakedefine _GLFW_USE_HYBRID_HPG // Define this to 1 if xkbcommon supports the compose key #cmakedefine HAVE_XKBCOMMON_COMPOSE_H // Define this to 1 if the libc supports memfd_create() #cmakedefine HAVE_MEMFD_CREATE ================================================ FILE: thirdparty/glfw/src/glx_context.c ================================================ //======================================================================== // GLFW 3.3 GLX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #ifndef GLXBadProfileARB #define GLXBadProfileARB 13 #endif // Returns the specified attribute of the specified GLXFBConfig // static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib) { int value; glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value); return value; } // Return the GLXFBConfig most closely matching the specified hints // static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result) { GLXFBConfig* nativeConfigs; _GLFWfbconfig* usableConfigs; const _GLFWfbconfig* closest; int i, nativeCount, usableCount; const char* vendor; GLFWbool trustWindowBit = GLFW_TRUE; // HACK: This is a (hopefully temporary) workaround for Chromium // (VirtualBox GL) not setting the window bit on any GLXFBConfigs vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR); if (vendor && strcmp(vendor, "Chromium") == 0) trustWindowBit = GLFW_FALSE; nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, &nativeCount); if (!nativeConfigs || !nativeCount) { _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned"); return GLFW_FALSE; } usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig)); usableCount = 0; for (i = 0; i < nativeCount; i++) { const GLXFBConfig n = nativeConfigs[i]; _GLFWfbconfig* u = usableConfigs + usableCount; // Only consider RGBA GLXFBConfigs if (!(getGLXFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT)) continue; // Only consider window GLXFBConfigs if (!(getGLXFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT)) { if (trustWindowBit) continue; } if (desired->transparent) { XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n); if (vi) { u->transparent = _glfwIsVisualTransparentX11(vi->visual); XFree(vi); } } u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE); u->greenBits = getGLXFBConfigAttrib(n, GLX_GREEN_SIZE); u->blueBits = getGLXFBConfigAttrib(n, GLX_BLUE_SIZE); u->alphaBits = getGLXFBConfigAttrib(n, GLX_ALPHA_SIZE); u->depthBits = getGLXFBConfigAttrib(n, GLX_DEPTH_SIZE); u->stencilBits = getGLXFBConfigAttrib(n, GLX_STENCIL_SIZE); u->accumRedBits = getGLXFBConfigAttrib(n, GLX_ACCUM_RED_SIZE); u->accumGreenBits = getGLXFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE); u->accumBlueBits = getGLXFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE); u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE); u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS); if (getGLXFBConfigAttrib(n, GLX_STEREO)) u->stereo = GLFW_TRUE; if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER)) u->doublebuffer = GLFW_TRUE; if (_glfw.glx.ARB_multisample) u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES); if (_glfw.glx.ARB_framebuffer_sRGB || _glfw.glx.EXT_framebuffer_sRGB) u->sRGB = getGLXFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); u->handle = (uintptr_t) n; usableCount++; } closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount); if (closest) *result = (GLXFBConfig) closest->handle; XFree(nativeConfigs); free(usableConfigs); return closest != NULL; } // Create the OpenGL context using legacy API // static GLXContext createLegacyContextGLX(_GLFWwindow* window, GLXFBConfig fbconfig, GLXContext share) { return glXCreateNewContext(_glfw.x11.display, fbconfig, GLX_RGBA_TYPE, share, True); } static void makeContextCurrentGLX(_GLFWwindow* window) { if (window) { if (!glXMakeCurrent(_glfw.x11.display, window->context.glx.window, window->context.glx.handle)) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to make context current"); return; } } else { if (!glXMakeCurrent(_glfw.x11.display, None, NULL)) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to clear current context"); return; } } _glfwPlatformSetTls(&_glfw.contextSlot, window); } static void swapBuffersGLX(_GLFWwindow* window) { glXSwapBuffers(_glfw.x11.display, window->context.glx.window); } static void swapIntervalGLX(int interval) { _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); if (_glfw.glx.EXT_swap_control) { _glfw.glx.SwapIntervalEXT(_glfw.x11.display, window->context.glx.window, interval); } else if (_glfw.glx.MESA_swap_control) _glfw.glx.SwapIntervalMESA(interval); else if (_glfw.glx.SGI_swap_control) { if (interval > 0) _glfw.glx.SwapIntervalSGI(interval); } } static int extensionSupportedGLX(const char* extension) { const char* extensions = glXQueryExtensionsString(_glfw.x11.display, _glfw.x11.screen); if (extensions) { if (_glfwStringInExtensionString(extension, extensions)) return GLFW_TRUE; } return GLFW_FALSE; } static GLFWglproc getProcAddressGLX(const char* procname) { if (_glfw.glx.GetProcAddress) return _glfw.glx.GetProcAddress((const GLubyte*) procname); else if (_glfw.glx.GetProcAddressARB) return _glfw.glx.GetProcAddressARB((const GLubyte*) procname); else return _glfw_dlsym(_glfw.glx.handle, procname); } static void destroyContextGLX(_GLFWwindow* window) { if (window->context.glx.window) { glXDestroyWindow(_glfw.x11.display, window->context.glx.window); window->context.glx.window = None; } if (window->context.glx.handle) { glXDestroyContext(_glfw.x11.display, window->context.glx.handle); window->context.glx.handle = NULL; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize GLX // GLFWbool _glfwInitGLX(void) { int i; const char* sonames[] = { #if defined(_GLFW_GLX_LIBRARY) _GLFW_GLX_LIBRARY, #elif defined(__CYGWIN__) "libGL-1.so", #else "libGL.so.1", "libGL.so", #endif NULL }; if (_glfw.glx.handle) return GLFW_TRUE; for (i = 0; sonames[i]; i++) { _glfw.glx.handle = _glfw_dlopen(sonames[i]); if (_glfw.glx.handle) break; } if (!_glfw.glx.handle) { _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to load GLX"); return GLFW_FALSE; } _glfw.glx.GetFBConfigs = _glfw_dlsym(_glfw.glx.handle, "glXGetFBConfigs"); _glfw.glx.GetFBConfigAttrib = _glfw_dlsym(_glfw.glx.handle, "glXGetFBConfigAttrib"); _glfw.glx.GetClientString = _glfw_dlsym(_glfw.glx.handle, "glXGetClientString"); _glfw.glx.QueryExtension = _glfw_dlsym(_glfw.glx.handle, "glXQueryExtension"); _glfw.glx.QueryVersion = _glfw_dlsym(_glfw.glx.handle, "glXQueryVersion"); _glfw.glx.DestroyContext = _glfw_dlsym(_glfw.glx.handle, "glXDestroyContext"); _glfw.glx.MakeCurrent = _glfw_dlsym(_glfw.glx.handle, "glXMakeCurrent"); _glfw.glx.SwapBuffers = _glfw_dlsym(_glfw.glx.handle, "glXSwapBuffers"); _glfw.glx.QueryExtensionsString = _glfw_dlsym(_glfw.glx.handle, "glXQueryExtensionsString"); _glfw.glx.CreateNewContext = _glfw_dlsym(_glfw.glx.handle, "glXCreateNewContext"); _glfw.glx.CreateWindow = _glfw_dlsym(_glfw.glx.handle, "glXCreateWindow"); _glfw.glx.DestroyWindow = _glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow"); _glfw.glx.GetProcAddress = _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress"); _glfw.glx.GetProcAddressARB = _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB"); _glfw.glx.GetVisualFromFBConfig = _glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig"); if (!_glfw.glx.GetFBConfigs || !_glfw.glx.GetFBConfigAttrib || !_glfw.glx.GetClientString || !_glfw.glx.QueryExtension || !_glfw.glx.QueryVersion || !_glfw.glx.DestroyContext || !_glfw.glx.MakeCurrent || !_glfw.glx.SwapBuffers || !_glfw.glx.QueryExtensionsString || !_glfw.glx.CreateNewContext || !_glfw.glx.CreateWindow || !_glfw.glx.DestroyWindow || !_glfw.glx.GetProcAddress || !_glfw.glx.GetProcAddressARB || !_glfw.glx.GetVisualFromFBConfig) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to load required entry points"); return GLFW_FALSE; } if (!glXQueryExtension(_glfw.x11.display, &_glfw.glx.errorBase, &_glfw.glx.eventBase)) { _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found"); return GLFW_FALSE; } if (!glXQueryVersion(_glfw.x11.display, &_glfw.glx.major, &_glfw.glx.minor)) { _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to query GLX version"); return GLFW_FALSE; } if (_glfw.glx.major == 1 && _glfw.glx.minor < 3) { _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX version 1.3 is required"); return GLFW_FALSE; } if (extensionSupportedGLX("GLX_EXT_swap_control")) { _glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) getProcAddressGLX("glXSwapIntervalEXT"); if (_glfw.glx.SwapIntervalEXT) _glfw.glx.EXT_swap_control = GLFW_TRUE; } if (extensionSupportedGLX("GLX_SGI_swap_control")) { _glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) getProcAddressGLX("glXSwapIntervalSGI"); if (_glfw.glx.SwapIntervalSGI) _glfw.glx.SGI_swap_control = GLFW_TRUE; } if (extensionSupportedGLX("GLX_MESA_swap_control")) { _glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC) getProcAddressGLX("glXSwapIntervalMESA"); if (_glfw.glx.SwapIntervalMESA) _glfw.glx.MESA_swap_control = GLFW_TRUE; } if (extensionSupportedGLX("GLX_ARB_multisample")) _glfw.glx.ARB_multisample = GLFW_TRUE; if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB")) _glfw.glx.ARB_framebuffer_sRGB = GLFW_TRUE; if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB")) _glfw.glx.EXT_framebuffer_sRGB = GLFW_TRUE; if (extensionSupportedGLX("GLX_ARB_create_context")) { _glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC) getProcAddressGLX("glXCreateContextAttribsARB"); if (_glfw.glx.CreateContextAttribsARB) _glfw.glx.ARB_create_context = GLFW_TRUE; } if (extensionSupportedGLX("GLX_ARB_create_context_robustness")) _glfw.glx.ARB_create_context_robustness = GLFW_TRUE; if (extensionSupportedGLX("GLX_ARB_create_context_profile")) _glfw.glx.ARB_create_context_profile = GLFW_TRUE; if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile")) _glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE; if (extensionSupportedGLX("GLX_ARB_create_context_no_error")) _glfw.glx.ARB_create_context_no_error = GLFW_TRUE; if (extensionSupportedGLX("GLX_ARB_context_flush_control")) _glfw.glx.ARB_context_flush_control = GLFW_TRUE; return GLFW_TRUE; } // Terminate GLX // void _glfwTerminateGLX(void) { // NOTE: This function must not call any X11 functions, as it is called // after XCloseDisplay (see _glfwPlatformTerminate for details) if (_glfw.glx.handle) { _glfw_dlclose(_glfw.glx.handle); _glfw.glx.handle = NULL; } } #define setAttrib(a, v) \ { \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } // Create the OpenGL or OpenGL ES context // GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int attribs[40]; GLXFBConfig native = NULL; GLXContext share = NULL; if (ctxconfig->share) share = ctxconfig->share->context.glx.handle; if (!chooseGLXFBConfig(fbconfig, &native)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "GLX: Failed to find a suitable GLXFBConfig"); return GLFW_FALSE; } if (ctxconfig->client == GLFW_OPENGL_ES_API) { if (!_glfw.glx.ARB_create_context || !_glfw.glx.ARB_create_context_profile || !_glfw.glx.EXT_create_context_es2_profile) { _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable"); return GLFW_FALSE; } } if (ctxconfig->forward) { if (!_glfw.glx.ARB_create_context) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable"); return GLFW_FALSE; } } if (ctxconfig->profile) { if (!_glfw.glx.ARB_create_context || !_glfw.glx.ARB_create_context_profile) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable"); return GLFW_FALSE; } } _glfwGrabErrorHandlerX11(); if (_glfw.glx.ARB_create_context) { int index = 0, mask = 0, flags = 0; if (ctxconfig->client == GLFW_OPENGL_API) { if (ctxconfig->forward) flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB; else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } else mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT; if (ctxconfig->debug) flags |= GLX_CONTEXT_DEBUG_BIT_ARB; if (ctxconfig->robustness) { if (_glfw.glx.ARB_create_context_robustness) { if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) { setAttrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_NO_RESET_NOTIFICATION_ARB); } else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) { setAttrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, GLX_LOSE_CONTEXT_ON_RESET_ARB); } flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB; } } if (ctxconfig->release) { if (_glfw.glx.ARB_context_flush_control) { if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE) { setAttrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB, GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); } else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH) { setAttrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB, GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB); } } } if (ctxconfig->noerror) { if (_glfw.glx.ARB_create_context_no_error) setAttrib(GLX_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE); } // NOTE: Only request an explicitly versioned context when necessary, as // explicitly requesting version 1.0 does not always return the // highest version supported by the driver if (ctxconfig->major != 1 || ctxconfig->minor != 0) { setAttrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major); setAttrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor); } if (mask) setAttrib(GLX_CONTEXT_PROFILE_MASK_ARB, mask); if (flags) setAttrib(GLX_CONTEXT_FLAGS_ARB, flags); setAttrib(None, None); window->context.glx.handle = _glfw.glx.CreateContextAttribsARB(_glfw.x11.display, native, share, True, attribs); // HACK: This is a fallback for broken versions of the Mesa // implementation of GLX_ARB_create_context_profile that fail // default 1.0 context creation with a GLXBadProfileARB error in // violation of the extension spec if (!window->context.glx.handle) { if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB && ctxconfig->client == GLFW_OPENGL_API && ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE && ctxconfig->forward == GLFW_FALSE) { window->context.glx.handle = createLegacyContextGLX(window, native, share); } } } else { window->context.glx.handle = createLegacyContextGLX(window, native, share); } _glfwReleaseErrorHandlerX11(); if (!window->context.glx.handle) { _glfwInputErrorX11(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context"); return GLFW_FALSE; } window->context.glx.window = glXCreateWindow(_glfw.x11.display, native, window->x11.handle, NULL); if (!window->context.glx.window) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to create window"); return GLFW_FALSE; } window->context.makeCurrent = makeContextCurrentGLX; window->context.swapBuffers = swapBuffersGLX; window->context.swapInterval = swapIntervalGLX; window->context.extensionSupported = extensionSupportedGLX; window->context.getProcAddress = getProcAddressGLX; window->context.destroy = destroyContextGLX; return GLFW_TRUE; } #undef setAttrib // Returns the Visual and depth of the chosen GLXFBConfig // GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth) { GLXFBConfig native; XVisualInfo* result; if (!chooseGLXFBConfig(fbconfig, &native)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "GLX: Failed to find a suitable GLXFBConfig"); return GLFW_FALSE; } result = glXGetVisualFromFBConfig(_glfw.x11.display, native); if (!result) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to retrieve Visual for GLXFBConfig"); return GLFW_FALSE; } *visual = result->visual; *depth = result->depth; XFree(result); return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return NULL; } return window->context.glx.handle; } GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(None); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return None; } return window->context.glx.window; } ================================================ FILE: thirdparty/glfw/src/glx_context.h ================================================ //======================================================================== // GLFW 3.3 GLX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 GLX_VENDOR 1 #define GLX_RGBA_BIT 0x00000001 #define GLX_WINDOW_BIT 0x00000001 #define GLX_DRAWABLE_TYPE 0x8010 #define GLX_RENDER_TYPE 0x8011 #define GLX_RGBA_TYPE 0x8014 #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_SAMPLES 0x186a1 #define GLX_VISUAL_ID 0x800b #define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 #define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 #define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 #define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 #define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 #define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 #define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3 typedef XID GLXWindow; typedef XID GLXDrawable; typedef struct __GLXFBConfig* GLXFBConfig; typedef struct __GLXcontext* GLXContext; typedef void (*__GLXextproc)(void); typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*); typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int); typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*); typedef Bool (*PFNGLXQUERYVERSIONPROC)(Display*,int*,int*); typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext); typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext); typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable); typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int); typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*); typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool); typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName); typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int); typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig); typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*); typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow); typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int); typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*); // libGL.so function pointer typedefs #define glXGetFBConfigs _glfw.glx.GetFBConfigs #define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib #define glXGetClientString _glfw.glx.GetClientString #define glXQueryExtension _glfw.glx.QueryExtension #define glXQueryVersion _glfw.glx.QueryVersion #define glXDestroyContext _glfw.glx.DestroyContext #define glXMakeCurrent _glfw.glx.MakeCurrent #define glXSwapBuffers _glfw.glx.SwapBuffers #define glXQueryExtensionsString _glfw.glx.QueryExtensionsString #define glXCreateNewContext _glfw.glx.CreateNewContext #define glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig #define glXCreateWindow _glfw.glx.CreateWindow #define glXDestroyWindow _glfw.glx.DestroyWindow #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX glx #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx // GLX-specific per-context data // typedef struct _GLFWcontextGLX { GLXContext handle; GLXWindow window; } _GLFWcontextGLX; // GLX-specific global data // typedef struct _GLFWlibraryGLX { int major, minor; int eventBase; int errorBase; // dlopen handle for libGL.so.1 void* handle; // GLX 1.3 functions PFNGLXGETFBCONFIGSPROC GetFBConfigs; PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib; PFNGLXGETCLIENTSTRINGPROC GetClientString; PFNGLXQUERYEXTENSIONPROC QueryExtension; PFNGLXQUERYVERSIONPROC QueryVersion; PFNGLXDESTROYCONTEXTPROC DestroyContext; PFNGLXMAKECURRENTPROC MakeCurrent; PFNGLXSWAPBUFFERSPROC SwapBuffers; PFNGLXQUERYEXTENSIONSSTRINGPROC QueryExtensionsString; PFNGLXCREATENEWCONTEXTPROC CreateNewContext; PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig; PFNGLXCREATEWINDOWPROC CreateWindow; PFNGLXDESTROYWINDOWPROC DestroyWindow; // GLX 1.4 and extension functions PFNGLXGETPROCADDRESSPROC GetProcAddress; PFNGLXGETPROCADDRESSPROC GetProcAddressARB; PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; GLFWbool SGI_swap_control; GLFWbool EXT_swap_control; GLFWbool MESA_swap_control; GLFWbool ARB_multisample; GLFWbool ARB_framebuffer_sRGB; GLFWbool EXT_framebuffer_sRGB; GLFWbool ARB_create_context; GLFWbool ARB_create_context_profile; GLFWbool ARB_create_context_robustness; GLFWbool EXT_create_context_es2_profile; GLFWbool ARB_create_context_no_error; GLFWbool ARB_context_flush_control; } _GLFWlibraryGLX; GLFWbool _glfwInitGLX(void); void _glfwTerminateGLX(void); GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyContextGLX(_GLFWwindow* window); GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth); ================================================ FILE: thirdparty/glfw/src/init.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2018 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include "mappings.h" #include #include #include #include #include // The global variables below comprise all mutable global data in GLFW // // Any other global variable is a bug // Global state shared between compilation units of GLFW // _GLFWlibrary _glfw = { GLFW_FALSE }; // These are outside of _glfw so they can be used before initialization and // after termination // static _GLFWerror _glfwMainThreadError; static GLFWerrorfun _glfwErrorCallback; static _GLFWinitconfig _glfwInitHints = { GLFW_TRUE, // hat buttons { GLFW_TRUE, // macOS menu bar GLFW_TRUE // macOS bundle chdir } }; // Terminate the library // static void terminate(void) { int i; memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks)); while (_glfw.windowListHead) glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead); while (_glfw.cursorListHead) glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead); for (i = 0; i < _glfw.monitorCount; i++) { _GLFWmonitor* monitor = _glfw.monitors[i]; if (monitor->originalRamp.size) _glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp); _glfwFreeMonitor(monitor); } free(_glfw.monitors); _glfw.monitors = NULL; _glfw.monitorCount = 0; free(_glfw.mappings); _glfw.mappings = NULL; _glfw.mappingCount = 0; _glfwTerminateVulkan(); _glfwPlatformTerminate(); _glfw.initialized = GLFW_FALSE; while (_glfw.errorListHead) { _GLFWerror* error = _glfw.errorListHead; _glfw.errorListHead = error->next; free(error); } _glfwPlatformDestroyTls(&_glfw.contextSlot); _glfwPlatformDestroyTls(&_glfw.errorSlot); _glfwPlatformDestroyMutex(&_glfw.errorLock); memset(&_glfw, 0, sizeof(_glfw)); } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// char* _glfw_strdup(const char* source) { const size_t length = strlen(source); char* result = calloc(length + 1, 1); strcpy(result, source); return result; } float _glfw_fminf(float a, float b) { if (a != a) return b; else if (b != b) return a; else if (a < b) return a; else return b; } float _glfw_fmaxf(float a, float b) { if (a != a) return b; else if (b != b) return a; else if (a > b) return a; else return b; } ////////////////////////////////////////////////////////////////////////// ////// GLFW event API ////// ////////////////////////////////////////////////////////////////////////// // Notifies shared code of an error // void _glfwInputError(int code, const char* format, ...) { _GLFWerror* error; char description[_GLFW_MESSAGE_SIZE]; if (format) { va_list vl; va_start(vl, format); vsnprintf(description, sizeof(description), format, vl); va_end(vl); description[sizeof(description) - 1] = '\0'; } else { if (code == GLFW_NOT_INITIALIZED) strcpy(description, "The GLFW library is not initialized"); else if (code == GLFW_NO_CURRENT_CONTEXT) strcpy(description, "There is no current context"); else if (code == GLFW_INVALID_ENUM) strcpy(description, "Invalid argument for enum parameter"); else if (code == GLFW_INVALID_VALUE) strcpy(description, "Invalid value for parameter"); else if (code == GLFW_OUT_OF_MEMORY) strcpy(description, "Out of memory"); else if (code == GLFW_API_UNAVAILABLE) strcpy(description, "The requested API is unavailable"); else if (code == GLFW_VERSION_UNAVAILABLE) strcpy(description, "The requested API version is unavailable"); else if (code == GLFW_PLATFORM_ERROR) strcpy(description, "A platform-specific error occurred"); else if (code == GLFW_FORMAT_UNAVAILABLE) strcpy(description, "The requested format is unavailable"); else if (code == GLFW_NO_WINDOW_CONTEXT) strcpy(description, "The specified window has no context"); else strcpy(description, "ERROR: UNKNOWN GLFW ERROR"); } if (_glfw.initialized) { error = _glfwPlatformGetTls(&_glfw.errorSlot); if (!error) { error = calloc(1, sizeof(_GLFWerror)); _glfwPlatformSetTls(&_glfw.errorSlot, error); _glfwPlatformLockMutex(&_glfw.errorLock); error->next = _glfw.errorListHead; _glfw.errorListHead = error; _glfwPlatformUnlockMutex(&_glfw.errorLock); } } else error = &_glfwMainThreadError; error->code = code; strcpy(error->description, description); if (_glfwErrorCallback) _glfwErrorCallback(code, description); } ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI int glfwInit(void) { if (_glfw.initialized) return GLFW_TRUE; memset(&_glfw, 0, sizeof(_glfw)); _glfw.hints.init = _glfwInitHints; if (!_glfwPlatformInit()) { terminate(); return GLFW_FALSE; } if (!_glfwPlatformCreateMutex(&_glfw.errorLock) || !_glfwPlatformCreateTls(&_glfw.errorSlot) || !_glfwPlatformCreateTls(&_glfw.contextSlot)) { terminate(); return GLFW_FALSE; } _glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError); _glfw.initialized = GLFW_TRUE; _glfw.timer.offset = _glfwPlatformGetTimerValue(); glfwDefaultWindowHints(); { int i; for (i = 0; _glfwDefaultMappings[i]; i++) { if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i])) { terminate(); return GLFW_FALSE; } } } return GLFW_TRUE; } GLFWAPI void glfwTerminate(void) { if (!_glfw.initialized) return; terminate(); } GLFWAPI void glfwInitHint(int hint, int value) { switch (hint) { case GLFW_JOYSTICK_HAT_BUTTONS: _glfwInitHints.hatButtons = value; return; case GLFW_COCOA_CHDIR_RESOURCES: _glfwInitHints.ns.chdir = value; return; case GLFW_COCOA_MENUBAR: _glfwInitHints.ns.menubar = value; return; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid init hint 0x%08X", hint); } GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev) { if (major != NULL) *major = GLFW_VERSION_MAJOR; if (minor != NULL) *minor = GLFW_VERSION_MINOR; if (rev != NULL) *rev = GLFW_VERSION_REVISION; } GLFWAPI const char* glfwGetVersionString(void) { return _glfwPlatformGetVersionString(); } GLFWAPI int glfwGetError(const char** description) { _GLFWerror* error; int code = GLFW_NO_ERROR; if (description) *description = NULL; if (_glfw.initialized) error = _glfwPlatformGetTls(&_glfw.errorSlot); else error = &_glfwMainThreadError; if (error) { code = error->code; error->code = GLFW_NO_ERROR; if (description && code) *description = error->description; } return code; } GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun) { _GLFW_SWAP_POINTERS(_glfwErrorCallback, cbfun); return cbfun; } ================================================ FILE: thirdparty/glfw/src/input.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include #include // Internal key state used for sticky keys #define _GLFW_STICK 3 // Internal constants for gamepad mapping source types #define _GLFW_JOYSTICK_AXIS 1 #define _GLFW_JOYSTICK_BUTTON 2 #define _GLFW_JOYSTICK_HATBIT 3 // Finds a mapping based on joystick GUID // static _GLFWmapping* findMapping(const char* guid) { int i; for (i = 0; i < _glfw.mappingCount; i++) { if (strcmp(_glfw.mappings[i].guid, guid) == 0) return _glfw.mappings + i; } return NULL; } // Checks whether a gamepad mapping element is present in the hardware // static GLFWbool isValidElementForJoystick(const _GLFWmapelement* e, const _GLFWjoystick* js) { if (e->type == _GLFW_JOYSTICK_HATBIT && (e->index >> 4) >= js->hatCount) return GLFW_FALSE; else if (e->type == _GLFW_JOYSTICK_BUTTON && e->index >= js->buttonCount) return GLFW_FALSE; else if (e->type == _GLFW_JOYSTICK_AXIS && e->index >= js->axisCount) return GLFW_FALSE; return GLFW_TRUE; } // Finds a mapping based on joystick GUID and verifies element indices // static _GLFWmapping* findValidMapping(const _GLFWjoystick* js) { _GLFWmapping* mapping = findMapping(js->guid); if (mapping) { int i; for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++) { if (!isValidElementForJoystick(mapping->buttons + i, js)) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid button in gamepad mapping %s (%s)", mapping->guid, mapping->name); return NULL; } } for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++) { if (!isValidElementForJoystick(mapping->axes + i, js)) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid axis in gamepad mapping %s (%s)", mapping->guid, mapping->name); return NULL; } } } return mapping; } // Parses an SDL_GameControllerDB line and adds it to the mapping list // static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string) { const char* c = string; size_t i, length; struct { const char* name; _GLFWmapelement* element; } fields[] = { { "platform", NULL }, { "a", mapping->buttons + GLFW_GAMEPAD_BUTTON_A }, { "b", mapping->buttons + GLFW_GAMEPAD_BUTTON_B }, { "x", mapping->buttons + GLFW_GAMEPAD_BUTTON_X }, { "y", mapping->buttons + GLFW_GAMEPAD_BUTTON_Y }, { "back", mapping->buttons + GLFW_GAMEPAD_BUTTON_BACK }, { "start", mapping->buttons + GLFW_GAMEPAD_BUTTON_START }, { "guide", mapping->buttons + GLFW_GAMEPAD_BUTTON_GUIDE }, { "leftshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_BUMPER }, { "rightshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER }, { "leftstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_THUMB }, { "rightstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_THUMB }, { "dpup", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_UP }, { "dpright", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_RIGHT }, { "dpdown", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_DOWN }, { "dpleft", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_LEFT }, { "lefttrigger", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_TRIGGER }, { "righttrigger", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER }, { "leftx", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_X }, { "lefty", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_Y }, { "rightx", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_X }, { "righty", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_Y } }; length = strcspn(c, ","); if (length != 32 || c[length] != ',') { _glfwInputError(GLFW_INVALID_VALUE, NULL); return GLFW_FALSE; } memcpy(mapping->guid, c, length); c += length + 1; length = strcspn(c, ","); if (length >= sizeof(mapping->name) || c[length] != ',') { _glfwInputError(GLFW_INVALID_VALUE, NULL); return GLFW_FALSE; } memcpy(mapping->name, c, length); c += length + 1; while (*c) { // TODO: Implement output modifiers if (*c == '+' || *c == '-') return GLFW_FALSE; for (i = 0; i < sizeof(fields) / sizeof(fields[0]); i++) { length = strlen(fields[i].name); if (strncmp(c, fields[i].name, length) != 0 || c[length] != ':') continue; c += length + 1; if (fields[i].element) { _GLFWmapelement* e = fields[i].element; int8_t minimum = -1; int8_t maximum = 1; if (*c == '+') { minimum = 0; c += 1; } else if (*c == '-') { maximum = 0; c += 1; } if (*c == 'a') e->type = _GLFW_JOYSTICK_AXIS; else if (*c == 'b') e->type = _GLFW_JOYSTICK_BUTTON; else if (*c == 'h') e->type = _GLFW_JOYSTICK_HATBIT; else break; if (e->type == _GLFW_JOYSTICK_HATBIT) { const unsigned long hat = strtoul(c + 1, (char**) &c, 10); const unsigned long bit = strtoul(c + 1, (char**) &c, 10); e->index = (uint8_t) ((hat << 4) | bit); } else e->index = (uint8_t) strtoul(c + 1, (char**) &c, 10); if (e->type == _GLFW_JOYSTICK_AXIS) { e->axisScale = 2 / (maximum - minimum); e->axisOffset = -(maximum + minimum); if (*c == '~') { e->axisScale = -e->axisScale; e->axisOffset = -e->axisOffset; } } } else { length = strlen(_GLFW_PLATFORM_MAPPING_NAME); if (strncmp(c, _GLFW_PLATFORM_MAPPING_NAME, length) != 0) return GLFW_FALSE; } break; } c += strcspn(c, ","); c += strspn(c, ","); } for (i = 0; i < 32; i++) { if (mapping->guid[i] >= 'A' && mapping->guid[i] <= 'F') mapping->guid[i] += 'a' - 'A'; } _glfwPlatformUpdateGamepadGUID(mapping->guid); return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW event API ////// ////////////////////////////////////////////////////////////////////////// // Notifies shared code of a physical key event // void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods) { if (key >= 0 && key <= GLFW_KEY_LAST) { GLFWbool repeated = GLFW_FALSE; if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE) return; if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS) repeated = GLFW_TRUE; if (action == GLFW_RELEASE && window->stickyKeys) window->keys[key] = _GLFW_STICK; else window->keys[key] = (char) action; if (repeated) action = GLFW_REPEAT; } if (!window->lockKeyMods) mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK); if (window->callbacks.key) window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods); } // Notifies shared code of a Unicode codepoint input event // The 'plain' parameter determines whether to emit a regular character event // void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain) { if (codepoint < 32 || (codepoint > 126 && codepoint < 160)) return; if (!window->lockKeyMods) mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK); if (window->callbacks.charmods) window->callbacks.charmods((GLFWwindow*) window, codepoint, mods); if (plain) { if (window->callbacks.character) window->callbacks.character((GLFWwindow*) window, codepoint); } } // Notifies shared code of a scroll event // void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) { if (window->callbacks.scroll) window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset); } // Notifies shared code of a mouse button click event // void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods) { if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST) return; if (!window->lockKeyMods) mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK); if (action == GLFW_RELEASE && window->stickyMouseButtons) window->mouseButtons[button] = _GLFW_STICK; else window->mouseButtons[button] = (char) action; if (window->callbacks.mouseButton) window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods); } // Notifies shared code of a cursor motion event // The position is specified in content area relative screen coordinates // void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos) { if (window->virtualCursorPosX == xpos && window->virtualCursorPosY == ypos) return; window->virtualCursorPosX = xpos; window->virtualCursorPosY = ypos; if (window->callbacks.cursorPos) window->callbacks.cursorPos((GLFWwindow*) window, xpos, ypos); } // Notifies shared code of a cursor enter/leave event // void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered) { if (window->callbacks.cursorEnter) window->callbacks.cursorEnter((GLFWwindow*) window, entered); } // Notifies shared code of files or directories dropped on a window // void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths) { if (window->callbacks.drop) window->callbacks.drop((GLFWwindow*) window, count, paths); } // Notifies shared code of a joystick connection or disconnection // void _glfwInputJoystick(_GLFWjoystick* js, int event) { const int jid = (int) (js - _glfw.joysticks); if (_glfw.callbacks.joystick) _glfw.callbacks.joystick(jid, event); } // Notifies shared code of the new value of a joystick axis // void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value) { js->axes[axis] = value; } // Notifies shared code of the new value of a joystick button // void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value) { js->buttons[button] = value; } // Notifies shared code of the new value of a joystick hat // void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value) { const int base = js->buttonCount + hat * 4; js->buttons[base + 0] = (value & 0x01) ? GLFW_PRESS : GLFW_RELEASE; js->buttons[base + 1] = (value & 0x02) ? GLFW_PRESS : GLFW_RELEASE; js->buttons[base + 2] = (value & 0x04) ? GLFW_PRESS : GLFW_RELEASE; js->buttons[base + 3] = (value & 0x08) ? GLFW_PRESS : GLFW_RELEASE; js->hats[hat] = value; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Returns an available joystick object with arrays and name allocated // _GLFWjoystick* _glfwAllocJoystick(const char* name, const char* guid, int axisCount, int buttonCount, int hatCount) { int jid; _GLFWjoystick* js; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { if (!_glfw.joysticks[jid].present) break; } if (jid > GLFW_JOYSTICK_LAST) return NULL; js = _glfw.joysticks + jid; js->present = GLFW_TRUE; js->name = _glfw_strdup(name); js->axes = calloc(axisCount, sizeof(float)); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->hats = calloc(hatCount, 1); js->axisCount = axisCount; js->buttonCount = buttonCount; js->hatCount = hatCount; strncpy(js->guid, guid, sizeof(js->guid) - 1); js->mapping = findValidMapping(js); return js; } // Frees arrays and name and flags the joystick object as unused // void _glfwFreeJoystick(_GLFWjoystick* js) { free(js->name); free(js->axes); free(js->buttons); free(js->hats); memset(js, 0, sizeof(_GLFWjoystick)); } // Center the cursor in the content area of the specified window // void _glfwCenterCursorInContentArea(_GLFWwindow* window) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0); } ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(0); switch (mode) { case GLFW_CURSOR: return window->cursorMode; case GLFW_STICKY_KEYS: return window->stickyKeys; case GLFW_STICKY_MOUSE_BUTTONS: return window->stickyMouseButtons; case GLFW_LOCK_KEY_MODS: return window->lockKeyMods; case GLFW_RAW_MOUSE_MOTION: return window->rawMouseMotion; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode); return 0; } GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (mode == GLFW_CURSOR) { if (value != GLFW_CURSOR_NORMAL && value != GLFW_CURSOR_HIDDEN && value != GLFW_CURSOR_DISABLED) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid cursor mode 0x%08X", value); return; } if (window->cursorMode == value) return; window->cursorMode = value; _glfwPlatformGetCursorPos(window, &window->virtualCursorPosX, &window->virtualCursorPosY); _glfwPlatformSetCursorMode(window, value); } else if (mode == GLFW_STICKY_KEYS) { value = value ? GLFW_TRUE : GLFW_FALSE; if (window->stickyKeys == value) return; if (!value) { int i; // Release all sticky keys for (i = 0; i <= GLFW_KEY_LAST; i++) { if (window->keys[i] == _GLFW_STICK) window->keys[i] = GLFW_RELEASE; } } window->stickyKeys = value; } else if (mode == GLFW_STICKY_MOUSE_BUTTONS) { value = value ? GLFW_TRUE : GLFW_FALSE; if (window->stickyMouseButtons == value) return; if (!value) { int i; // Release all sticky mouse buttons for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) { if (window->mouseButtons[i] == _GLFW_STICK) window->mouseButtons[i] = GLFW_RELEASE; } } window->stickyMouseButtons = value; } else if (mode == GLFW_LOCK_KEY_MODS) { window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE; } else if (mode == GLFW_RAW_MOUSE_MOTION) { if (!_glfwPlatformRawMouseMotionSupported()) { _glfwInputError(GLFW_PLATFORM_ERROR, "Raw mouse motion is not supported on this system"); return; } value = value ? GLFW_TRUE : GLFW_FALSE; if (window->rawMouseMotion == value) return; window->rawMouseMotion = value; _glfwPlatformSetRawMouseMotion(window, value); } else _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode); } GLFWAPI int glfwRawMouseMotionSupported(void) { _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); return _glfwPlatformRawMouseMotionSupported(); } GLFWAPI const char* glfwGetKeyName(int key, int scancode) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (key != GLFW_KEY_UNKNOWN) { if (key != GLFW_KEY_KP_EQUAL && (key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) && (key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2)) { return NULL; } scancode = _glfwPlatformGetKeyScancode(key); } return _glfwPlatformGetScancodeName(scancode); } GLFWAPI int glfwGetKeyScancode(int key) { _GLFW_REQUIRE_INIT_OR_RETURN(-1); if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key); return GLFW_RELEASE; } return _glfwPlatformGetKeyScancode(key); } GLFWAPI int glfwGetKey(GLFWwindow* handle, int key) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE); if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key); return GLFW_RELEASE; } if (window->keys[key] == _GLFW_STICK) { // Sticky mode: release key now window->keys[key] = GLFW_RELEASE; return GLFW_PRESS; } return (int) window->keys[key]; } GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE); if (button < GLFW_MOUSE_BUTTON_1 || button > GLFW_MOUSE_BUTTON_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid mouse button %i", button); return GLFW_RELEASE; } if (window->mouseButtons[button] == _GLFW_STICK) { // Sticky mode: release mouse button now window->mouseButtons[button] = GLFW_RELEASE; return GLFW_PRESS; } return (int) window->mouseButtons[button]; } GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); if (xpos) *xpos = 0; if (ypos) *ypos = 0; _GLFW_REQUIRE_INIT(); if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (xpos) *xpos = window->virtualCursorPosX; if (ypos) *ypos = window->virtualCursorPosY; } else _glfwPlatformGetCursorPos(window, xpos, ypos); } GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (xpos != xpos || xpos < -DBL_MAX || xpos > DBL_MAX || ypos != ypos || ypos < -DBL_MAX || ypos > DBL_MAX) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid cursor position %f %f", xpos, ypos); return; } if (!_glfwPlatformWindowFocused(window)) return; if (window->cursorMode == GLFW_CURSOR_DISABLED) { // Only update the accumulated position if the cursor is disabled window->virtualCursorPosX = xpos; window->virtualCursorPosY = ypos; } else { // Update system cursor position _glfwPlatformSetCursorPos(window, xpos, ypos); } } GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot) { _GLFWcursor* cursor; assert(image != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); cursor = calloc(1, sizeof(_GLFWcursor)); cursor->next = _glfw.cursorListHead; _glfw.cursorListHead = cursor; if (!_glfwPlatformCreateCursor(cursor, image, xhot, yhot)) { glfwDestroyCursor((GLFWcursor*) cursor); return NULL; } return (GLFWcursor*) cursor; } GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape) { _GLFWcursor* cursor; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (shape != GLFW_ARROW_CURSOR && shape != GLFW_IBEAM_CURSOR && shape != GLFW_CROSSHAIR_CURSOR && shape != GLFW_HAND_CURSOR && shape != GLFW_HRESIZE_CURSOR && shape != GLFW_VRESIZE_CURSOR) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape); return NULL; } cursor = calloc(1, sizeof(_GLFWcursor)); cursor->next = _glfw.cursorListHead; _glfw.cursorListHead = cursor; if (!_glfwPlatformCreateStandardCursor(cursor, shape)) { glfwDestroyCursor((GLFWcursor*) cursor); return NULL; } return (GLFWcursor*) cursor; } GLFWAPI void glfwDestroyCursor(GLFWcursor* handle) { _GLFWcursor* cursor = (_GLFWcursor*) handle; _GLFW_REQUIRE_INIT(); if (cursor == NULL) return; // Make sure the cursor is not being used by any window { _GLFWwindow* window; for (window = _glfw.windowListHead; window; window = window->next) { if (window->cursor == cursor) glfwSetCursor((GLFWwindow*) window, NULL); } } _glfwPlatformDestroyCursor(cursor); // Unlink cursor from global linked list { _GLFWcursor** prev = &_glfw.cursorListHead; while (*prev != cursor) prev = &((*prev)->next); *prev = cursor->next; } free(cursor); } GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle) { _GLFWwindow* window = (_GLFWwindow*) windowHandle; _GLFWcursor* cursor = (_GLFWcursor*) cursorHandle; assert(window != NULL); _GLFW_REQUIRE_INIT(); window->cursor = cursor; _glfwPlatformSetCursor(window, cursor); } GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.key, cbfun); return cbfun; } GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.character, cbfun); return cbfun; } GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* handle, GLFWcharmodsfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun); return cbfun; } GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle, GLFWmousebuttonfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun); return cbfun; } GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle, GLFWcursorposfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun); return cbfun; } GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle, GLFWcursorenterfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun); return cbfun; } GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle, GLFWscrollfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun); return cbfun; } GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun); return cbfun; } GLFWAPI int glfwJoystickPresent(int jid) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return GLFW_FALSE; } js = _glfw.joysticks + jid; if (!js->present) return GLFW_FALSE; return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); } GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); assert(count != NULL); *count = 0; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return NULL; } js = _glfw.joysticks + jid; if (!js->present) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES)) return NULL; *count = js->axisCount; return js->axes; } GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); assert(count != NULL); *count = 0; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return NULL; } js = _glfw.joysticks + jid; if (!js->present) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS)) return NULL; if (_glfw.hints.init.hatButtons) *count = js->buttonCount + js->hatCount * 4; else *count = js->buttonCount; return js->buttons; } GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); assert(count != NULL); *count = 0; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return NULL; } js = _glfw.joysticks + jid; if (!js->present) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS)) return NULL; *count = js->hatCount; return js->hats; } GLFWAPI const char* glfwGetJoystickName(int jid) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return NULL; } js = _glfw.joysticks + jid; if (!js->present) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) return NULL; return js->name; } GLFWAPI const char* glfwGetJoystickGUID(int jid) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return NULL; } js = _glfw.joysticks + jid; if (!js->present) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) return NULL; return js->guid; } GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT(); js = _glfw.joysticks + jid; if (!js->present) return; js->userPointer = pointer; } GLFWAPI void* glfwGetJoystickUserPointer(int jid) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); js = _glfw.joysticks + jid; if (!js->present) return NULL; return js->userPointer; } GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(_glfw.callbacks.joystick, cbfun); return cbfun; } GLFWAPI int glfwUpdateGamepadMappings(const char* string) { int jid; const char* c = string; assert(string != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); while (*c) { if ((*c >= '0' && *c <= '9') || (*c >= 'a' && *c <= 'f') || (*c >= 'A' && *c <= 'F')) { char line[1024]; const size_t length = strcspn(c, "\r\n"); if (length < sizeof(line)) { _GLFWmapping mapping = {{0}}; memcpy(line, c, length); line[length] = '\0'; if (parseMapping(&mapping, line)) { _GLFWmapping* previous = findMapping(mapping.guid); if (previous) *previous = mapping; else { _glfw.mappingCount++; _glfw.mappings = realloc(_glfw.mappings, sizeof(_GLFWmapping) * _glfw.mappingCount); _glfw.mappings[_glfw.mappingCount - 1] = mapping; } } } c += length; } else { c += strcspn(c, "\r\n"); c += strspn(c, "\r\n"); } } for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; if (js->present) js->mapping = findValidMapping(js); } return GLFW_TRUE; } GLFWAPI int glfwJoystickIsGamepad(int jid) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return GLFW_FALSE; } js = _glfw.joysticks + jid; if (!js->present) return GLFW_FALSE; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) return GLFW_FALSE; return js->mapping != NULL; } GLFWAPI const char* glfwGetGamepadName(int jid) { _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return NULL; } js = _glfw.joysticks + jid; if (!js->present) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) return NULL; if (!js->mapping) return NULL; return js->mapping->name; } GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state) { int i; _GLFWjoystick* js; assert(jid >= GLFW_JOYSTICK_1); assert(jid <= GLFW_JOYSTICK_LAST); assert(state != NULL); memset(state, 0, sizeof(GLFWgamepadstate)); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (jid < 0 || jid > GLFW_JOYSTICK_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid); return GLFW_FALSE; } js = _glfw.joysticks + jid; if (!js->present) return GLFW_FALSE; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL)) return GLFW_FALSE; if (!js->mapping) return GLFW_FALSE; for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++) { const _GLFWmapelement* e = js->mapping->buttons + i; if (e->type == _GLFW_JOYSTICK_AXIS) { const float value = js->axes[e->index] * e->axisScale + e->axisOffset; // HACK: This should be baked into the value transform // TODO: Bake into transform when implementing output modifiers if (e->axisOffset < 0 || (e->axisOffset == 0 && e->axisScale > 0)) { if (value >= 0.f) state->buttons[i] = GLFW_PRESS; } else { if (value <= 0.f) state->buttons[i] = GLFW_PRESS; } } else if (e->type == _GLFW_JOYSTICK_HATBIT) { const unsigned int hat = e->index >> 4; const unsigned int bit = e->index & 0xf; if (js->hats[hat] & bit) state->buttons[i] = GLFW_PRESS; } else if (e->type == _GLFW_JOYSTICK_BUTTON) state->buttons[i] = js->buttons[e->index]; } for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++) { const _GLFWmapelement* e = js->mapping->axes + i; if (e->type == _GLFW_JOYSTICK_AXIS) { const float value = js->axes[e->index] * e->axisScale + e->axisOffset; state->axes[i] = _glfw_fminf(_glfw_fmaxf(value, -1.f), 1.f); } else if (e->type == _GLFW_JOYSTICK_HATBIT) { const unsigned int hat = e->index >> 4; const unsigned int bit = e->index & 0xf; if (js->hats[hat] & bit) state->axes[i] = 1.f; else state->axes[i] = -1.f; } else if (e->type == _GLFW_JOYSTICK_BUTTON) state->axes[i] = js->buttons[e->index] * 2.f - 1.f; } return GLFW_TRUE; } GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string) { assert(string != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformSetClipboardString(string); } GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return _glfwPlatformGetClipboardString(); } GLFWAPI double glfwGetTime(void) { _GLFW_REQUIRE_INIT_OR_RETURN(0.0); return (double) (_glfwPlatformGetTimerValue() - _glfw.timer.offset) / _glfwPlatformGetTimerFrequency(); } GLFWAPI void glfwSetTime(double time) { _GLFW_REQUIRE_INIT(); if (time != time || time < 0.0 || time > 18446744073.0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid time %f", time); return; } _glfw.timer.offset = _glfwPlatformGetTimerValue() - (uint64_t) (time * _glfwPlatformGetTimerFrequency()); } GLFWAPI uint64_t glfwGetTimerValue(void) { _GLFW_REQUIRE_INIT_OR_RETURN(0); return _glfwPlatformGetTimerValue(); } GLFWAPI uint64_t glfwGetTimerFrequency(void) { _GLFW_REQUIRE_INIT_OR_RETURN(0); return _glfwPlatformGetTimerFrequency(); } ================================================ FILE: thirdparty/glfw/src/internal.h ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== #pragma once #if defined(_GLFW_USE_CONFIG_H) #include "glfw_config.h" #endif #if defined(GLFW_INCLUDE_GLCOREARB) || \ defined(GLFW_INCLUDE_ES1) || \ defined(GLFW_INCLUDE_ES2) || \ defined(GLFW_INCLUDE_ES3) || \ defined(GLFW_INCLUDE_ES31) || \ defined(GLFW_INCLUDE_ES32) || \ defined(GLFW_INCLUDE_NONE) || \ defined(GLFW_INCLUDE_GLEXT) || \ defined(GLFW_INCLUDE_GLU) || \ defined(GLFW_INCLUDE_VULKAN) || \ defined(GLFW_DLL) #error "You must not define any header option macros when compiling GLFW" #endif #define GLFW_INCLUDE_NONE #include "../include/GLFW/glfw3.h" #define _GLFW_INSERT_FIRST 0 #define _GLFW_INSERT_LAST 1 #define _GLFW_POLL_PRESENCE 0 #define _GLFW_POLL_AXES 1 #define _GLFW_POLL_BUTTONS 2 #define _GLFW_POLL_ALL (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS) #define _GLFW_MESSAGE_SIZE 1024 typedef int GLFWbool; typedef struct _GLFWerror _GLFWerror; typedef struct _GLFWinitconfig _GLFWinitconfig; typedef struct _GLFWwndconfig _GLFWwndconfig; typedef struct _GLFWctxconfig _GLFWctxconfig; typedef struct _GLFWfbconfig _GLFWfbconfig; typedef struct _GLFWcontext _GLFWcontext; typedef struct _GLFWwindow _GLFWwindow; typedef struct _GLFWlibrary _GLFWlibrary; typedef struct _GLFWmonitor _GLFWmonitor; typedef struct _GLFWcursor _GLFWcursor; typedef struct _GLFWmapelement _GLFWmapelement; typedef struct _GLFWmapping _GLFWmapping; typedef struct _GLFWjoystick _GLFWjoystick; typedef struct _GLFWtls _GLFWtls; typedef struct _GLFWmutex _GLFWmutex; typedef void (* _GLFWmakecontextcurrentfun)(_GLFWwindow*); typedef void (* _GLFWswapbuffersfun)(_GLFWwindow*); typedef void (* _GLFWswapintervalfun)(int); typedef int (* _GLFWextensionsupportedfun)(const char*); typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*); typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*); #define GL_VERSION 0x1f02 #define GL_NONE 0 #define GL_COLOR_BUFFER_BIT 0x00004000 #define GL_UNSIGNED_BYTE 0x1401 #define GL_EXTENSIONS 0x1f03 #define GL_NUM_EXTENSIONS 0x821d #define GL_CONTEXT_FLAGS 0x821e #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 #define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 #define GL_CONTEXT_PROFILE_MASK 0x9126 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #define GL_NO_RESET_NOTIFICATION_ARB 0x8261 #define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb #define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 typedef int GLint; typedef unsigned int GLuint; typedef unsigned int GLenum; typedef unsigned int GLbitfield; typedef unsigned char GLubyte; typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield); typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum); typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*); typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint); #define VK_NULL_HANDLE 0 typedef void* VkInstance; typedef void* VkPhysicalDevice; typedef uint64_t VkSurfaceKHR; typedef uint32_t VkFlags; typedef uint32_t VkBool32; typedef enum VkStructureType { VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000, VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkStructureType; typedef enum VkResult { VK_SUCCESS = 0, VK_NOT_READY = 1, VK_TIMEOUT = 2, VK_EVENT_SET = 3, VK_EVENT_RESET = 4, VK_INCOMPLETE = 5, VK_ERROR_OUT_OF_HOST_MEMORY = -1, VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, VK_ERROR_INITIALIZATION_FAILED = -3, VK_ERROR_DEVICE_LOST = -4, VK_ERROR_MEMORY_MAP_FAILED = -5, VK_ERROR_LAYER_NOT_PRESENT = -6, VK_ERROR_EXTENSION_NOT_PRESENT = -7, VK_ERROR_FEATURE_NOT_PRESENT = -8, VK_ERROR_INCOMPATIBLE_DRIVER = -9, VK_ERROR_TOO_MANY_OBJECTS = -10, VK_ERROR_FORMAT_NOT_SUPPORTED = -11, VK_ERROR_SURFACE_LOST_KHR = -1000000000, VK_SUBOPTIMAL_KHR = 1000001003, VK_ERROR_OUT_OF_DATE_KHR = -1000001004, VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_RESULT_MAX_ENUM = 0x7FFFFFFF } VkResult; typedef struct VkAllocationCallbacks VkAllocationCallbacks; typedef struct VkExtensionProperties { char extensionName[256]; uint32_t specVersion; } VkExtensionProperties; typedef void (APIENTRY * PFN_vkVoidFunction)(void); #if defined(_GLFW_VULKAN_STATIC) PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance,const char*); VkResult vkEnumerateInstanceExtensionProperties(const char*,uint32_t*,VkExtensionProperties*); #else typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*); typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*); #define vkEnumerateInstanceExtensionProperties _glfw.vk.EnumerateInstanceExtensionProperties #define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr #endif #if defined(_GLFW_COCOA) #include "cocoa_platform.h" #elif defined(_GLFW_WIN32) #include "win32_platform.h" #elif defined(_GLFW_X11) #include "x11_platform.h" #elif defined(_GLFW_WAYLAND) #include "wl_platform.h" #elif defined(_GLFW_OSMESA) #include "null_platform.h" #else #error "No supported window creation API selected" #endif // Constructs a version number string from the public header macros #define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r #define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r) #define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \ GLFW_VERSION_MINOR, \ GLFW_VERSION_REVISION) // Checks for whether the library has been initialized #define _GLFW_REQUIRE_INIT() \ if (!_glfw.initialized) \ { \ _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ return; \ } #define _GLFW_REQUIRE_INIT_OR_RETURN(x) \ if (!_glfw.initialized) \ { \ _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ return x; \ } // Swaps the provided pointers #define _GLFW_SWAP_POINTERS(x, y) \ { \ void* t; \ t = x; \ x = y; \ y = t; \ } // Per-thread error structure // struct _GLFWerror { _GLFWerror* next; int code; char description[_GLFW_MESSAGE_SIZE]; }; // Initialization configuration // // Parameters relating to the initialization of the library // struct _GLFWinitconfig { GLFWbool hatButtons; struct { GLFWbool menubar; GLFWbool chdir; } ns; }; // Window configuration // // Parameters relating to the creation of the window but not directly related // to the framebuffer. This is used to pass window creation parameters from // shared code to the platform API. // struct _GLFWwndconfig { int width; int height; const char* title; GLFWbool resizable; GLFWbool visible; GLFWbool decorated; GLFWbool focused; GLFWbool autoIconify; GLFWbool floating; GLFWbool maximized; GLFWbool centerCursor; GLFWbool focusOnShow; GLFWbool scaleToMonitor; struct { GLFWbool retina; char frameName[256]; } ns; struct { char className[256]; char instanceName[256]; } x11; }; // Context configuration // // Parameters relating to the creation of the context but not directly related // to the framebuffer. This is used to pass context creation parameters from // shared code to the platform API. // struct _GLFWctxconfig { int client; int source; int major; int minor; GLFWbool forward; GLFWbool debug; GLFWbool noerror; int profile; int robustness; int release; _GLFWwindow* share; struct { GLFWbool offline; } nsgl; }; // Framebuffer configuration // // This describes buffers and their sizes. It also contains // a platform-specific ID used to map back to the backend API object. // // It is used to pass framebuffer parameters from shared code to the platform // API and also to enumerate and select available framebuffer configs. // struct _GLFWfbconfig { int redBits; int greenBits; int blueBits; int alphaBits; int depthBits; int stencilBits; int accumRedBits; int accumGreenBits; int accumBlueBits; int accumAlphaBits; int auxBuffers; GLFWbool stereo; int samples; GLFWbool sRGB; GLFWbool doublebuffer; GLFWbool transparent; uintptr_t handle; }; // Context structure // struct _GLFWcontext { int client; int source; int major, minor, revision; GLFWbool forward, debug, noerror; int profile; int robustness; int release; PFNGLGETSTRINGIPROC GetStringi; PFNGLGETINTEGERVPROC GetIntegerv; PFNGLGETSTRINGPROC GetString; _GLFWmakecontextcurrentfun makeCurrent; _GLFWswapbuffersfun swapBuffers; _GLFWswapintervalfun swapInterval; _GLFWextensionsupportedfun extensionSupported; _GLFWgetprocaddressfun getProcAddress; _GLFWdestroycontextfun destroy; // This is defined in the context API's context.h _GLFW_PLATFORM_CONTEXT_STATE; // This is defined in egl_context.h _GLFW_EGL_CONTEXT_STATE; // This is defined in osmesa_context.h _GLFW_OSMESA_CONTEXT_STATE; }; // Window and context structure // struct _GLFWwindow { struct _GLFWwindow* next; // Window settings and state GLFWbool resizable; GLFWbool decorated; GLFWbool autoIconify; GLFWbool floating; GLFWbool focusOnShow; GLFWbool shouldClose; void* userPointer; GLFWvidmode videoMode; _GLFWmonitor* monitor; _GLFWcursor* cursor; int minwidth, minheight; int maxwidth, maxheight; int numer, denom; GLFWbool stickyKeys; GLFWbool stickyMouseButtons; GLFWbool lockKeyMods; int cursorMode; char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1]; char keys[GLFW_KEY_LAST + 1]; // Virtual cursor position when cursor is disabled double virtualCursorPosX, virtualCursorPosY; GLFWbool rawMouseMotion; _GLFWcontext context; struct { GLFWwindowposfun pos; GLFWwindowsizefun size; GLFWwindowclosefun close; GLFWwindowrefreshfun refresh; GLFWwindowfocusfun focus; GLFWwindowiconifyfun iconify; GLFWwindowmaximizefun maximize; GLFWframebuffersizefun fbsize; GLFWwindowcontentscalefun scale; GLFWmousebuttonfun mouseButton; GLFWcursorposfun cursorPos; GLFWcursorenterfun cursorEnter; GLFWscrollfun scroll; GLFWkeyfun key; GLFWcharfun character; GLFWcharmodsfun charmods; GLFWdropfun drop; } callbacks; // This is defined in the window API's platform.h _GLFW_PLATFORM_WINDOW_STATE; }; // Monitor structure // struct _GLFWmonitor { char* name; void* userPointer; // Physical dimensions in millimeters. int widthMM, heightMM; // The window whose video mode is current on this monitor _GLFWwindow* window; GLFWvidmode* modes; int modeCount; GLFWvidmode currentMode; GLFWgammaramp originalRamp; GLFWgammaramp currentRamp; // This is defined in the window API's platform.h _GLFW_PLATFORM_MONITOR_STATE; }; // Cursor structure // struct _GLFWcursor { _GLFWcursor* next; // This is defined in the window API's platform.h _GLFW_PLATFORM_CURSOR_STATE; }; // Gamepad mapping element structure // struct _GLFWmapelement { uint8_t type; uint8_t index; int8_t axisScale; int8_t axisOffset; }; // Gamepad mapping structure // struct _GLFWmapping { char name[128]; char guid[33]; _GLFWmapelement buttons[15]; _GLFWmapelement axes[6]; }; // Joystick structure // struct _GLFWjoystick { GLFWbool present; float* axes; int axisCount; unsigned char* buttons; int buttonCount; unsigned char* hats; int hatCount; char* name; void* userPointer; char guid[33]; _GLFWmapping* mapping; // This is defined in the joystick API's joystick.h _GLFW_PLATFORM_JOYSTICK_STATE; }; // Thread local storage structure // struct _GLFWtls { // This is defined in the platform's thread.h _GLFW_PLATFORM_TLS_STATE; }; // Mutex structure // struct _GLFWmutex { // This is defined in the platform's thread.h _GLFW_PLATFORM_MUTEX_STATE; }; // Library global data // struct _GLFWlibrary { GLFWbool initialized; struct { _GLFWinitconfig init; _GLFWfbconfig framebuffer; _GLFWwndconfig window; _GLFWctxconfig context; int refreshRate; } hints; _GLFWerror* errorListHead; _GLFWcursor* cursorListHead; _GLFWwindow* windowListHead; _GLFWmonitor** monitors; int monitorCount; _GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1]; _GLFWmapping* mappings; int mappingCount; _GLFWtls errorSlot; _GLFWtls contextSlot; _GLFWmutex errorLock; struct { uint64_t offset; // This is defined in the platform's time.h _GLFW_PLATFORM_LIBRARY_TIMER_STATE; } timer; struct { GLFWbool available; void* handle; char* extensions[2]; #if !defined(_GLFW_VULKAN_STATIC) PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties; PFN_vkGetInstanceProcAddr GetInstanceProcAddr; #endif GLFWbool KHR_surface; #if defined(_GLFW_WIN32) GLFWbool KHR_win32_surface; #elif defined(_GLFW_COCOA) GLFWbool MVK_macos_surface; GLFWbool EXT_metal_surface; #elif defined(_GLFW_X11) GLFWbool KHR_xlib_surface; GLFWbool KHR_xcb_surface; #elif defined(_GLFW_WAYLAND) GLFWbool KHR_wayland_surface; #endif } vk; struct { GLFWmonitorfun monitor; GLFWjoystickfun joystick; } callbacks; // This is defined in the window API's platform.h _GLFW_PLATFORM_LIBRARY_WINDOW_STATE; // This is defined in the context API's context.h _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE; // This is defined in the platform's joystick.h _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE; // This is defined in egl_context.h _GLFW_EGL_LIBRARY_CONTEXT_STATE; // This is defined in osmesa_context.h _GLFW_OSMESA_LIBRARY_CONTEXT_STATE; }; // Global state shared between compilation units of GLFW // extern _GLFWlibrary _glfw; ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformInit(void); void _glfwPlatformTerminate(void); const char* _glfwPlatformGetVersionString(void); void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos); void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos); void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode); void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled); GLFWbool _glfwPlatformRawMouseMotionSupported(void); int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape); void _glfwPlatformDestroyCursor(_GLFWcursor* cursor); void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor); const char* _glfwPlatformGetScancodeName(int scancode); int _glfwPlatformGetKeyScancode(int key); void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor); void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos); void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale); void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height); GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count); void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode); GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp); void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwPlatformSetClipboardString(const char* string); const char* _glfwPlatformGetClipboardString(void); int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode); void _glfwPlatformUpdateGamepadGUID(char* guid); uint64_t _glfwPlatformGetTimerValue(void); uint64_t _glfwPlatformGetTimerFrequency(void); int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwPlatformDestroyWindow(_GLFWwindow* window); void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title); void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos); void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos); void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height); void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom); void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height); void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom); void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale); void _glfwPlatformIconifyWindow(_GLFWwindow* window); void _glfwPlatformRestoreWindow(_GLFWwindow* window); void _glfwPlatformMaximizeWindow(_GLFWwindow* window); void _glfwPlatformShowWindow(_GLFWwindow* window); void _glfwPlatformHideWindow(_GLFWwindow* window); void _glfwPlatformRequestWindowAttention(_GLFWwindow* window); void _glfwPlatformFocusWindow(_GLFWwindow* window); void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); int _glfwPlatformWindowFocused(_GLFWwindow* window); int _glfwPlatformWindowIconified(_GLFWwindow* window); int _glfwPlatformWindowVisible(_GLFWwindow* window); int _glfwPlatformWindowMaximized(_GLFWwindow* window); int _glfwPlatformWindowHovered(_GLFWwindow* window); int _glfwPlatformFramebufferTransparent(_GLFWwindow* window); float _glfwPlatformGetWindowOpacity(_GLFWwindow* window); void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled); void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled); void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled); void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity); void _glfwPlatformPollEvents(void); void _glfwPlatformWaitEvents(void); void _glfwPlatformWaitEventsTimeout(double timeout); void _glfwPlatformPostEmptyEvent(void); void _glfwPlatformGetRequiredInstanceExtensions(char** extensions); int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls); void _glfwPlatformDestroyTls(_GLFWtls* tls); void* _glfwPlatformGetTls(_GLFWtls* tls); void _glfwPlatformSetTls(_GLFWtls* tls, void* value); GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex); void _glfwPlatformDestroyMutex(_GLFWmutex* mutex); void _glfwPlatformLockMutex(_GLFWmutex* mutex); void _glfwPlatformUnlockMutex(_GLFWmutex* mutex); ////////////////////////////////////////////////////////////////////////// ////// GLFW event API ////// ////////////////////////////////////////////////////////////////////////// void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused); void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos); void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height); void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale); void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified); void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized); void _glfwInputWindowDamage(_GLFWwindow* window); void _glfwInputWindowCloseRequest(_GLFWwindow* window); void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor); void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods); void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain); void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset); void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos); void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered); void _glfwInputDrop(_GLFWwindow* window, int count, const char** names); void _glfwInputJoystick(_GLFWjoystick* js, int event); void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value); void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value); void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value); void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement); void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window); #if defined(__GNUC__) void _glfwInputError(int code, const char* format, ...) __attribute__((format(printf, 2, 3))); #else void _glfwInputError(int code, const char* format, ...); #endif ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions); const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, const _GLFWfbconfig* alternatives, unsigned int count); GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig); GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired); int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second); _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM); void _glfwFreeMonitor(_GLFWmonitor* monitor); void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size); void _glfwFreeGammaArrays(GLFWgammaramp* ramp); void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); _GLFWjoystick* _glfwAllocJoystick(const char* name, const char* guid, int axisCount, int buttonCount, int hatCount); void _glfwFreeJoystick(_GLFWjoystick* js); void _glfwCenterCursorInContentArea(_GLFWwindow* window); GLFWbool _glfwInitVulkan(int mode); void _glfwTerminateVulkan(void); const char* _glfwGetVulkanResultString(VkResult result); char* _glfw_strdup(const char* source); float _glfw_fminf(float a, float b); float _glfw_fmaxf(float a, float b); ================================================ FILE: thirdparty/glfw/src/linux_joystick.c ================================================ //======================================================================== // GLFW 3.3 Linux - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include #include #include #include #include #include #ifndef SYN_DROPPED // < v2.6.39 kernel headers // Workaround for CentOS-6, which is supported till 2020-11-30, but still on v2.6.32 #define SYN_DROPPED 3 #endif // Apply an EV_KEY event to the specified joystick // static void handleKeyEvent(_GLFWjoystick* js, int code, int value) { _glfwInputJoystickButton(js, js->linjs.keyMap[code - BTN_MISC], value ? GLFW_PRESS : GLFW_RELEASE); } // Apply an EV_ABS event to the specified joystick // static void handleAbsEvent(_GLFWjoystick* js, int code, int value) { const int index = js->linjs.absMap[code]; if (code >= ABS_HAT0X && code <= ABS_HAT3Y) { static const char stateMap[3][3] = { { GLFW_HAT_CENTERED, GLFW_HAT_UP, GLFW_HAT_DOWN }, { GLFW_HAT_LEFT, GLFW_HAT_LEFT_UP, GLFW_HAT_LEFT_DOWN }, { GLFW_HAT_RIGHT, GLFW_HAT_RIGHT_UP, GLFW_HAT_RIGHT_DOWN }, }; const int hat = (code - ABS_HAT0X) / 2; const int axis = (code - ABS_HAT0X) % 2; int* state = js->linjs.hats[hat]; // NOTE: Looking at several input drivers, it seems all hat events use // -1 for left / up, 0 for centered and 1 for right / down if (value == 0) state[axis] = 0; else if (value < 0) state[axis] = 1; else if (value > 0) state[axis] = 2; _glfwInputJoystickHat(js, index, stateMap[state[0]][state[1]]); } else { const struct input_absinfo* info = &js->linjs.absInfo[code]; float normalized = value; const int range = info->maximum - info->minimum; if (range) { // Normalize to 0.0 -> 1.0 normalized = (normalized - info->minimum) / range; // Normalize to -1.0 -> 1.0 normalized = normalized * 2.0f - 1.0f; } _glfwInputJoystickAxis(js, index, normalized); } } // Poll state of absolute axes // static void pollAbsState(_GLFWjoystick* js) { for (int code = 0; code < ABS_CNT; code++) { if (js->linjs.absMap[code] < 0) continue; struct input_absinfo* info = &js->linjs.absInfo[code]; if (ioctl(js->linjs.fd, EVIOCGABS(code), info) < 0) continue; handleAbsEvent(js, code, info->value); } } #define isBitSet(bit, arr) (arr[(bit) / 8] & (1 << ((bit) % 8))) // Attempt to open the specified joystick device // static GLFWbool openJoystickDevice(const char* path) { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { if (!_glfw.joysticks[jid].present) continue; if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) return GLFW_FALSE; } _GLFWjoystickLinux linjs = {0}; linjs.fd = open(path, O_RDONLY | O_NONBLOCK); if (linjs.fd == -1) return GLFW_FALSE; char evBits[(EV_CNT + 7) / 8] = {0}; char keyBits[(KEY_CNT + 7) / 8] = {0}; char absBits[(ABS_CNT + 7) / 8] = {0}; struct input_id id; if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 || ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 || ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 || ioctl(linjs.fd, EVIOCGID, &id) < 0) { _glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to query input device: %s", strerror(errno)); close(linjs.fd); return GLFW_FALSE; } // Ensure this device supports the events expected of a joystick if (!isBitSet(EV_KEY, evBits) || !isBitSet(EV_ABS, evBits)) { close(linjs.fd); return GLFW_FALSE; } char name[256] = ""; if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0) strncpy(name, "Unknown", sizeof(name)); char guid[33] = ""; // Generate a joystick GUID that matches the SDL 2.0.5+ one if (id.vendor && id.product && id.version) { sprintf(guid, "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000", id.bustype & 0xff, id.bustype >> 8, id.vendor & 0xff, id.vendor >> 8, id.product & 0xff, id.product >> 8, id.version & 0xff, id.version >> 8); } else { sprintf(guid, "%02x%02x0000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00", id.bustype & 0xff, id.bustype >> 8, name[0], name[1], name[2], name[3], name[4], name[5], name[6], name[7], name[8], name[9], name[10]); } int axisCount = 0, buttonCount = 0, hatCount = 0; for (int code = BTN_MISC; code < KEY_CNT; code++) { if (!isBitSet(code, keyBits)) continue; linjs.keyMap[code - BTN_MISC] = buttonCount; buttonCount++; } for (int code = 0; code < ABS_CNT; code++) { linjs.absMap[code] = -1; if (!isBitSet(code, absBits)) continue; if (code >= ABS_HAT0X && code <= ABS_HAT3Y) { linjs.absMap[code] = hatCount; hatCount++; // Skip the Y axis code++; } else { if (ioctl(linjs.fd, EVIOCGABS(code), &linjs.absInfo[code]) < 0) continue; linjs.absMap[code] = axisCount; axisCount++; } } _GLFWjoystick* js = _glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount); if (!js) { close(linjs.fd); return GLFW_FALSE; } strncpy(linjs.path, path, sizeof(linjs.path) - 1); memcpy(&js->linjs, &linjs, sizeof(linjs)); pollAbsState(js); _glfwInputJoystick(js, GLFW_CONNECTED); return GLFW_TRUE; } #undef isBitSet // Frees all resources associated with the specified joystick // static void closeJoystick(_GLFWjoystick* js) { close(js->linjs.fd); _glfwFreeJoystick(js); _glfwInputJoystick(js, GLFW_DISCONNECTED); } // Lexically compare joysticks by name; used by qsort // static int compareJoysticks(const void* fp, const void* sp) { const _GLFWjoystick* fj = fp; const _GLFWjoystick* sj = sp; return strcmp(fj->linjs.path, sj->linjs.path); } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize joystick interface // GLFWbool _glfwInitJoysticksLinux(void) { const char* dirname = "/dev/input"; _glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); if (_glfw.linjs.inotify > 0) { // HACK: Register for IN_ATTRIB to get notified when udev is done // This works well in practice but the true way is libudev _glfw.linjs.watch = inotify_add_watch(_glfw.linjs.inotify, dirname, IN_CREATE | IN_ATTRIB | IN_DELETE); } // Continue without device connection notifications if inotify fails if (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) != 0) { _glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex"); return GLFW_FALSE; } int count = 0; DIR* dir = opendir(dirname); if (dir) { struct dirent* entry; while ((entry = readdir(dir))) { regmatch_t match; if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0) continue; char path[PATH_MAX]; snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name); if (openJoystickDevice(path)) count++; } closedir(dir); } // Continue with no joysticks if enumeration fails qsort(_glfw.joysticks, count, sizeof(_GLFWjoystick), compareJoysticks); return GLFW_TRUE; } // Close all opened joystick handles // void _glfwTerminateJoysticksLinux(void) { int jid; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; if (js->present) closeJoystick(js); } regfree(&_glfw.linjs.regex); if (_glfw.linjs.inotify > 0) { if (_glfw.linjs.watch > 0) inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch); close(_glfw.linjs.inotify); } } void _glfwDetectJoystickConnectionLinux(void) { if (_glfw.linjs.inotify <= 0) return; ssize_t offset = 0; char buffer[16384]; const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer)); while (size > offset) { regmatch_t match; const struct inotify_event* e = (struct inotify_event*) (buffer + offset); offset += sizeof(struct inotify_event) + e->len; if (regexec(&_glfw.linjs.regex, e->name, 1, &match, 0) != 0) continue; char path[PATH_MAX]; snprintf(path, sizeof(path), "/dev/input/%s", e->name); if (e->mask & (IN_CREATE | IN_ATTRIB)) openJoystickDevice(path); else if (e->mask & IN_DELETE) { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) { closeJoystick(_glfw.joysticks + jid); break; } } } } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) { // Read all queued events (non-blocking) for (;;) { struct input_event e; errno = 0; if (read(js->linjs.fd, &e, sizeof(e)) < 0) { // Reset the joystick slot if the device was disconnected if (errno == ENODEV) closeJoystick(js); break; } if (e.type == EV_SYN) { if (e.code == SYN_DROPPED) _glfw.linjs.dropped = GLFW_TRUE; else if (e.code == SYN_REPORT) { _glfw.linjs.dropped = GLFW_FALSE; pollAbsState(js); } } if (_glfw.linjs.dropped) continue; if (e.type == EV_KEY) handleKeyEvent(js, e.code, e.value); else if (e.type == EV_ABS) handleAbsEvent(js, e.code, e.value); } return js->present; } void _glfwPlatformUpdateGamepadGUID(char* guid) { } ================================================ FILE: thirdparty/glfw/src/linux_joystick.h ================================================ //======================================================================== // GLFW 3.3 Linux - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickLinux linjs #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs #define _GLFW_PLATFORM_MAPPING_NAME "Linux" // Linux-specific joystick data // typedef struct _GLFWjoystickLinux { int fd; char path[PATH_MAX]; int keyMap[KEY_CNT - BTN_MISC]; int absMap[ABS_CNT]; struct input_absinfo absInfo[ABS_CNT]; int hats[4][2]; } _GLFWjoystickLinux; // Linux-specific joystick API data // typedef struct _GLFWlibraryLinux { int inotify; int watch; regex_t regex; GLFWbool dropped; } _GLFWlibraryLinux; GLFWbool _glfwInitJoysticksLinux(void); void _glfwTerminateJoysticksLinux(void); void _glfwDetectJoystickConnectionLinux(void); ================================================ FILE: thirdparty/glfw/src/mappings.h ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2006-2018 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // As mappings.h.in, this file is used by CMake to produce the mappings.h // header file. If you are adding a GLFW specific gamepad mapping, this is // where to put it. //======================================================================== // As mappings.h, this provides all pre-defined gamepad mappings, including // all available in SDL_GameControllerDB. Do not edit this file. Any gamepad // mappings not specific to GLFW should be submitted to SDL_GameControllerDB. // This file can be re-generated from mappings.h.in and the upstream // gamecontrollerdb.txt with the GenerateMappings.cmake script. //======================================================================== // All gamepad mappings not labeled GLFW are copied from the // SDL_GameControllerDB project under the following license: // // Simple DirectMedia Layer // Copyright (C) 1997-2013 Sam Lantinga // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the // use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. const char* _glfwDefaultMappings[] = { "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,", "03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", "03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", "03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", "03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,", "030000008f0e00001200000000000000,Acme,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,", "03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,", "030000006b1400000055000000000000,bigben ps3padstreetnew,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows,", "03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "030000005e0400008e02000000000000,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Windows,", "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "030000004f04000023b3000000000000,Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "030000000d0f00008500000000000000,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00008400000000000000,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,", "030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,", "03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,", "030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000451300000010000000000000,Generic USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00004d00000000000000,HORIPAD3 A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,platform:Windows,", "030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Windows,", "03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Windows,", "03000000b50700001403000000000000,IMPACT BLACK,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", "030000006f0e00002401000000000000,INJUSTICE FightStick for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", "030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,platform:Windows,", "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008433000000000000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008483000000000000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b6,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000008305000031b0000000000000,MaxfireBlaze3,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,platform:Windows,", "03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows,", "0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,", "03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Windows,", "03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,", "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,leftx:h0.6,lefty:h0.12,rightshoulder:b5,rightstick:a2,righttrigger:b7,rightx:h0.9,righty:h0.4,start:b9,x:b2,y:b3,platform:Windows,", "03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,platform:Windows,", "03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,", "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", "03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000008f0e00007530000000000000,PS (R) Gamepad,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", "03000000100800000100000000000000,PS1 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", "03000000100800000300000000000000,PS2 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", "03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,", "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,", "03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,", "03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,platform:Windows,", "03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,", "03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,", "03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,platform:Windows,", "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", "030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,", "0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,", "0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,", "030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000006f0e00001e01000000000000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", "03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,platform:Windows,", "03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", "03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Windows,", "03000000300f00001101000000000000,saitek rumble pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", "0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,", "030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,", "03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,platform:Windows,", "030000008f0e00000800000000000000,SpeedLink Strike FX Wireless,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,platform:Windows,", "03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", "030000004f04000015b3000000000000,Thrustmaster Dual Analog 2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,", "030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Windows,", "030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,", "03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", "03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", "03000000380700006652000000000000,UnKnown,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Windows,", "03000000786901006e70000000000000,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", "03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X,", "030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X,", "03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,", "030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,platform:Mac OS X,", "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,", "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,", "030000006d04000016c2000000020000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Mac OS X,", "0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Mac OS X,", "03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X,", "03000000d8140000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Mac OS X,", "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,", "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Mac OS X,", "030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,", "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,", "030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,platform:Mac OS X,", "03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Mac OS X,", "030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", "030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000005e0400008e02000001000000,Steam Virtual GamePad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000110100002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,", "03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,platform:Mac OS X,", "03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,platform:Mac OS X,", "03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,", "03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,", "030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Mac OS X,", "030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Mac OS X,", "03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,platform:Mac OS X,", "050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,platform:Mac OS X,", "050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,platform:Mac OS X,", "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,", "030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", "030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,", "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,", "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "05000000c82d00002038000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "03000000c82d00000190000011010000,8Bitdo NES30 Pro 8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "05000000c82d00003028000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", "05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", "05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,", "05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,", "030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,platform:Linux,", "03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Linux,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Linux,", "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", "03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,", "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,", "030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006f0e00001f01000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys GamePad ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Linux,", "030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,", "030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "0500000047532067616d657061640000,GS gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,platform:Linux,", "03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,platform:Linux,", "030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006a00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006b00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Linux,", "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,", "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,", "03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,platform:Linux,", "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Linux,", "03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,a:b0,b:b4,back:b6,guide:b8,leftshoulder:b9,leftstick:h0.8,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:h0.2,start:b7,x:b2,y:b5,platform:Linux,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,platform:Linux,", "05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Linux,", "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700003888000010010000,MadCatz PC USB Wired Stick 8838,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:a0,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,", "03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", "030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", "030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", "05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,", "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Linux,", "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux,", "05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Linux,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000005e0400000202000000010000,Old Xbox pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,", "05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,", "03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", "030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "05000000504c415953544154494f4e00,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,platform:Linux,", "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,platform:Linux,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", "0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,", "0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,", "0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,", "030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", "03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,", "03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,platform:Linux,", "03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,", "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Linux,", "03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", "03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,platform:Linux,", "03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,", "030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,", "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,", "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,", "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Linux,", "030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,", "03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,platform:Linux,", "03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,platform:Linux,", "05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:Linux,", "0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", "03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Linux,", "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,", "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "64633436313965656664373634323364,Microsoft X-Box 360 pad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,platform:Android,", "61363931656135336130663561616264,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,", "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,", "37336435666338653565313731303834,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,", "35643031303033326130316330353564,PS4 Controller,a:b1,b:b17,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,platform:Android,", "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Android,", "5477696e20555342204a6f7973746963,Twin USB Joystick,a:b22,b:b21,back:b28,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,leftstick:b30,lefttrigger:b24,leftx:a0,lefty:a1,rightshoulder:b27,rightstick:b31,righttrigger:b25,rightx:a3,righty:a2,start:b29,x:b23,y:b20,platform:Android,", "34356136633366613530316338376136,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,x:b17,y:b2,platform:Android,", "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:iOS,", "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,platform:iOS,", "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:iOS,", "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", NULL }; ================================================ FILE: thirdparty/glfw/src/mappings.h.in ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2006-2018 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // As mappings.h.in, this file is used by CMake to produce the mappings.h // header file. If you are adding a GLFW specific gamepad mapping, this is // where to put it. //======================================================================== // As mappings.h, this provides all pre-defined gamepad mappings, including // all available in SDL_GameControllerDB. Do not edit this file. Any gamepad // mappings not specific to GLFW should be submitted to SDL_GameControllerDB. // This file can be re-generated from mappings.h.in and the upstream // gamecontrollerdb.txt with the GenerateMappings.cmake script. //======================================================================== // All gamepad mappings not labeled GLFW are copied from the // SDL_GameControllerDB project under the following license: // // Simple DirectMedia Layer // Copyright (C) 1997-2013 Sam Lantinga // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the // use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. const char* _glfwDefaultMappings[] = { @GLFW_GAMEPAD_MAPPINGS@ "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", NULL }; ================================================ FILE: thirdparty/glfw/src/monitor.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include #include #include // Lexically compare video modes, used by qsort // static int compareVideoModes(const void* fp, const void* sp) { const GLFWvidmode* fm = fp; const GLFWvidmode* sm = sp; const int fbpp = fm->redBits + fm->greenBits + fm->blueBits; const int sbpp = sm->redBits + sm->greenBits + sm->blueBits; const int farea = fm->width * fm->height; const int sarea = sm->width * sm->height; // First sort on color bits per pixel if (fbpp != sbpp) return fbpp - sbpp; // Then sort on screen area if (farea != sarea) return farea - sarea; // Then sort on width if (fm->width != sm->width) return fm->width - sm->width; // Lastly sort on refresh rate return fm->refreshRate - sm->refreshRate; } // Retrieves the available modes for the specified monitor // static GLFWbool refreshVideoModes(_GLFWmonitor* monitor) { int modeCount; GLFWvidmode* modes; if (monitor->modes) return GLFW_TRUE; modes = _glfwPlatformGetVideoModes(monitor, &modeCount); if (!modes) return GLFW_FALSE; qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes); free(monitor->modes); monitor->modes = modes; monitor->modeCount = modeCount; return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW event API ////// ////////////////////////////////////////////////////////////////////////// // Notifies shared code of a monitor connection or disconnection // void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement) { if (action == GLFW_CONNECTED) { _glfw.monitorCount++; _glfw.monitors = realloc(_glfw.monitors, sizeof(_GLFWmonitor*) * _glfw.monitorCount); if (placement == _GLFW_INSERT_FIRST) { memmove(_glfw.monitors + 1, _glfw.monitors, ((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*)); _glfw.monitors[0] = monitor; } else _glfw.monitors[_glfw.monitorCount - 1] = monitor; } else if (action == GLFW_DISCONNECTED) { int i; _GLFWwindow* window; for (window = _glfw.windowListHead; window; window = window->next) { if (window->monitor == monitor) { int width, height, xoff, yoff; _glfwPlatformGetWindowSize(window, &width, &height); _glfwPlatformSetWindowMonitor(window, NULL, 0, 0, width, height, 0); _glfwPlatformGetWindowFrameSize(window, &xoff, &yoff, NULL, NULL); _glfwPlatformSetWindowPos(window, xoff, yoff); } } for (i = 0; i < _glfw.monitorCount; i++) { if (_glfw.monitors[i] == monitor) { _glfw.monitorCount--; memmove(_glfw.monitors + i, _glfw.monitors + i + 1, ((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*)); break; } } } if (_glfw.callbacks.monitor) _glfw.callbacks.monitor((GLFWmonitor*) monitor, action); if (action == GLFW_DISCONNECTED) _glfwFreeMonitor(monitor); } // Notifies shared code that a full screen window has acquired or released // a monitor // void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window) { monitor->window = window; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Allocates and returns a monitor object with the specified name and dimensions // _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM) { _GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor)); monitor->widthMM = widthMM; monitor->heightMM = heightMM; if (name) monitor->name = _glfw_strdup(name); return monitor; } // Frees a monitor object and any data associated with it // void _glfwFreeMonitor(_GLFWmonitor* monitor) { if (monitor == NULL) return; _glfwPlatformFreeMonitor(monitor); _glfwFreeGammaArrays(&monitor->originalRamp); _glfwFreeGammaArrays(&monitor->currentRamp); free(monitor->modes); free(monitor->name); free(monitor); } // Allocates red, green and blue value arrays of the specified size // void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size) { ramp->red = calloc(size, sizeof(unsigned short)); ramp->green = calloc(size, sizeof(unsigned short)); ramp->blue = calloc(size, sizeof(unsigned short)); ramp->size = size; } // Frees the red, green and blue value arrays and clears the struct // void _glfwFreeGammaArrays(GLFWgammaramp* ramp) { free(ramp->red); free(ramp->green); free(ramp->blue); memset(ramp, 0, sizeof(GLFWgammaramp)); } // Chooses the video mode most closely matching the desired one // const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) { int i; unsigned int sizeDiff, leastSizeDiff = UINT_MAX; unsigned int rateDiff, leastRateDiff = UINT_MAX; unsigned int colorDiff, leastColorDiff = UINT_MAX; const GLFWvidmode* current; const GLFWvidmode* closest = NULL; if (!refreshVideoModes(monitor)) return NULL; for (i = 0; i < monitor->modeCount; i++) { current = monitor->modes + i; colorDiff = 0; if (desired->redBits != GLFW_DONT_CARE) colorDiff += abs(current->redBits - desired->redBits); if (desired->greenBits != GLFW_DONT_CARE) colorDiff += abs(current->greenBits - desired->greenBits); if (desired->blueBits != GLFW_DONT_CARE) colorDiff += abs(current->blueBits - desired->blueBits); sizeDiff = abs((current->width - desired->width) * (current->width - desired->width) + (current->height - desired->height) * (current->height - desired->height)); if (desired->refreshRate != GLFW_DONT_CARE) rateDiff = abs(current->refreshRate - desired->refreshRate); else rateDiff = UINT_MAX - current->refreshRate; if ((colorDiff < leastColorDiff) || (colorDiff == leastColorDiff && sizeDiff < leastSizeDiff) || (colorDiff == leastColorDiff && sizeDiff == leastSizeDiff && rateDiff < leastRateDiff)) { closest = current; leastSizeDiff = sizeDiff; leastRateDiff = rateDiff; leastColorDiff = colorDiff; } } return closest; } // Performs lexical comparison between two @ref GLFWvidmode structures // int _glfwCompareVideoModes(const GLFWvidmode* fm, const GLFWvidmode* sm) { return compareVideoModes(fm, sm); } // Splits a color depth into red, green and blue bit depths // void _glfwSplitBPP(int bpp, int* red, int* green, int* blue) { int delta; // We assume that by 32 the user really meant 24 if (bpp == 32) bpp = 24; // Convert "bits per pixel" to red, green & blue sizes *red = *green = *blue = bpp / 3; delta = bpp - (*red * 3); if (delta >= 1) *green = *green + 1; if (delta == 2) *red = *red + 1; } ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI GLFWmonitor** glfwGetMonitors(int* count) { assert(count != NULL); *count = 0; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); *count = _glfw.monitorCount; return (GLFWmonitor**) _glfw.monitors; } GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (!_glfw.monitorCount) return NULL; return (GLFWmonitor*) _glfw.monitors[0]; } GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); if (xpos) *xpos = 0; if (ypos) *ypos = 0; _GLFW_REQUIRE_INIT(); _glfwPlatformGetMonitorPos(monitor, xpos, ypos); } GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* handle, int* xpos, int* ypos, int* width, int* height) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); if (xpos) *xpos = 0; if (ypos) *ypos = 0; if (width) *width = 0; if (height) *height = 0; _GLFW_REQUIRE_INIT(); _glfwPlatformGetMonitorWorkarea(monitor, xpos, ypos, width, height); } GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); if (widthMM) *widthMM = 0; if (heightMM) *heightMM = 0; _GLFW_REQUIRE_INIT(); if (widthMM) *widthMM = monitor->widthMM; if (heightMM) *heightMM = monitor->heightMM; } GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* handle, float* xscale, float* yscale) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); if (xscale) *xscale = 0.f; if (yscale) *yscale = 0.f; _GLFW_REQUIRE_INIT(); _glfwPlatformGetMonitorContentScale(monitor, xscale, yscale); } GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return monitor->name; } GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* handle, void* pointer) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); _GLFW_REQUIRE_INIT(); monitor->userPointer = pointer; } GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return monitor->userPointer; } GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(_glfw.callbacks.monitor, cbfun); return cbfun; } GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); assert(count != NULL); *count = 0; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (!refreshVideoModes(monitor)) return NULL; *count = monitor->modeCount; return monitor->modes; } GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _glfwPlatformGetVideoMode(monitor, &monitor->currentMode); return &monitor->currentMode; } GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) { unsigned int i; unsigned short* values; GLFWgammaramp ramp; const GLFWgammaramp* original; assert(handle != NULL); assert(gamma > 0.f); assert(gamma <= FLT_MAX); _GLFW_REQUIRE_INIT(); if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma); return; } original = glfwGetGammaRamp(handle); if (!original) return; values = calloc(original->size, sizeof(unsigned short)); for (i = 0; i < original->size; i++) { float value; // Calculate intensity value = i / (float) (original->size - 1); // Apply gamma curve value = powf(value, 1.f / gamma) * 65535.f + 0.5f; // Clamp to value range value = _glfw_fminf(value, 65535.f); values[i] = (unsigned short) value; } ramp.red = values; ramp.green = values; ramp.blue = values; ramp.size = original->size; glfwSetGammaRamp(handle, &ramp); free(values); } GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _glfwFreeGammaArrays(&monitor->currentRamp); if (!_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp)) return NULL; return &monitor->currentRamp; } GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); assert(ramp != NULL); assert(ramp->size > 0); assert(ramp->red != NULL); assert(ramp->green != NULL); assert(ramp->blue != NULL); if (ramp->size <= 0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma ramp size %i", ramp->size); return; } _GLFW_REQUIRE_INIT(); if (!monitor->originalRamp.size) { if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp)) return; } _glfwPlatformSetGammaRamp(monitor, ramp); } ================================================ FILE: thirdparty/glfw/src/nsgl_context.h ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // NOTE: Many Cocoa enum values have been renamed and we need to build across // SDK versions where one is unavailable or the other deprecated // We use the newer names in code and these macros to handle compatibility #if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity #endif #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl #include // NSGL-specific per-context data // typedef struct _GLFWcontextNSGL { id pixelFormat; id object; } _GLFWcontextNSGL; // NSGL-specific global data // typedef struct _GLFWlibraryNSGL { // dlopen handle for OpenGL.framework (for glfwGetProcAddress) CFBundleRef framework; } _GLFWlibraryNSGL; GLFWbool _glfwInitNSGL(void); void _glfwTerminateNSGL(void); GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyContextNSGL(_GLFWwindow* window); ================================================ FILE: thirdparty/glfw/src/nsgl_context.m ================================================ //======================================================================== // GLFW 3.3 macOS - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include static void makeContextCurrentNSGL(_GLFWwindow* window) { @autoreleasepool { if (window) [window->context.nsgl.object makeCurrentContext]; else [NSOpenGLContext clearCurrentContext]; _glfwPlatformSetTls(&_glfw.contextSlot, window); } // autoreleasepool } static void swapBuffersNSGL(_GLFWwindow* window) { @autoreleasepool { // HACK: Simulate vsync with usleep as NSGL swap interval does not apply to // windows with a non-visible occlusion state if (!([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)) { int interval = 0; [window->context.nsgl.object getValues:&interval forParameter:NSOpenGLContextParameterSwapInterval]; if (interval > 0) { const double framerate = 60.0; const uint64_t frequency = _glfwPlatformGetTimerFrequency(); const uint64_t value = _glfwPlatformGetTimerValue(); const double elapsed = value / (double) frequency; const double period = 1.0 / framerate; const double delay = period - fmod(elapsed, period); usleep(floorl(delay * 1e6)); } } [window->context.nsgl.object flushBuffer]; } // autoreleasepool } static void swapIntervalNSGL(int interval) { @autoreleasepool { _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); if (window) { [window->context.nsgl.object setValues:&interval forParameter:NSOpenGLContextParameterSwapInterval]; } } // autoreleasepool } static int extensionSupportedNSGL(const char* extension) { // There are no NSGL extensions return GLFW_FALSE; } static GLFWglproc getProcAddressNSGL(const char* procname) { CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault, procname, kCFStringEncodingASCII); GLFWglproc symbol = CFBundleGetFunctionPointerForName(_glfw.nsgl.framework, symbolName); CFRelease(symbolName); return symbol; } static void destroyContextNSGL(_GLFWwindow* window) { @autoreleasepool { [window->context.nsgl.pixelFormat release]; window->context.nsgl.pixelFormat = nil; [window->context.nsgl.object release]; window->context.nsgl.object = nil; } // autoreleasepool } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize OpenGL support // GLFWbool _glfwInitNSGL(void) { if (_glfw.nsgl.framework) return GLFW_TRUE; _glfw.nsgl.framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")); if (_glfw.nsgl.framework == NULL) { _glfwInputError(GLFW_API_UNAVAILABLE, "NSGL: Failed to locate OpenGL framework"); return GLFW_FALSE; } return GLFW_TRUE; } // Terminate OpenGL support // void _glfwTerminateNSGL(void) { } // Create the OpenGL context // GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { if (ctxconfig->client == GLFW_OPENGL_ES_API) { _glfwInputError(GLFW_API_UNAVAILABLE, "NSGL: OpenGL ES is not available on macOS"); return GLFW_FALSE; } if (ctxconfig->major > 2) { if (ctxconfig->major == 3 && ctxconfig->minor < 2) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above"); return GLFW_FALSE; } if (!ctxconfig->forward || ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above"); return GLFW_FALSE; } } // Context robustness modes (GL_KHR_robustness) are not yet supported by // macOS but are not a hard constraint, so ignore and continue // Context release behaviors (GL_KHR_context_flush_control) are not yet // supported by macOS but are not a hard constraint, so ignore and continue // Debug contexts (GL_KHR_debug) are not yet supported by macOS but are not // a hard constraint, so ignore and continue // No-error contexts (GL_KHR_no_error) are not yet supported by macOS but // are not a hard constraint, so ignore and continue #define addAttrib(a) \ { \ assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ } #define setAttrib(a, v) { addAttrib(a); addAttrib(v); } NSOpenGLPixelFormatAttribute attribs[40]; int index = 0; addAttrib(NSOpenGLPFAAccelerated); addAttrib(NSOpenGLPFAClosestPolicy); if (ctxconfig->nsgl.offline) { addAttrib(NSOpenGLPFAAllowOfflineRenderers); // NOTE: This replaces the NSSupportsAutomaticGraphicsSwitching key in // Info.plist for unbundled applications // HACK: This assumes that NSOpenGLPixelFormat will remain // a straightforward wrapper of its CGL counterpart addAttrib(kCGLPFASupportsAutomaticGraphicsSwitching); } #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 if (ctxconfig->major >= 4) { setAttrib(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core); } else #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ if (ctxconfig->major >= 3) { setAttrib(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); } if (ctxconfig->major <= 2) { if (fbconfig->auxBuffers != GLFW_DONT_CARE) setAttrib(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers); if (fbconfig->accumRedBits != GLFW_DONT_CARE && fbconfig->accumGreenBits != GLFW_DONT_CARE && fbconfig->accumBlueBits != GLFW_DONT_CARE && fbconfig->accumAlphaBits != GLFW_DONT_CARE) { const int accumBits = fbconfig->accumRedBits + fbconfig->accumGreenBits + fbconfig->accumBlueBits + fbconfig->accumAlphaBits; setAttrib(NSOpenGLPFAAccumSize, accumBits); } } if (fbconfig->redBits != GLFW_DONT_CARE && fbconfig->greenBits != GLFW_DONT_CARE && fbconfig->blueBits != GLFW_DONT_CARE) { int colorBits = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits; // macOS needs non-zero color size, so set reasonable values if (colorBits == 0) colorBits = 24; else if (colorBits < 15) colorBits = 15; setAttrib(NSOpenGLPFAColorSize, colorBits); } if (fbconfig->alphaBits != GLFW_DONT_CARE) setAttrib(NSOpenGLPFAAlphaSize, fbconfig->alphaBits); if (fbconfig->depthBits != GLFW_DONT_CARE) setAttrib(NSOpenGLPFADepthSize, fbconfig->depthBits); if (fbconfig->stencilBits != GLFW_DONT_CARE) setAttrib(NSOpenGLPFAStencilSize, fbconfig->stencilBits); if (fbconfig->stereo) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "NSGL: Stereo rendering is deprecated"); return GLFW_FALSE; #else addAttrib(NSOpenGLPFAStereo); #endif } if (fbconfig->doublebuffer) addAttrib(NSOpenGLPFADoubleBuffer); if (fbconfig->samples != GLFW_DONT_CARE) { if (fbconfig->samples == 0) { setAttrib(NSOpenGLPFASampleBuffers, 0); } else { setAttrib(NSOpenGLPFASampleBuffers, 1); setAttrib(NSOpenGLPFASamples, fbconfig->samples); } } // NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB // framebuffer, so there's no need (and no way) to request it addAttrib(0); #undef addAttrib #undef setAttrib window->context.nsgl.pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; if (window->context.nsgl.pixelFormat == nil) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "NSGL: Failed to find a suitable pixel format"); return GLFW_FALSE; } NSOpenGLContext* share = nil; if (ctxconfig->share) share = ctxconfig->share->context.nsgl.object; window->context.nsgl.object = [[NSOpenGLContext alloc] initWithFormat:window->context.nsgl.pixelFormat shareContext:share]; if (window->context.nsgl.object == nil) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: Failed to create OpenGL context"); return GLFW_FALSE; } if (fbconfig->transparent) { GLint opaque = 0; [window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLContextParameterSurfaceOpacity]; } [window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina]; [window->context.nsgl.object setView:window->ns.view]; window->context.makeCurrent = makeContextCurrentNSGL; window->context.swapBuffers = swapBuffersNSGL; window->context.swapInterval = swapIntervalNSGL; window->context.extensionSupported = extensionSupportedNSGL; window->context.getProcAddress = getProcAddressNSGL; window->context.destroy = destroyContextNSGL; return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(nil); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return nil; } return window->context.nsgl.object; } ================================================ FILE: thirdparty/glfw/src/null_init.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformInit(void) { _glfwInitTimerPOSIX(); return GLFW_TRUE; } void _glfwPlatformTerminate(void) { _glfwTerminateOSMesa(); } const char* _glfwPlatformGetVersionString(void) { return _GLFW_VERSION_NUMBER " null OSMesa"; } ================================================ FILE: thirdparty/glfw/src/null_joystick.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) { return GLFW_FALSE; } void _glfwPlatformUpdateGamepadGUID(char* guid) { } ================================================ FILE: thirdparty/glfw/src/null_joystick.h ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 _GLFW_PLATFORM_JOYSTICK_STATE struct { int dummyJoystick; } #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } #define _GLFW_PLATFORM_MAPPING_NAME "" ================================================ FILE: thirdparty/glfw/src/null_monitor.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) { } void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { } void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale) { if (xscale) *xscale = 1.f; if (yscale) *yscale = 1.f; } void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height) { } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) { return NULL; } void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { } GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { return GLFW_FALSE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { } ================================================ FILE: thirdparty/glfw/src/null_platform.h ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null #define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; } #define _GLFW_PLATFORM_MONITOR_STATE struct { int dummyMonitor; } #define _GLFW_PLATFORM_CURSOR_STATE struct { int dummyCursor; } #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE struct { int dummyLibraryWindow; } #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; } #define _GLFW_EGL_CONTEXT_STATE struct { int dummyEGLContext; } #define _GLFW_EGL_LIBRARY_CONTEXT_STATE struct { int dummyEGLLibraryContext; } #include "osmesa_context.h" #include "posix_time.h" #include "posix_thread.h" #include "null_joystick.h" #if defined(_GLFW_WIN32) #define _glfw_dlopen(name) LoadLibraryA(name) #define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle) #define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name) #else #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlsym(handle, name) dlsym(handle, name) #endif // Null-specific per-window data // typedef struct _GLFWwindowNull { int width; int height; } _GLFWwindowNull; ================================================ FILE: thirdparty/glfw/src/null_window.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" static int createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { window->null.width = wndconfig->width; window->null.height = wndconfig->height; return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { if (!createNativeWindow(window, wndconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) { if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API || ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { if (!_glfwInitOSMesa()) return GLFW_FALSE; if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else { _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); return GLFW_FALSE; } } return GLFW_TRUE; } void _glfwPlatformDestroyWindow(_GLFWwindow* window) { if (window->context.destroy) window->context.destroy(window); } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images) { } void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate) { } void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { } void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) { } void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { if (width) *width = window->null.width; if (height) *height = window->null.height; } void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { window->null.width = width; window->null.height = height; } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d) { } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { if (width) *width = window->null.width; if (height) *height = window->null.height; } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { } void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale) { if (xscale) *xscale = 1.f; if (yscale) *yscale = 1.f; } void _glfwPlatformIconifyWindow(_GLFWwindow* window) { } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { } int _glfwPlatformWindowMaximized(_GLFWwindow* window) { return GLFW_FALSE; } int _glfwPlatformWindowHovered(_GLFWwindow* window) { return GLFW_FALSE; } int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { return GLFW_FALSE; } void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { } void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { } float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { return 1.f; } void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { } void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled) { } GLFWbool _glfwPlatformRawMouseMotionSupported(void) { return GLFW_FALSE; } void _glfwPlatformShowWindow(_GLFWwindow* window) { } void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { } void _glfwPlatformUnhideWindow(_GLFWwindow* window) { } void _glfwPlatformHideWindow(_GLFWwindow* window) { } void _glfwPlatformFocusWindow(_GLFWwindow* window) { } int _glfwPlatformWindowFocused(_GLFWwindow* window) { return GLFW_FALSE; } int _glfwPlatformWindowIconified(_GLFWwindow* window) { return GLFW_FALSE; } int _glfwPlatformWindowVisible(_GLFWwindow* window) { return GLFW_FALSE; } void _glfwPlatformPollEvents(void) { } void _glfwPlatformWaitEvents(void) { } void _glfwPlatformWaitEventsTimeout(double timeout) { } void _glfwPlatformPostEmptyEvent(void) { } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { } void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { } void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { } int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) { return GLFW_TRUE; } int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { return GLFW_TRUE; } void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) { } void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { } void _glfwPlatformSetClipboardString(const char* string) { } const char* _glfwPlatformGetClipboardString(void) { return NULL; } const char* _glfwPlatformGetScancodeName(int scancode) { return ""; } int _glfwPlatformGetKeyScancode(int key) { return -1; } void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) { } int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { return GLFW_FALSE; } VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { // This seems like the most appropriate error to return here return VK_ERROR_INITIALIZATION_FAILED; } ================================================ FILE: thirdparty/glfw/src/osmesa_context.c ================================================ //======================================================================== // GLFW 3.3 OSMesa - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include #include #include #include "internal.h" static void makeContextCurrentOSMesa(_GLFWwindow* window) { if (window) { int width, height; _glfwPlatformGetFramebufferSize(window, &width, &height); // Check to see if we need to allocate a new buffer if ((window->context.osmesa.buffer == NULL) || (width != window->context.osmesa.width) || (height != window->context.osmesa.height)) { free(window->context.osmesa.buffer); // Allocate the new buffer (width * height * 8-bit RGBA) window->context.osmesa.buffer = calloc(4, (size_t) width * height); window->context.osmesa.width = width; window->context.osmesa.height = height; } if (!OSMesaMakeCurrent(window->context.osmesa.handle, window->context.osmesa.buffer, GL_UNSIGNED_BYTE, width, height)) { _glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to make context current"); return; } } _glfwPlatformSetTls(&_glfw.contextSlot, window); } static GLFWglproc getProcAddressOSMesa(const char* procname) { return (GLFWglproc) OSMesaGetProcAddress(procname); } static void destroyContextOSMesa(_GLFWwindow* window) { if (window->context.osmesa.handle) { OSMesaDestroyContext(window->context.osmesa.handle); window->context.osmesa.handle = NULL; } if (window->context.osmesa.buffer) { free(window->context.osmesa.buffer); window->context.osmesa.width = 0; window->context.osmesa.height = 0; } } static void swapBuffersOSMesa(_GLFWwindow* window) { // No double buffering on OSMesa } static void swapIntervalOSMesa(int interval) { // No swap interval on OSMesa } static int extensionSupportedOSMesa(const char* extension) { // OSMesa does not have extensions return GLFW_FALSE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// GLFWbool _glfwInitOSMesa(void) { int i; const char* sonames[] = { #if defined(_GLFW_OSMESA_LIBRARY) _GLFW_OSMESA_LIBRARY, #elif defined(_WIN32) "libOSMesa.dll", "OSMesa.dll", #elif defined(__APPLE__) "libOSMesa.8.dylib", #elif defined(__CYGWIN__) "libOSMesa-8.so", #else "libOSMesa.so.8", "libOSMesa.so.6", #endif NULL }; if (_glfw.osmesa.handle) return GLFW_TRUE; for (i = 0; sonames[i]; i++) { _glfw.osmesa.handle = _glfw_dlopen(sonames[i]); if (_glfw.osmesa.handle) break; } if (!_glfw.osmesa.handle) { _glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: Library not found"); return GLFW_FALSE; } _glfw.osmesa.CreateContextExt = (PFN_OSMesaCreateContextExt) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContextExt"); _glfw.osmesa.CreateContextAttribs = (PFN_OSMesaCreateContextAttribs) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContextAttribs"); _glfw.osmesa.DestroyContext = (PFN_OSMesaDestroyContext) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaDestroyContext"); _glfw.osmesa.MakeCurrent = (PFN_OSMesaMakeCurrent) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaMakeCurrent"); _glfw.osmesa.GetColorBuffer = (PFN_OSMesaGetColorBuffer) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetColorBuffer"); _glfw.osmesa.GetDepthBuffer = (PFN_OSMesaGetDepthBuffer) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetDepthBuffer"); _glfw.osmesa.GetProcAddress = (PFN_OSMesaGetProcAddress) _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetProcAddress"); if (!_glfw.osmesa.CreateContextExt || !_glfw.osmesa.DestroyContext || !_glfw.osmesa.MakeCurrent || !_glfw.osmesa.GetColorBuffer || !_glfw.osmesa.GetDepthBuffer || !_glfw.osmesa.GetProcAddress) { _glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to load required entry points"); _glfwTerminateOSMesa(); return GLFW_FALSE; } return GLFW_TRUE; } void _glfwTerminateOSMesa(void) { if (_glfw.osmesa.handle) { _glfw_dlclose(_glfw.osmesa.handle); _glfw.osmesa.handle = NULL; } } #define setAttrib(a, v) \ { \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { OSMesaContext share = NULL; const int accumBits = fbconfig->accumRedBits + fbconfig->accumGreenBits + fbconfig->accumBlueBits + fbconfig->accumAlphaBits; if (ctxconfig->client == GLFW_OPENGL_ES_API) { _glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: OpenGL ES is not available on OSMesa"); return GLFW_FALSE; } if (ctxconfig->share) share = ctxconfig->share->context.osmesa.handle; if (OSMesaCreateContextAttribs) { int index = 0, attribs[40]; setAttrib(OSMESA_FORMAT, OSMESA_RGBA); setAttrib(OSMESA_DEPTH_BITS, fbconfig->depthBits); setAttrib(OSMESA_STENCIL_BITS, fbconfig->stencilBits); setAttrib(OSMESA_ACCUM_BITS, accumBits); if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) { setAttrib(OSMESA_PROFILE, OSMESA_CORE_PROFILE); } else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) { setAttrib(OSMESA_PROFILE, OSMESA_COMPAT_PROFILE); } if (ctxconfig->major != 1 || ctxconfig->minor != 0) { setAttrib(OSMESA_CONTEXT_MAJOR_VERSION, ctxconfig->major); setAttrib(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor); } if (ctxconfig->forward) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "OSMesa: Forward-compatible contexts not supported"); return GLFW_FALSE; } setAttrib(0, 0); window->context.osmesa.handle = OSMesaCreateContextAttribs(attribs, share); } else { if (ctxconfig->profile) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "OSMesa: OpenGL profiles unavailable"); return GLFW_FALSE; } window->context.osmesa.handle = OSMesaCreateContextExt(OSMESA_RGBA, fbconfig->depthBits, fbconfig->stencilBits, accumBits, share); } if (window->context.osmesa.handle == NULL) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "OSMesa: Failed to create context"); return GLFW_FALSE; } window->context.makeCurrent = makeContextCurrentOSMesa; window->context.swapBuffers = swapBuffersOSMesa; window->context.swapInterval = swapIntervalOSMesa; window->context.extensionSupported = extensionSupportedOSMesa; window->context.getProcAddress = getProcAddressOSMesa; window->context.destroy = destroyContextOSMesa; return GLFW_TRUE; } #undef setAttrib ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width, int* height, int* format, void** buffer) { void* mesaBuffer; GLint mesaWidth, mesaHeight, mesaFormat; _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (!OSMesaGetColorBuffer(window->context.osmesa.handle, &mesaWidth, &mesaHeight, &mesaFormat, &mesaBuffer)) { _glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to retrieve color buffer"); return GLFW_FALSE; } if (width) *width = mesaWidth; if (height) *height = mesaHeight; if (format) *format = mesaFormat; if (buffer) *buffer = mesaBuffer; return GLFW_TRUE; } GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle, int* width, int* height, int* bytesPerValue, void** buffer) { void* mesaBuffer; GLint mesaWidth, mesaHeight, mesaBytes; _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (!OSMesaGetDepthBuffer(window->context.osmesa.handle, &mesaWidth, &mesaHeight, &mesaBytes, &mesaBuffer)) { _glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to retrieve depth buffer"); return GLFW_FALSE; } if (width) *width = mesaWidth; if (height) *height = mesaHeight; if (bytesPerValue) *bytesPerValue = mesaBytes; if (buffer) *buffer = mesaBuffer; return GLFW_TRUE; } GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return NULL; } return window->context.osmesa.handle; } ================================================ FILE: thirdparty/glfw/src/osmesa_context.h ================================================ //======================================================================== // GLFW 3.3 OSMesa - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 OSMESA_RGBA 0x1908 #define OSMESA_FORMAT 0x22 #define OSMESA_DEPTH_BITS 0x30 #define OSMESA_STENCIL_BITS 0x31 #define OSMESA_ACCUM_BITS 0x32 #define OSMESA_PROFILE 0x33 #define OSMESA_CORE_PROFILE 0x34 #define OSMESA_COMPAT_PROFILE 0x35 #define OSMESA_CONTEXT_MAJOR_VERSION 0x36 #define OSMESA_CONTEXT_MINOR_VERSION 0x37 typedef void* OSMesaContext; typedef void (*OSMESAproc)(void); typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext); typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext); typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext); typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int); typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**); typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**); typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*); #define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt #define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs #define OSMesaDestroyContext _glfw.osmesa.DestroyContext #define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent #define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer #define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer #define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress #define _GLFW_OSMESA_CONTEXT_STATE _GLFWcontextOSMesa osmesa #define _GLFW_OSMESA_LIBRARY_CONTEXT_STATE _GLFWlibraryOSMesa osmesa // OSMesa-specific per-context data // typedef struct _GLFWcontextOSMesa { OSMesaContext handle; int width; int height; void* buffer; } _GLFWcontextOSMesa; // OSMesa-specific global data // typedef struct _GLFWlibraryOSMesa { void* handle; PFN_OSMesaCreateContextExt CreateContextExt; PFN_OSMesaCreateContextAttribs CreateContextAttribs; PFN_OSMesaDestroyContext DestroyContext; PFN_OSMesaMakeCurrent MakeCurrent; PFN_OSMesaGetColorBuffer GetColorBuffer; PFN_OSMesaGetDepthBuffer GetDepthBuffer; PFN_OSMesaGetProcAddress GetProcAddress; } _GLFWlibraryOSMesa; GLFWbool _glfwInitOSMesa(void); void _glfwTerminateOSMesa(void); GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); ================================================ FILE: thirdparty/glfw/src/posix_thread.c ================================================ //======================================================================== // GLFW 3.3 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) { assert(tls->posix.allocated == GLFW_FALSE); if (pthread_key_create(&tls->posix.key, NULL) != 0) { _glfwInputError(GLFW_PLATFORM_ERROR, "POSIX: Failed to create context TLS"); return GLFW_FALSE; } tls->posix.allocated = GLFW_TRUE; return GLFW_TRUE; } void _glfwPlatformDestroyTls(_GLFWtls* tls) { if (tls->posix.allocated) pthread_key_delete(tls->posix.key); memset(tls, 0, sizeof(_GLFWtls)); } void* _glfwPlatformGetTls(_GLFWtls* tls) { assert(tls->posix.allocated == GLFW_TRUE); return pthread_getspecific(tls->posix.key); } void _glfwPlatformSetTls(_GLFWtls* tls, void* value) { assert(tls->posix.allocated == GLFW_TRUE); pthread_setspecific(tls->posix.key, value); } GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) { assert(mutex->posix.allocated == GLFW_FALSE); if (pthread_mutex_init(&mutex->posix.handle, NULL) != 0) { _glfwInputError(GLFW_PLATFORM_ERROR, "POSIX: Failed to create mutex"); return GLFW_FALSE; } return mutex->posix.allocated = GLFW_TRUE; } void _glfwPlatformDestroyMutex(_GLFWmutex* mutex) { if (mutex->posix.allocated) pthread_mutex_destroy(&mutex->posix.handle); memset(mutex, 0, sizeof(_GLFWmutex)); } void _glfwPlatformLockMutex(_GLFWmutex* mutex) { assert(mutex->posix.allocated == GLFW_TRUE); pthread_mutex_lock(&mutex->posix.handle); } void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) { assert(mutex->posix.allocated == GLFW_TRUE); pthread_mutex_unlock(&mutex->posix.handle); } ================================================ FILE: thirdparty/glfw/src/posix_thread.h ================================================ //======================================================================== // GLFW 3.3 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define _GLFW_PLATFORM_TLS_STATE _GLFWtlsPOSIX posix #define _GLFW_PLATFORM_MUTEX_STATE _GLFWmutexPOSIX posix // POSIX-specific thread local storage data // typedef struct _GLFWtlsPOSIX { GLFWbool allocated; pthread_key_t key; } _GLFWtlsPOSIX; // POSIX-specific mutex data // typedef struct _GLFWmutexPOSIX { GLFWbool allocated; pthread_mutex_t handle; } _GLFWmutexPOSIX; ================================================ FILE: thirdparty/glfw/src/posix_time.c ================================================ //======================================================================== // GLFW 3.3 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialise timer // void _glfwInitTimerPOSIX(void) { #if defined(CLOCK_MONOTONIC) struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { _glfw.timer.posix.monotonic = GLFW_TRUE; _glfw.timer.posix.frequency = 1000000000; } else #endif { _glfw.timer.posix.monotonic = GLFW_FALSE; _glfw.timer.posix.frequency = 1000000; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// uint64_t _glfwPlatformGetTimerValue(void) { #if defined(CLOCK_MONOTONIC) if (_glfw.timer.posix.monotonic) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec; } else #endif { struct timeval tv; gettimeofday(&tv, NULL); return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec; } } uint64_t _glfwPlatformGetTimerFrequency(void) { return _glfw.timer.posix.frequency; } ================================================ FILE: thirdparty/glfw/src/posix_time.h ================================================ //======================================================================== // GLFW 3.3 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix #include // POSIX-specific global timer data // typedef struct _GLFWtimerPOSIX { GLFWbool monotonic; uint64_t frequency; } _GLFWtimerPOSIX; void _glfwInitTimerPOSIX(void); ================================================ FILE: thirdparty/glfw/src/vulkan.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2018 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #define _GLFW_FIND_LOADER 1 #define _GLFW_REQUIRE_LOADER 2 ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// GLFWbool _glfwInitVulkan(int mode) { VkResult err; VkExtensionProperties* ep; uint32_t i, count; if (_glfw.vk.available) return GLFW_TRUE; #if !defined(_GLFW_VULKAN_STATIC) #if defined(_GLFW_VULKAN_LIBRARY) _glfw.vk.handle = _glfw_dlopen(_GLFW_VULKAN_LIBRARY); #elif defined(_GLFW_WIN32) _glfw.vk.handle = _glfw_dlopen("vulkan-1.dll"); #elif defined(_GLFW_COCOA) _glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib"); if (!_glfw.vk.handle) _glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS(); #else _glfw.vk.handle = _glfw_dlopen("libvulkan.so.1"); #endif if (!_glfw.vk.handle) { if (mode == _GLFW_REQUIRE_LOADER) _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Loader not found"); return GLFW_FALSE; } _glfw.vk.GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) _glfw_dlsym(_glfw.vk.handle, "vkGetInstanceProcAddr"); if (!_glfw.vk.GetInstanceProcAddr) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Loader does not export vkGetInstanceProcAddr"); _glfwTerminateVulkan(); return GLFW_FALSE; } _glfw.vk.EnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceExtensionProperties"); if (!_glfw.vk.EnumerateInstanceExtensionProperties) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Failed to retrieve vkEnumerateInstanceExtensionProperties"); _glfwTerminateVulkan(); return GLFW_FALSE; } #endif // _GLFW_VULKAN_STATIC err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL); if (err) { // NOTE: This happens on systems with a loader but without any Vulkan ICD if (mode == _GLFW_REQUIRE_LOADER) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Failed to query instance extension count: %s", _glfwGetVulkanResultString(err)); } _glfwTerminateVulkan(); return GLFW_FALSE; } ep = calloc(count, sizeof(VkExtensionProperties)); err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep); if (err) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Failed to query instance extensions: %s", _glfwGetVulkanResultString(err)); free(ep); _glfwTerminateVulkan(); return GLFW_FALSE; } for (i = 0; i < count; i++) { if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0) _glfw.vk.KHR_surface = GLFW_TRUE; #if defined(_GLFW_WIN32) else if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0) _glfw.vk.KHR_win32_surface = GLFW_TRUE; #elif defined(_GLFW_COCOA) else if (strcmp(ep[i].extensionName, "VK_MVK_macos_surface") == 0) _glfw.vk.MVK_macos_surface = GLFW_TRUE; else if (strcmp(ep[i].extensionName, "VK_EXT_metal_surface") == 0) _glfw.vk.EXT_metal_surface = GLFW_TRUE; #elif defined(_GLFW_X11) else if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0) _glfw.vk.KHR_xlib_surface = GLFW_TRUE; else if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0) _glfw.vk.KHR_xcb_surface = GLFW_TRUE; #elif defined(_GLFW_WAYLAND) else if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0) _glfw.vk.KHR_wayland_surface = GLFW_TRUE; #endif } free(ep); _glfw.vk.available = GLFW_TRUE; _glfwPlatformGetRequiredInstanceExtensions(_glfw.vk.extensions); return GLFW_TRUE; } void _glfwTerminateVulkan(void) { #if !defined(_GLFW_VULKAN_STATIC) if (_glfw.vk.handle) _glfw_dlclose(_glfw.vk.handle); #endif } const char* _glfwGetVulkanResultString(VkResult result) { switch (result) { case VK_SUCCESS: return "Success"; case VK_NOT_READY: return "A fence or query has not yet completed"; case VK_TIMEOUT: return "A wait operation has not completed in the specified time"; case VK_EVENT_SET: return "An event is signaled"; case VK_EVENT_RESET: return "An event is unsignaled"; case VK_INCOMPLETE: return "A return array was too small for the result"; case VK_ERROR_OUT_OF_HOST_MEMORY: return "A host memory allocation has failed"; case VK_ERROR_OUT_OF_DEVICE_MEMORY: return "A device memory allocation has failed"; case VK_ERROR_INITIALIZATION_FAILED: return "Initialization of an object could not be completed for implementation-specific reasons"; case VK_ERROR_DEVICE_LOST: return "The logical or physical device has been lost"; case VK_ERROR_MEMORY_MAP_FAILED: return "Mapping of a memory object has failed"; case VK_ERROR_LAYER_NOT_PRESENT: return "A requested layer is not present or could not be loaded"; case VK_ERROR_EXTENSION_NOT_PRESENT: return "A requested extension is not supported"; case VK_ERROR_FEATURE_NOT_PRESENT: return "A requested feature is not supported"; case VK_ERROR_INCOMPATIBLE_DRIVER: return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible"; case VK_ERROR_TOO_MANY_OBJECTS: return "Too many objects of the type have already been created"; case VK_ERROR_FORMAT_NOT_SUPPORTED: return "A requested format is not supported on this device"; case VK_ERROR_SURFACE_LOST_KHR: return "A surface is no longer available"; case VK_SUBOPTIMAL_KHR: return "A swapchain no longer matches the surface properties exactly, but can still be used"; case VK_ERROR_OUT_OF_DATE_KHR: return "A surface has changed in such a way that it is no longer compatible with the swapchain"; case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "The display used by a swapchain does not use the same presentable image layout"; case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API"; case VK_ERROR_VALIDATION_FAILED_EXT: return "A validation layer found an error"; default: return "ERROR: UNKNOWN VULKAN ERROR"; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI int glfwVulkanSupported(void) { _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); return _glfwInitVulkan(_GLFW_FIND_LOADER); } GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count) { assert(count != NULL); *count = 0; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER)) return NULL; if (!_glfw.vk.extensions[0]) return NULL; *count = 2; return (const char**) _glfw.vk.extensions; } GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname) { GLFWvkproc proc; assert(procname != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER)) return NULL; proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname); #if defined(_GLFW_VULKAN_STATIC) if (!proc) { if (strcmp(procname, "vkGetInstanceProcAddr") == 0) return (GLFWvkproc) vkGetInstanceProcAddr; } #else if (!proc) proc = (GLFWvkproc) _glfw_dlsym(_glfw.vk.handle, procname); #endif return proc; } GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { assert(instance != VK_NULL_HANDLE); assert(device != VK_NULL_HANDLE); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER)) return GLFW_FALSE; if (!_glfw.vk.extensions[0]) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Window surface creation extensions not found"); return GLFW_FALSE; } return _glfwPlatformGetPhysicalDevicePresentationSupport(instance, device, queuefamily); } GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* handle, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(instance != VK_NULL_HANDLE); assert(window != NULL); assert(surface != NULL); *surface = VK_NULL_HANDLE; _GLFW_REQUIRE_INIT_OR_RETURN(VK_ERROR_INITIALIZATION_FAILED); if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER)) return VK_ERROR_INITIALIZATION_FAILED; if (!_glfw.vk.extensions[0]) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Window surface creation extensions not found"); return VK_ERROR_EXTENSION_NOT_PRESENT; } if (window->context.client != GLFW_NO_API) { _glfwInputError(GLFW_INVALID_VALUE, "Vulkan: Window surface creation requires the window to have the client API set to GLFW_NO_API"); return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; } return _glfwPlatformCreateWindowSurface(instance, window, allocator, surface); } ================================================ FILE: thirdparty/glfw/src/wgl_context.c ================================================ //======================================================================== // GLFW 3.3 WGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include // Return the value corresponding to the specified attribute // static int findPixelFormatAttribValue(const int* attribs, int attribCount, const int* values, int attrib) { int i; for (i = 0; i < attribCount; i++) { if (attribs[i] == attrib) return values[i]; } _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Unknown pixel format attribute requested"); return 0; } #define addAttrib(a) \ { \ assert((size_t) attribCount < sizeof(attribs) / sizeof(attribs[0])); \ attribs[attribCount++] = a; \ } #define findAttribValue(a) \ findPixelFormatAttribValue(attribs, attribCount, values, a) // Return a list of available and usable framebuffer configs // static int choosePixelFormat(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { _GLFWfbconfig* usableConfigs; const _GLFWfbconfig* closest; int i, pixelFormat, nativeCount, usableCount = 0, attribCount = 0; int attribs[40]; int values[sizeof(attribs) / sizeof(attribs[0])]; if (_glfw.wgl.ARB_pixel_format) { const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB; if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc, 1, 0, 1, &attrib, &nativeCount)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to retrieve pixel format attribute"); return 0; } addAttrib(WGL_SUPPORT_OPENGL_ARB); addAttrib(WGL_DRAW_TO_WINDOW_ARB); addAttrib(WGL_PIXEL_TYPE_ARB); addAttrib(WGL_ACCELERATION_ARB); addAttrib(WGL_RED_BITS_ARB); addAttrib(WGL_RED_SHIFT_ARB); addAttrib(WGL_GREEN_BITS_ARB); addAttrib(WGL_GREEN_SHIFT_ARB); addAttrib(WGL_BLUE_BITS_ARB); addAttrib(WGL_BLUE_SHIFT_ARB); addAttrib(WGL_ALPHA_BITS_ARB); addAttrib(WGL_ALPHA_SHIFT_ARB); addAttrib(WGL_DEPTH_BITS_ARB); addAttrib(WGL_STENCIL_BITS_ARB); addAttrib(WGL_ACCUM_BITS_ARB); addAttrib(WGL_ACCUM_RED_BITS_ARB); addAttrib(WGL_ACCUM_GREEN_BITS_ARB); addAttrib(WGL_ACCUM_BLUE_BITS_ARB); addAttrib(WGL_ACCUM_ALPHA_BITS_ARB); addAttrib(WGL_AUX_BUFFERS_ARB); addAttrib(WGL_STEREO_ARB); addAttrib(WGL_DOUBLE_BUFFER_ARB); if (_glfw.wgl.ARB_multisample) addAttrib(WGL_SAMPLES_ARB); if (ctxconfig->client == GLFW_OPENGL_API) { if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB) addAttrib(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); } else { if (_glfw.wgl.EXT_colorspace) addAttrib(WGL_COLORSPACE_EXT); } } else { nativeCount = DescribePixelFormat(window->context.wgl.dc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL); } usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig)); for (i = 0; i < nativeCount; i++) { _GLFWfbconfig* u = usableConfigs + usableCount; pixelFormat = i + 1; if (_glfw.wgl.ARB_pixel_format) { // Get pixel format attributes through "modern" extension if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc, pixelFormat, 0, attribCount, attribs, values)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to retrieve pixel format attributes"); free(usableConfigs); return 0; } if (!findAttribValue(WGL_SUPPORT_OPENGL_ARB) || !findAttribValue(WGL_DRAW_TO_WINDOW_ARB)) { continue; } if (findAttribValue(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB) continue; if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) continue; u->redBits = findAttribValue(WGL_RED_BITS_ARB); u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB); u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB); u->alphaBits = findAttribValue(WGL_ALPHA_BITS_ARB); u->depthBits = findAttribValue(WGL_DEPTH_BITS_ARB); u->stencilBits = findAttribValue(WGL_STENCIL_BITS_ARB); u->accumRedBits = findAttribValue(WGL_ACCUM_RED_BITS_ARB); u->accumGreenBits = findAttribValue(WGL_ACCUM_GREEN_BITS_ARB); u->accumBlueBits = findAttribValue(WGL_ACCUM_BLUE_BITS_ARB); u->accumAlphaBits = findAttribValue(WGL_ACCUM_ALPHA_BITS_ARB); u->auxBuffers = findAttribValue(WGL_AUX_BUFFERS_ARB); if (findAttribValue(WGL_STEREO_ARB)) u->stereo = GLFW_TRUE; if (findAttribValue(WGL_DOUBLE_BUFFER_ARB)) u->doublebuffer = GLFW_TRUE; if (_glfw.wgl.ARB_multisample) u->samples = findAttribValue(WGL_SAMPLES_ARB); if (ctxconfig->client == GLFW_OPENGL_API) { if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB) { if (findAttribValue(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB)) u->sRGB = GLFW_TRUE; } } else { if (_glfw.wgl.EXT_colorspace) { if (findAttribValue(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT) u->sRGB = GLFW_TRUE; } } } else { // Get pixel format attributes through legacy PFDs PIXELFORMATDESCRIPTOR pfd; if (!DescribePixelFormat(window->context.wgl.dc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to describe pixel format"); free(usableConfigs); return 0; } if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) || !(pfd.dwFlags & PFD_SUPPORT_OPENGL)) { continue; } if (!(pfd.dwFlags & PFD_GENERIC_ACCELERATED) && (pfd.dwFlags & PFD_GENERIC_FORMAT)) { continue; } if (pfd.iPixelType != PFD_TYPE_RGBA) continue; u->redBits = pfd.cRedBits; u->greenBits = pfd.cGreenBits; u->blueBits = pfd.cBlueBits; u->alphaBits = pfd.cAlphaBits; u->depthBits = pfd.cDepthBits; u->stencilBits = pfd.cStencilBits; u->accumRedBits = pfd.cAccumRedBits; u->accumGreenBits = pfd.cAccumGreenBits; u->accumBlueBits = pfd.cAccumBlueBits; u->accumAlphaBits = pfd.cAccumAlphaBits; u->auxBuffers = pfd.cAuxBuffers; if (pfd.dwFlags & PFD_STEREO) u->stereo = GLFW_TRUE; if (pfd.dwFlags & PFD_DOUBLEBUFFER) u->doublebuffer = GLFW_TRUE; } u->handle = pixelFormat; usableCount++; } if (!usableCount) { _glfwInputError(GLFW_API_UNAVAILABLE, "WGL: The driver does not appear to support OpenGL"); free(usableConfigs); return 0; } closest = _glfwChooseFBConfig(fbconfig, usableConfigs, usableCount); if (!closest) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "WGL: Failed to find a suitable pixel format"); free(usableConfigs); return 0; } pixelFormat = (int) closest->handle; free(usableConfigs); return pixelFormat; } #undef addAttrib #undef findAttribValue static void makeContextCurrentWGL(_GLFWwindow* window) { if (window) { if (wglMakeCurrent(window->context.wgl.dc, window->context.wgl.handle)) _glfwPlatformSetTls(&_glfw.contextSlot, window); else { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to make context current"); _glfwPlatformSetTls(&_glfw.contextSlot, NULL); } } else { if (!wglMakeCurrent(NULL, NULL)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to clear current context"); } _glfwPlatformSetTls(&_glfw.contextSlot, NULL); } } static void swapBuffersWGL(_GLFWwindow* window) { if (!window->monitor) { if (IsWindowsVistaOrGreater()) { // DWM Composition is always enabled on Win8+ BOOL enabled = IsWindows8OrGreater(); // HACK: Use DwmFlush when desktop composition is enabled if (enabled || (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)) { int count = abs(window->context.wgl.interval); while (count--) DwmFlush(); } } } SwapBuffers(window->context.wgl.dc); } static void swapIntervalWGL(int interval) { _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); window->context.wgl.interval = interval; if (!window->monitor) { if (IsWindowsVistaOrGreater()) { // DWM Composition is always enabled on Win8+ BOOL enabled = IsWindows8OrGreater(); // HACK: Disable WGL swap interval when desktop composition is enabled to // avoid interfering with DWM vsync if (enabled || (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)) interval = 0; } } if (_glfw.wgl.EXT_swap_control) wglSwapIntervalEXT(interval); } static int extensionSupportedWGL(const char* extension) { const char* extensions = NULL; if (_glfw.wgl.GetExtensionsStringARB) extensions = wglGetExtensionsStringARB(wglGetCurrentDC()); else if (_glfw.wgl.GetExtensionsStringEXT) extensions = wglGetExtensionsStringEXT(); if (!extensions) return GLFW_FALSE; return _glfwStringInExtensionString(extension, extensions); } static GLFWglproc getProcAddressWGL(const char* procname) { const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname); if (proc) return proc; return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname); } static void destroyContextWGL(_GLFWwindow* window) { if (window->context.wgl.handle) { wglDeleteContext(window->context.wgl.handle); window->context.wgl.handle = NULL; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize WGL // GLFWbool _glfwInitWGL(void) { PIXELFORMATDESCRIPTOR pfd; HGLRC prc, rc; HDC pdc, dc; if (_glfw.wgl.instance) return GLFW_TRUE; _glfw.wgl.instance = LoadLibraryA("opengl32.dll"); if (!_glfw.wgl.instance) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to load opengl32.dll"); return GLFW_FALSE; } _glfw.wgl.CreateContext = (PFN_wglCreateContext) GetProcAddress(_glfw.wgl.instance, "wglCreateContext"); _glfw.wgl.DeleteContext = (PFN_wglDeleteContext) GetProcAddress(_glfw.wgl.instance, "wglDeleteContext"); _glfw.wgl.GetProcAddress = (PFN_wglGetProcAddress) GetProcAddress(_glfw.wgl.instance, "wglGetProcAddress"); _glfw.wgl.GetCurrentDC = (PFN_wglGetCurrentDC) GetProcAddress(_glfw.wgl.instance, "wglGetCurrentDC"); _glfw.wgl.GetCurrentContext = (PFN_wglGetCurrentContext) GetProcAddress(_glfw.wgl.instance, "wglGetCurrentContext"); _glfw.wgl.MakeCurrent = (PFN_wglMakeCurrent) GetProcAddress(_glfw.wgl.instance, "wglMakeCurrent"); _glfw.wgl.ShareLists = (PFN_wglShareLists) GetProcAddress(_glfw.wgl.instance, "wglShareLists"); // NOTE: A dummy context has to be created for opengl32.dll to load the // OpenGL ICD, from which we can then query WGL extensions // NOTE: This code will accept the Microsoft GDI ICD; accelerated context // creation failure occurs during manual pixel format enumeration dc = GetDC(_glfw.win32.helperWindowHandle); ZeroMemory(&pfd, sizeof(pfd)); pfd.nSize = sizeof(pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 24; if (!SetPixelFormat(dc, ChoosePixelFormat(dc, &pfd), &pfd)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to set pixel format for dummy context"); return GLFW_FALSE; } rc = wglCreateContext(dc); if (!rc) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to create dummy context"); return GLFW_FALSE; } pdc = wglGetCurrentDC(); prc = wglGetCurrentContext(); if (!wglMakeCurrent(dc, rc)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to make dummy context current"); wglMakeCurrent(pdc, prc); wglDeleteContext(rc); return GLFW_FALSE; } // NOTE: Functions must be loaded first as they're needed to retrieve the // extension string that tells us whether the functions are supported _glfw.wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) wglGetProcAddress("wglGetExtensionsStringEXT"); _glfw.wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB"); _glfw.wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB"); _glfw.wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"); _glfw.wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC) wglGetProcAddress("wglGetPixelFormatAttribivARB"); // NOTE: WGL_ARB_extensions_string and WGL_EXT_extensions_string are not // checked below as we are already using them _glfw.wgl.ARB_multisample = extensionSupportedWGL("WGL_ARB_multisample"); _glfw.wgl.ARB_framebuffer_sRGB = extensionSupportedWGL("WGL_ARB_framebuffer_sRGB"); _glfw.wgl.EXT_framebuffer_sRGB = extensionSupportedWGL("WGL_EXT_framebuffer_sRGB"); _glfw.wgl.ARB_create_context = extensionSupportedWGL("WGL_ARB_create_context"); _glfw.wgl.ARB_create_context_profile = extensionSupportedWGL("WGL_ARB_create_context_profile"); _glfw.wgl.EXT_create_context_es2_profile = extensionSupportedWGL("WGL_EXT_create_context_es2_profile"); _glfw.wgl.ARB_create_context_robustness = extensionSupportedWGL("WGL_ARB_create_context_robustness"); _glfw.wgl.ARB_create_context_no_error = extensionSupportedWGL("WGL_ARB_create_context_no_error"); _glfw.wgl.EXT_swap_control = extensionSupportedWGL("WGL_EXT_swap_control"); _glfw.wgl.EXT_colorspace = extensionSupportedWGL("WGL_EXT_colorspace"); _glfw.wgl.ARB_pixel_format = extensionSupportedWGL("WGL_ARB_pixel_format"); _glfw.wgl.ARB_context_flush_control = extensionSupportedWGL("WGL_ARB_context_flush_control"); wglMakeCurrent(pdc, prc); wglDeleteContext(rc); return GLFW_TRUE; } // Terminate WGL // void _glfwTerminateWGL(void) { if (_glfw.wgl.instance) FreeLibrary(_glfw.wgl.instance); } #define setAttrib(a, v) \ { \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } // Create the OpenGL or OpenGL ES context // GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int attribs[40]; int pixelFormat; PIXELFORMATDESCRIPTOR pfd; HGLRC share = NULL; if (ctxconfig->share) share = ctxconfig->share->context.wgl.handle; window->context.wgl.dc = GetDC(window->win32.handle); if (!window->context.wgl.dc) { _glfwInputError(GLFW_PLATFORM_ERROR, "WGL: Failed to retrieve DC for window"); return GLFW_FALSE; } pixelFormat = choosePixelFormat(window, ctxconfig, fbconfig); if (!pixelFormat) return GLFW_FALSE; if (!DescribePixelFormat(window->context.wgl.dc, pixelFormat, sizeof(pfd), &pfd)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to retrieve PFD for selected pixel format"); return GLFW_FALSE; } if (!SetPixelFormat(window->context.wgl.dc, pixelFormat, &pfd)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to set selected pixel format"); return GLFW_FALSE; } if (ctxconfig->client == GLFW_OPENGL_API) { if (ctxconfig->forward) { if (!_glfw.wgl.ARB_create_context) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: A forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable"); return GLFW_FALSE; } } if (ctxconfig->profile) { if (!_glfw.wgl.ARB_create_context_profile) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable"); return GLFW_FALSE; } } } else { if (!_glfw.wgl.ARB_create_context || !_glfw.wgl.ARB_create_context_profile || !_glfw.wgl.EXT_create_context_es2_profile) { _glfwInputError(GLFW_API_UNAVAILABLE, "WGL: OpenGL ES requested but WGL_ARB_create_context_es2_profile is unavailable"); return GLFW_FALSE; } } if (_glfw.wgl.ARB_create_context) { int index = 0, mask = 0, flags = 0; if (ctxconfig->client == GLFW_OPENGL_API) { if (ctxconfig->forward) flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB; else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) mask |= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } else mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT; if (ctxconfig->debug) flags |= WGL_CONTEXT_DEBUG_BIT_ARB; if (ctxconfig->robustness) { if (_glfw.wgl.ARB_create_context_robustness) { if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) { setAttrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, WGL_NO_RESET_NOTIFICATION_ARB); } else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) { setAttrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, WGL_LOSE_CONTEXT_ON_RESET_ARB); } flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB; } } if (ctxconfig->release) { if (_glfw.wgl.ARB_context_flush_control) { if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE) { setAttrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB, WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); } else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH) { setAttrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB, WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB); } } } if (ctxconfig->noerror) { if (_glfw.wgl.ARB_create_context_no_error) setAttrib(WGL_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE); } // NOTE: Only request an explicitly versioned context when necessary, as // explicitly requesting version 1.0 does not always return the // highest version supported by the driver if (ctxconfig->major != 1 || ctxconfig->minor != 0) { setAttrib(WGL_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major); setAttrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor); } if (flags) setAttrib(WGL_CONTEXT_FLAGS_ARB, flags); if (mask) setAttrib(WGL_CONTEXT_PROFILE_MASK_ARB, mask); setAttrib(0, 0); window->context.wgl.handle = wglCreateContextAttribsARB(window->context.wgl.dc, share, attribs); if (!window->context.wgl.handle) { const DWORD error = GetLastError(); if (error == (0xc0070000 | ERROR_INVALID_VERSION_ARB)) { if (ctxconfig->client == GLFW_OPENGL_API) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: Driver does not support OpenGL version %i.%i", ctxconfig->major, ctxconfig->minor); } else { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: Driver does not support OpenGL ES version %i.%i", ctxconfig->major, ctxconfig->minor); } } else if (error == (0xc0070000 | ERROR_INVALID_PROFILE_ARB)) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: Driver does not support the requested OpenGL profile"); } else if (error == (0xc0070000 | ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB)) { _glfwInputError(GLFW_INVALID_VALUE, "WGL: The share context is not compatible with the requested context"); } else { if (ctxconfig->client == GLFW_OPENGL_API) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: Failed to create OpenGL context"); } else { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "WGL: Failed to create OpenGL ES context"); } } return GLFW_FALSE; } } else { window->context.wgl.handle = wglCreateContext(window->context.wgl.dc); if (!window->context.wgl.handle) { _glfwInputErrorWin32(GLFW_VERSION_UNAVAILABLE, "WGL: Failed to create OpenGL context"); return GLFW_FALSE; } if (share) { if (!wglShareLists(share, window->context.wgl.handle)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WGL: Failed to enable sharing with specified OpenGL context"); return GLFW_FALSE; } } } window->context.makeCurrent = makeContextCurrentWGL; window->context.swapBuffers = swapBuffersWGL; window->context.swapInterval = swapIntervalWGL; window->context.extensionSupported = extensionSupportedWGL; window->context.getProcAddress = getProcAddressWGL; window->context.destroy = destroyContextWGL; return GLFW_TRUE; } #undef setAttrib ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return NULL; } return window->context.wgl.handle; } ================================================ FILE: thirdparty/glfw/src/wgl_context.h ================================================ //======================================================================== // GLFW 3.3 WGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2018 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 #define WGL_SUPPORT_OPENGL_ARB 0x2010 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 #define WGL_PIXEL_TYPE_ARB 0x2013 #define WGL_TYPE_RGBA_ARB 0x202b #define WGL_ACCELERATION_ARB 0x2003 #define WGL_NO_ACCELERATION_ARB 0x2025 #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_STEREO_ARB 0x2012 #define WGL_DOUBLE_BUFFER_ARB 0x2011 #define WGL_SAMPLES_ARB 0x2042 #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_FLAGS_ARB 0x2094 #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 #define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3 #define WGL_COLORSPACE_EXT 0x309d #define WGL_COLORSPACE_SRGB_EXT 0x3089 #define ERROR_INVALID_VERSION_ARB 0x2095 #define ERROR_INVALID_PROFILE_ARB 0x2096 #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 // WGL extension pointer typedefs typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*); typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC); typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*); #define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT #define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB #define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT #define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB #define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB // opengl32.dll function pointer typedefs typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC); typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC); typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR); typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void); typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void); typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC); typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC); #define wglCreateContext _glfw.wgl.CreateContext #define wglDeleteContext _glfw.wgl.DeleteContext #define wglGetProcAddress _glfw.wgl.GetProcAddress #define wglGetCurrentDC _glfw.wgl.GetCurrentDC #define wglGetCurrentContext _glfw.wgl.GetCurrentContext #define wglMakeCurrent _glfw.wgl.MakeCurrent #define wglShareLists _glfw.wgl.ShareLists #define _GLFW_RECREATION_NOT_NEEDED 0 #define _GLFW_RECREATION_REQUIRED 1 #define _GLFW_RECREATION_IMPOSSIBLE 2 #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl // WGL-specific per-context data // typedef struct _GLFWcontextWGL { HDC dc; HGLRC handle; int interval; } _GLFWcontextWGL; // WGL-specific global data // typedef struct _GLFWlibraryWGL { HINSTANCE instance; PFN_wglCreateContext CreateContext; PFN_wglDeleteContext DeleteContext; PFN_wglGetProcAddress GetProcAddress; PFN_wglGetCurrentDC GetCurrentDC; PFN_wglGetCurrentContext GetCurrentContext; PFN_wglMakeCurrent MakeCurrent; PFN_wglShareLists ShareLists; PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT; PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB; PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB; PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; GLFWbool EXT_swap_control; GLFWbool EXT_colorspace; GLFWbool ARB_multisample; GLFWbool ARB_framebuffer_sRGB; GLFWbool EXT_framebuffer_sRGB; GLFWbool ARB_pixel_format; GLFWbool ARB_create_context; GLFWbool ARB_create_context_profile; GLFWbool EXT_create_context_es2_profile; GLFWbool ARB_create_context_robustness; GLFWbool ARB_create_context_no_error; GLFWbool ARB_context_flush_control; } _GLFWlibraryWGL; GLFWbool _glfwInitWGL(void); void _glfwTerminateWGL(void); GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); ================================================ FILE: thirdparty/glfw/src/win32_init.c ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include static const GUID _glfw_GUID_DEVINTERFACE_HID = {0x4d1e55b2,0xf16f,0x11cf,{0x88,0xcb,0x00,0x11,0x11,0x00,0x00,0x30}}; #define GUID_DEVINTERFACE_HID _glfw_GUID_DEVINTERFACE_HID #if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG) // Executables (but not DLLs) exporting this symbol with this value will be // automatically directed to the high-performance GPU on Nvidia Optimus systems // with up-to-date drivers // __declspec(dllexport) DWORD NvOptimusEnablement = 1; // Executables (but not DLLs) exporting this symbol with this value will be // automatically directed to the high-performance GPU on AMD PowerXpress systems // with up-to-date drivers // __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; #endif // _GLFW_USE_HYBRID_HPG #if defined(_GLFW_BUILD_DLL) // GLFW DLL entry point // BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) { return TRUE; } #endif // _GLFW_BUILD_DLL // Load necessary libraries (DLLs) // static GLFWbool loadLibraries(void) { _glfw.win32.winmm.instance = LoadLibraryA("winmm.dll"); if (!_glfw.win32.winmm.instance) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to load winmm.dll"); return GLFW_FALSE; } _glfw.win32.winmm.GetTime = (PFN_timeGetTime) GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime"); _glfw.win32.user32.instance = LoadLibraryA("user32.dll"); if (!_glfw.win32.user32.instance) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to load user32.dll"); return GLFW_FALSE; } _glfw.win32.user32.SetProcessDPIAware_ = (PFN_SetProcessDPIAware) GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware"); _glfw.win32.user32.ChangeWindowMessageFilterEx_ = (PFN_ChangeWindowMessageFilterEx) GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx"); _glfw.win32.user32.EnableNonClientDpiScaling_ = (PFN_EnableNonClientDpiScaling) GetProcAddress(_glfw.win32.user32.instance, "EnableNonClientDpiScaling"); _glfw.win32.user32.SetProcessDpiAwarenessContext_ = (PFN_SetProcessDpiAwarenessContext) GetProcAddress(_glfw.win32.user32.instance, "SetProcessDpiAwarenessContext"); _glfw.win32.user32.GetDpiForWindow_ = (PFN_GetDpiForWindow) GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow"); _glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi) GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi"); _glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll"); if (_glfw.win32.dinput8.instance) { _glfw.win32.dinput8.Create = (PFN_DirectInput8Create) GetProcAddress(_glfw.win32.dinput8.instance, "DirectInput8Create"); } { int i; const char* names[] = { "xinput1_4.dll", "xinput1_3.dll", "xinput9_1_0.dll", "xinput1_2.dll", "xinput1_1.dll", NULL }; for (i = 0; names[i]; i++) { _glfw.win32.xinput.instance = LoadLibraryA(names[i]); if (_glfw.win32.xinput.instance) { _glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities) GetProcAddress(_glfw.win32.xinput.instance, "XInputGetCapabilities"); _glfw.win32.xinput.GetState = (PFN_XInputGetState) GetProcAddress(_glfw.win32.xinput.instance, "XInputGetState"); break; } } } _glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll"); if (_glfw.win32.dwmapi.instance) { _glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled"); _glfw.win32.dwmapi.Flush = (PFN_DwmFlush) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush"); _glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow"); } _glfw.win32.shcore.instance = LoadLibraryA("shcore.dll"); if (_glfw.win32.shcore.instance) { _glfw.win32.shcore.SetProcessDpiAwareness_ = (PFN_SetProcessDpiAwareness) GetProcAddress(_glfw.win32.shcore.instance, "SetProcessDpiAwareness"); _glfw.win32.shcore.GetDpiForMonitor_ = (PFN_GetDpiForMonitor) GetProcAddress(_glfw.win32.shcore.instance, "GetDpiForMonitor"); } _glfw.win32.ntdll.instance = LoadLibraryA("ntdll.dll"); if (_glfw.win32.ntdll.instance) { _glfw.win32.ntdll.RtlVerifyVersionInfo_ = (PFN_RtlVerifyVersionInfo) GetProcAddress(_glfw.win32.ntdll.instance, "RtlVerifyVersionInfo"); } return GLFW_TRUE; } // Unload used libraries (DLLs) // static void freeLibraries(void) { if (_glfw.win32.xinput.instance) FreeLibrary(_glfw.win32.xinput.instance); if (_glfw.win32.dinput8.instance) FreeLibrary(_glfw.win32.dinput8.instance); if (_glfw.win32.winmm.instance) FreeLibrary(_glfw.win32.winmm.instance); if (_glfw.win32.user32.instance) FreeLibrary(_glfw.win32.user32.instance); if (_glfw.win32.dwmapi.instance) FreeLibrary(_glfw.win32.dwmapi.instance); if (_glfw.win32.shcore.instance) FreeLibrary(_glfw.win32.shcore.instance); if (_glfw.win32.ntdll.instance) FreeLibrary(_glfw.win32.ntdll.instance); } // Create key code translation tables // static void createKeyTables(void) { int scancode; memset(_glfw.win32.keycodes, -1, sizeof(_glfw.win32.keycodes)); memset(_glfw.win32.scancodes, -1, sizeof(_glfw.win32.scancodes)); _glfw.win32.keycodes[0x00B] = GLFW_KEY_0; _glfw.win32.keycodes[0x002] = GLFW_KEY_1; _glfw.win32.keycodes[0x003] = GLFW_KEY_2; _glfw.win32.keycodes[0x004] = GLFW_KEY_3; _glfw.win32.keycodes[0x005] = GLFW_KEY_4; _glfw.win32.keycodes[0x006] = GLFW_KEY_5; _glfw.win32.keycodes[0x007] = GLFW_KEY_6; _glfw.win32.keycodes[0x008] = GLFW_KEY_7; _glfw.win32.keycodes[0x009] = GLFW_KEY_8; _glfw.win32.keycodes[0x00A] = GLFW_KEY_9; _glfw.win32.keycodes[0x01E] = GLFW_KEY_A; _glfw.win32.keycodes[0x030] = GLFW_KEY_B; _glfw.win32.keycodes[0x02E] = GLFW_KEY_C; _glfw.win32.keycodes[0x020] = GLFW_KEY_D; _glfw.win32.keycodes[0x012] = GLFW_KEY_E; _glfw.win32.keycodes[0x021] = GLFW_KEY_F; _glfw.win32.keycodes[0x022] = GLFW_KEY_G; _glfw.win32.keycodes[0x023] = GLFW_KEY_H; _glfw.win32.keycodes[0x017] = GLFW_KEY_I; _glfw.win32.keycodes[0x024] = GLFW_KEY_J; _glfw.win32.keycodes[0x025] = GLFW_KEY_K; _glfw.win32.keycodes[0x026] = GLFW_KEY_L; _glfw.win32.keycodes[0x032] = GLFW_KEY_M; _glfw.win32.keycodes[0x031] = GLFW_KEY_N; _glfw.win32.keycodes[0x018] = GLFW_KEY_O; _glfw.win32.keycodes[0x019] = GLFW_KEY_P; _glfw.win32.keycodes[0x010] = GLFW_KEY_Q; _glfw.win32.keycodes[0x013] = GLFW_KEY_R; _glfw.win32.keycodes[0x01F] = GLFW_KEY_S; _glfw.win32.keycodes[0x014] = GLFW_KEY_T; _glfw.win32.keycodes[0x016] = GLFW_KEY_U; _glfw.win32.keycodes[0x02F] = GLFW_KEY_V; _glfw.win32.keycodes[0x011] = GLFW_KEY_W; _glfw.win32.keycodes[0x02D] = GLFW_KEY_X; _glfw.win32.keycodes[0x015] = GLFW_KEY_Y; _glfw.win32.keycodes[0x02C] = GLFW_KEY_Z; _glfw.win32.keycodes[0x028] = GLFW_KEY_APOSTROPHE; _glfw.win32.keycodes[0x02B] = GLFW_KEY_BACKSLASH; _glfw.win32.keycodes[0x033] = GLFW_KEY_COMMA; _glfw.win32.keycodes[0x00D] = GLFW_KEY_EQUAL; _glfw.win32.keycodes[0x029] = GLFW_KEY_GRAVE_ACCENT; _glfw.win32.keycodes[0x01A] = GLFW_KEY_LEFT_BRACKET; _glfw.win32.keycodes[0x00C] = GLFW_KEY_MINUS; _glfw.win32.keycodes[0x034] = GLFW_KEY_PERIOD; _glfw.win32.keycodes[0x01B] = GLFW_KEY_RIGHT_BRACKET; _glfw.win32.keycodes[0x027] = GLFW_KEY_SEMICOLON; _glfw.win32.keycodes[0x035] = GLFW_KEY_SLASH; _glfw.win32.keycodes[0x056] = GLFW_KEY_WORLD_2; _glfw.win32.keycodes[0x00E] = GLFW_KEY_BACKSPACE; _glfw.win32.keycodes[0x153] = GLFW_KEY_DELETE; _glfw.win32.keycodes[0x14F] = GLFW_KEY_END; _glfw.win32.keycodes[0x01C] = GLFW_KEY_ENTER; _glfw.win32.keycodes[0x001] = GLFW_KEY_ESCAPE; _glfw.win32.keycodes[0x147] = GLFW_KEY_HOME; _glfw.win32.keycodes[0x152] = GLFW_KEY_INSERT; _glfw.win32.keycodes[0x15D] = GLFW_KEY_MENU; _glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN; _glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP; _glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE; _glfw.win32.keycodes[0x146] = GLFW_KEY_PAUSE; _glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE; _glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB; _glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK; _glfw.win32.keycodes[0x145] = GLFW_KEY_NUM_LOCK; _glfw.win32.keycodes[0x046] = GLFW_KEY_SCROLL_LOCK; _glfw.win32.keycodes[0x03B] = GLFW_KEY_F1; _glfw.win32.keycodes[0x03C] = GLFW_KEY_F2; _glfw.win32.keycodes[0x03D] = GLFW_KEY_F3; _glfw.win32.keycodes[0x03E] = GLFW_KEY_F4; _glfw.win32.keycodes[0x03F] = GLFW_KEY_F5; _glfw.win32.keycodes[0x040] = GLFW_KEY_F6; _glfw.win32.keycodes[0x041] = GLFW_KEY_F7; _glfw.win32.keycodes[0x042] = GLFW_KEY_F8; _glfw.win32.keycodes[0x043] = GLFW_KEY_F9; _glfw.win32.keycodes[0x044] = GLFW_KEY_F10; _glfw.win32.keycodes[0x057] = GLFW_KEY_F11; _glfw.win32.keycodes[0x058] = GLFW_KEY_F12; _glfw.win32.keycodes[0x064] = GLFW_KEY_F13; _glfw.win32.keycodes[0x065] = GLFW_KEY_F14; _glfw.win32.keycodes[0x066] = GLFW_KEY_F15; _glfw.win32.keycodes[0x067] = GLFW_KEY_F16; _glfw.win32.keycodes[0x068] = GLFW_KEY_F17; _glfw.win32.keycodes[0x069] = GLFW_KEY_F18; _glfw.win32.keycodes[0x06A] = GLFW_KEY_F19; _glfw.win32.keycodes[0x06B] = GLFW_KEY_F20; _glfw.win32.keycodes[0x06C] = GLFW_KEY_F21; _glfw.win32.keycodes[0x06D] = GLFW_KEY_F22; _glfw.win32.keycodes[0x06E] = GLFW_KEY_F23; _glfw.win32.keycodes[0x076] = GLFW_KEY_F24; _glfw.win32.keycodes[0x038] = GLFW_KEY_LEFT_ALT; _glfw.win32.keycodes[0x01D] = GLFW_KEY_LEFT_CONTROL; _glfw.win32.keycodes[0x02A] = GLFW_KEY_LEFT_SHIFT; _glfw.win32.keycodes[0x15B] = GLFW_KEY_LEFT_SUPER; _glfw.win32.keycodes[0x137] = GLFW_KEY_PRINT_SCREEN; _glfw.win32.keycodes[0x138] = GLFW_KEY_RIGHT_ALT; _glfw.win32.keycodes[0x11D] = GLFW_KEY_RIGHT_CONTROL; _glfw.win32.keycodes[0x036] = GLFW_KEY_RIGHT_SHIFT; _glfw.win32.keycodes[0x15C] = GLFW_KEY_RIGHT_SUPER; _glfw.win32.keycodes[0x150] = GLFW_KEY_DOWN; _glfw.win32.keycodes[0x14B] = GLFW_KEY_LEFT; _glfw.win32.keycodes[0x14D] = GLFW_KEY_RIGHT; _glfw.win32.keycodes[0x148] = GLFW_KEY_UP; _glfw.win32.keycodes[0x052] = GLFW_KEY_KP_0; _glfw.win32.keycodes[0x04F] = GLFW_KEY_KP_1; _glfw.win32.keycodes[0x050] = GLFW_KEY_KP_2; _glfw.win32.keycodes[0x051] = GLFW_KEY_KP_3; _glfw.win32.keycodes[0x04B] = GLFW_KEY_KP_4; _glfw.win32.keycodes[0x04C] = GLFW_KEY_KP_5; _glfw.win32.keycodes[0x04D] = GLFW_KEY_KP_6; _glfw.win32.keycodes[0x047] = GLFW_KEY_KP_7; _glfw.win32.keycodes[0x048] = GLFW_KEY_KP_8; _glfw.win32.keycodes[0x049] = GLFW_KEY_KP_9; _glfw.win32.keycodes[0x04E] = GLFW_KEY_KP_ADD; _glfw.win32.keycodes[0x053] = GLFW_KEY_KP_DECIMAL; _glfw.win32.keycodes[0x135] = GLFW_KEY_KP_DIVIDE; _glfw.win32.keycodes[0x11C] = GLFW_KEY_KP_ENTER; _glfw.win32.keycodes[0x059] = GLFW_KEY_KP_EQUAL; _glfw.win32.keycodes[0x037] = GLFW_KEY_KP_MULTIPLY; _glfw.win32.keycodes[0x04A] = GLFW_KEY_KP_SUBTRACT; for (scancode = 0; scancode < 512; scancode++) { if (_glfw.win32.keycodes[scancode] > 0) _glfw.win32.scancodes[_glfw.win32.keycodes[scancode]] = scancode; } } // Creates a dummy window for behind-the-scenes work // static GLFWbool createHelperWindow(void) { MSG msg; _glfw.win32.helperWindowHandle = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, _GLFW_WNDCLASSNAME, L"GLFW message window", WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 1, 1, NULL, NULL, GetModuleHandleW(NULL), NULL); if (!_glfw.win32.helperWindowHandle) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create helper window"); return GLFW_FALSE; } // HACK: The command to the first ShowWindow call is ignored if the parent // process passed along a STARTUPINFO, so clear that with a no-op call ShowWindow(_glfw.win32.helperWindowHandle, SW_HIDE); // Register for HID device notifications { DEV_BROADCAST_DEVICEINTERFACE_W dbi; ZeroMemory(&dbi, sizeof(dbi)); dbi.dbcc_size = sizeof(dbi); dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; dbi.dbcc_classguid = GUID_DEVINTERFACE_HID; _glfw.win32.deviceNotificationHandle = RegisterDeviceNotificationW(_glfw.win32.helperWindowHandle, (DEV_BROADCAST_HDR*) &dbi, DEVICE_NOTIFY_WINDOW_HANDLE); } while (PeekMessageW(&msg, _glfw.win32.helperWindowHandle, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessageW(&msg); } return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Returns a wide string version of the specified UTF-8 string // WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source) { WCHAR* target; int count; count = MultiByteToWideChar(CP_UTF8, 0, source, -1, NULL, 0); if (!count) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to convert string from UTF-8"); return NULL; } target = calloc(count, sizeof(WCHAR)); if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to convert string from UTF-8"); free(target); return NULL; } return target; } // Returns a UTF-8 string version of the specified wide string // char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source) { char* target; int size; size = WideCharToMultiByte(CP_UTF8, 0, source, -1, NULL, 0, NULL, NULL); if (!size) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to convert string to UTF-8"); return NULL; } target = calloc(size, 1); if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to convert string to UTF-8"); free(target); return NULL; } return target; } // Reports the specified error, appending information about the last Win32 error // void _glfwInputErrorWin32(int error, const char* description) { WCHAR buffer[_GLFW_MESSAGE_SIZE] = L""; char message[_GLFW_MESSAGE_SIZE] = ""; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, GetLastError() & 0xffff, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, sizeof(buffer) / sizeof(WCHAR), NULL); WideCharToMultiByte(CP_UTF8, 0, buffer, -1, message, sizeof(message), NULL, NULL); _glfwInputError(error, "%s: %s", description, message); } // Updates key names according to the current keyboard layout // void _glfwUpdateKeyNamesWin32(void) { int key; BYTE state[256] = {0}; memset(_glfw.win32.keynames, 0, sizeof(_glfw.win32.keynames)); for (key = GLFW_KEY_SPACE; key <= GLFW_KEY_LAST; key++) { UINT vk; int scancode, length; WCHAR chars[16]; scancode = _glfw.win32.scancodes[key]; if (scancode == -1) continue; if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_ADD) { const UINT vks[] = { VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_DECIMAL, VK_DIVIDE, VK_MULTIPLY, VK_SUBTRACT, VK_ADD }; vk = vks[key - GLFW_KEY_KP_0]; } else vk = MapVirtualKey(scancode, MAPVK_VSC_TO_VK); length = ToUnicode(vk, scancode, state, chars, sizeof(chars) / sizeof(WCHAR), 0); if (length == -1) { length = ToUnicode(vk, scancode, state, chars, sizeof(chars) / sizeof(WCHAR), 0); } if (length < 1) continue; WideCharToMultiByte(CP_UTF8, 0, chars, 1, _glfw.win32.keynames[key], sizeof(_glfw.win32.keynames[key]), NULL, NULL); } } // Replacement for IsWindowsVersionOrGreater as MinGW lacks versionhelpers.h // BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp) { OSVERSIONINFOEXW osvi = { sizeof(osvi), major, minor, 0, 0, {0}, sp }; DWORD mask = VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR; ULONGLONG cond = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL); cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL); cond = VerSetConditionMask(cond, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); // HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the // latter lies unless the user knew to embed a non-default manifest // announcing support for Windows 10 via supportedOS GUID return RtlVerifyVersionInfo(&osvi, mask, cond) == 0; } // Checks whether we are on at least the specified build of Windows 10 // BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build) { OSVERSIONINFOEXW osvi = { sizeof(osvi), 10, 0, build }; DWORD mask = VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER; ULONGLONG cond = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL); cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL); cond = VerSetConditionMask(cond, VER_BUILDNUMBER, VER_GREATER_EQUAL); // HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the // latter lies unless the user knew to embed a non-default manifest // announcing support for Windows 10 via supportedOS GUID return RtlVerifyVersionInfo(&osvi, mask, cond) == 0; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformInit(void) { // To make SetForegroundWindow work as we want, we need to fiddle // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early // as possible in the hope of still being the foreground process) SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &_glfw.win32.foregroundLockTimeout, 0); SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0), SPIF_SENDCHANGE); if (!loadLibraries()) return GLFW_FALSE; createKeyTables(); _glfwUpdateKeyNamesWin32(); if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); else if (IsWindows8Point1OrGreater()) SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); else if (IsWindowsVistaOrGreater()) SetProcessDPIAware(); if (!_glfwRegisterWindowClassWin32()) return GLFW_FALSE; if (!createHelperWindow()) return GLFW_FALSE; _glfwInitTimerWin32(); _glfwInitJoysticksWin32(); _glfwPollMonitorsWin32(); return GLFW_TRUE; } void _glfwPlatformTerminate(void) { if (_glfw.win32.deviceNotificationHandle) UnregisterDeviceNotification(_glfw.win32.deviceNotificationHandle); if (_glfw.win32.helperWindowHandle) DestroyWindow(_glfw.win32.helperWindowHandle); _glfwUnregisterWindowClassWin32(); // Restore previous foreground lock timeout system setting SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(_glfw.win32.foregroundLockTimeout), SPIF_SENDCHANGE); free(_glfw.win32.clipboardString); free(_glfw.win32.rawInput); _glfwTerminateWGL(); _glfwTerminateEGL(); _glfwTerminateJoysticksWin32(); freeLibraries(); } const char* _glfwPlatformGetVersionString(void) { return _GLFW_VERSION_NUMBER " Win32 WGL EGL OSMesa" #if defined(__MINGW32__) " MinGW" #elif defined(_MSC_VER) " VisualC" #endif #if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG) " hybrid-GPU" #endif #if defined(_GLFW_BUILD_DLL) " DLL" #endif ; } ================================================ FILE: thirdparty/glfw/src/win32_joystick.c ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #define _GLFW_TYPE_AXIS 0 #define _GLFW_TYPE_SLIDER 1 #define _GLFW_TYPE_BUTTON 2 #define _GLFW_TYPE_POV 3 // Data produced with DirectInput device object enumeration // typedef struct _GLFWobjenumWin32 { IDirectInputDevice8W* device; _GLFWjoyobjectWin32* objects; int objectCount; int axisCount; int sliderCount; int buttonCount; int povCount; } _GLFWobjenumWin32; // Define local copies of the necessary GUIDs // static const GUID _glfw_IID_IDirectInput8W = {0xbf798031,0x483a,0x4da2,{0xaa,0x99,0x5d,0x64,0xed,0x36,0x97,0x00}}; static const GUID _glfw_GUID_XAxis = {0xa36d02e0,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_YAxis = {0xa36d02e1,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_ZAxis = {0xa36d02e2,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_RxAxis = {0xa36d02f4,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_RyAxis = {0xa36d02f5,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_RzAxis = {0xa36d02e3,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_Slider = {0xa36d02e4,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; static const GUID _glfw_GUID_POV = {0xa36d02f2,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}}; #define IID_IDirectInput8W _glfw_IID_IDirectInput8W #define GUID_XAxis _glfw_GUID_XAxis #define GUID_YAxis _glfw_GUID_YAxis #define GUID_ZAxis _glfw_GUID_ZAxis #define GUID_RxAxis _glfw_GUID_RxAxis #define GUID_RyAxis _glfw_GUID_RyAxis #define GUID_RzAxis _glfw_GUID_RzAxis #define GUID_Slider _glfw_GUID_Slider #define GUID_POV _glfw_GUID_POV // Object data array for our clone of c_dfDIJoystick // Generated with https://github.com/elmindreda/c_dfDIJoystick2 // static DIOBJECTDATAFORMAT _glfwObjectDataFormats[] = { { &GUID_XAxis,DIJOFS_X,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_YAxis,DIJOFS_Y,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_ZAxis,DIJOFS_Z,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_RxAxis,DIJOFS_RX,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_RyAxis,DIJOFS_RY,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_RzAxis,DIJOFS_RZ,DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_AXIS|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,DIDOI_ASPECTPOSITION }, { &GUID_POV,DIJOFS_POV(0),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { &GUID_POV,DIJOFS_POV(1),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { &GUID_POV,DIJOFS_POV(2),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { &GUID_POV,DIJOFS_POV(3),DIDFT_POV|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(0),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(1),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(2),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(3),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(4),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(5),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(6),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(7),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(8),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(9),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(10),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(11),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(12),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(13),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(14),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(15),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(16),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(17),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(18),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(19),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(20),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(21),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(22),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(23),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(24),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(25),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(26),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(27),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(28),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(29),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(30),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, { NULL,DIJOFS_BUTTON(31),DIDFT_BUTTON|DIDFT_OPTIONAL|DIDFT_ANYINSTANCE,0 }, }; // Our clone of c_dfDIJoystick // static const DIDATAFORMAT _glfwDataFormat = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDFT_ABSAXIS, sizeof(DIJOYSTATE), sizeof(_glfwObjectDataFormats) / sizeof(DIOBJECTDATAFORMAT), _glfwObjectDataFormats }; // Returns a description fitting the specified XInput capabilities // static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic) { switch (xic->SubType) { case XINPUT_DEVSUBTYPE_WHEEL: return "XInput Wheel"; case XINPUT_DEVSUBTYPE_ARCADE_STICK: return "XInput Arcade Stick"; case XINPUT_DEVSUBTYPE_FLIGHT_STICK: return "XInput Flight Stick"; case XINPUT_DEVSUBTYPE_DANCE_PAD: return "XInput Dance Pad"; case XINPUT_DEVSUBTYPE_GUITAR: return "XInput Guitar"; case XINPUT_DEVSUBTYPE_DRUM_KIT: return "XInput Drum Kit"; case XINPUT_DEVSUBTYPE_GAMEPAD: { if (xic->Flags & XINPUT_CAPS_WIRELESS) return "Wireless Xbox Controller"; else return "Xbox Controller"; } } return "Unknown XInput Device"; } // Lexically compare device objects // static int compareJoystickObjects(const void* first, const void* second) { const _GLFWjoyobjectWin32* fo = first; const _GLFWjoyobjectWin32* so = second; if (fo->type != so->type) return fo->type - so->type; return fo->offset - so->offset; } // Checks whether the specified device supports XInput // Technique from FDInputJoystickManager::IsXInputDeviceFast in ZDoom // static GLFWbool supportsXInput(const GUID* guid) { UINT i, count = 0; RAWINPUTDEVICELIST* ridl; GLFWbool result = GLFW_FALSE; if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0) return GLFW_FALSE; ridl = calloc(count, sizeof(RAWINPUTDEVICELIST)); if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1) { free(ridl); return GLFW_FALSE; } for (i = 0; i < count; i++) { RID_DEVICE_INFO rdi; char name[256]; UINT size; if (ridl[i].dwType != RIM_TYPEHID) continue; ZeroMemory(&rdi, sizeof(rdi)); rdi.cbSize = sizeof(rdi); size = sizeof(rdi); if ((INT) GetRawInputDeviceInfoA(ridl[i].hDevice, RIDI_DEVICEINFO, &rdi, &size) == -1) { continue; } if (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) != (LONG) guid->Data1) continue; memset(name, 0, sizeof(name)); size = sizeof(name); if ((INT) GetRawInputDeviceInfoA(ridl[i].hDevice, RIDI_DEVICENAME, name, &size) == -1) { break; } name[sizeof(name) - 1] = '\0'; if (strstr(name, "IG_")) { result = GLFW_TRUE; break; } } free(ridl); return result; } // Frees all resources associated with the specified joystick // static void closeJoystick(_GLFWjoystick* js) { if (js->win32.device) { IDirectInputDevice8_Unacquire(js->win32.device); IDirectInputDevice8_Release(js->win32.device); } free(js->win32.objects); _glfwFreeJoystick(js); _glfwInputJoystick(js, GLFW_DISCONNECTED); } // DirectInput device object enumeration callback // Insights gleaned from SDL // static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi, void* user) { _GLFWobjenumWin32* data = user; _GLFWjoyobjectWin32* object = data->objects + data->objectCount; if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS) { DIPROPRANGE dipr; if (memcmp(&doi->guidType, &GUID_Slider, sizeof(GUID)) == 0) object->offset = DIJOFS_SLIDER(data->sliderCount); else if (memcmp(&doi->guidType, &GUID_XAxis, sizeof(GUID)) == 0) object->offset = DIJOFS_X; else if (memcmp(&doi->guidType, &GUID_YAxis, sizeof(GUID)) == 0) object->offset = DIJOFS_Y; else if (memcmp(&doi->guidType, &GUID_ZAxis, sizeof(GUID)) == 0) object->offset = DIJOFS_Z; else if (memcmp(&doi->guidType, &GUID_RxAxis, sizeof(GUID)) == 0) object->offset = DIJOFS_RX; else if (memcmp(&doi->guidType, &GUID_RyAxis, sizeof(GUID)) == 0) object->offset = DIJOFS_RY; else if (memcmp(&doi->guidType, &GUID_RzAxis, sizeof(GUID)) == 0) object->offset = DIJOFS_RZ; else return DIENUM_CONTINUE; ZeroMemory(&dipr, sizeof(dipr)); dipr.diph.dwSize = sizeof(dipr); dipr.diph.dwHeaderSize = sizeof(dipr.diph); dipr.diph.dwObj = doi->dwType; dipr.diph.dwHow = DIPH_BYID; dipr.lMin = -32768; dipr.lMax = 32767; if (FAILED(IDirectInputDevice8_SetProperty(data->device, DIPROP_RANGE, &dipr.diph))) { return DIENUM_CONTINUE; } if (memcmp(&doi->guidType, &GUID_Slider, sizeof(GUID)) == 0) { object->type = _GLFW_TYPE_SLIDER; data->sliderCount++; } else { object->type = _GLFW_TYPE_AXIS; data->axisCount++; } } else if (DIDFT_GETTYPE(doi->dwType) & DIDFT_BUTTON) { object->offset = DIJOFS_BUTTON(data->buttonCount); object->type = _GLFW_TYPE_BUTTON; data->buttonCount++; } else if (DIDFT_GETTYPE(doi->dwType) & DIDFT_POV) { object->offset = DIJOFS_POV(data->povCount); object->type = _GLFW_TYPE_POV; data->povCount++; } data->objectCount++; return DIENUM_CONTINUE; } // DirectInput device enumeration callback // static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user) { int jid = 0; DIDEVCAPS dc; DIPROPDWORD dipd; IDirectInputDevice8* device; _GLFWobjenumWin32 data; _GLFWjoystick* js; char guid[33]; char name[256]; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; if (js->present) { if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0) return DIENUM_CONTINUE; } } if (supportsXInput(&di->guidProduct)) return DIENUM_CONTINUE; if (FAILED(IDirectInput8_CreateDevice(_glfw.win32.dinput8.api, &di->guidInstance, &device, NULL))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create device"); return DIENUM_CONTINUE; } if (FAILED(IDirectInputDevice8_SetDataFormat(device, &_glfwDataFormat))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to set device data format"); IDirectInputDevice8_Release(device); return DIENUM_CONTINUE; } ZeroMemory(&dc, sizeof(dc)); dc.dwSize = sizeof(dc); if (FAILED(IDirectInputDevice8_GetCapabilities(device, &dc))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query device capabilities"); IDirectInputDevice8_Release(device); return DIENUM_CONTINUE; } ZeroMemory(&dipd, sizeof(dipd)); dipd.diph.dwSize = sizeof(dipd); dipd.diph.dwHeaderSize = sizeof(dipd.diph); dipd.diph.dwHow = DIPH_DEVICE; dipd.dwData = DIPROPAXISMODE_ABS; if (FAILED(IDirectInputDevice8_SetProperty(device, DIPROP_AXISMODE, &dipd.diph))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to set device axis mode"); IDirectInputDevice8_Release(device); return DIENUM_CONTINUE; } memset(&data, 0, sizeof(data)); data.device = device; data.objects = calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs, sizeof(_GLFWjoyobjectWin32)); if (FAILED(IDirectInputDevice8_EnumObjects(device, deviceObjectCallback, &data, DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to enumerate device objects"); IDirectInputDevice8_Release(device); free(data.objects); return DIENUM_CONTINUE; } qsort(data.objects, data.objectCount, sizeof(_GLFWjoyobjectWin32), compareJoystickObjects); if (!WideCharToMultiByte(CP_UTF8, 0, di->tszInstanceName, -1, name, sizeof(name), NULL, NULL)) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to convert joystick name to UTF-8"); IDirectInputDevice8_Release(device); free(data.objects); return DIENUM_STOP; } // Generate a joystick GUID that matches the SDL 2.0.5+ one if (memcmp(&di->guidProduct.Data4[2], "PIDVID", 6) == 0) { sprintf(guid, "03000000%02x%02x0000%02x%02x000000000000", (uint8_t) di->guidProduct.Data1, (uint8_t) (di->guidProduct.Data1 >> 8), (uint8_t) (di->guidProduct.Data1 >> 16), (uint8_t) (di->guidProduct.Data1 >> 24)); } else { sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00", name[0], name[1], name[2], name[3], name[4], name[5], name[6], name[7], name[8], name[9], name[10]); } js = _glfwAllocJoystick(name, guid, data.axisCount + data.sliderCount, data.buttonCount, data.povCount); if (!js) { IDirectInputDevice8_Release(device); free(data.objects); return DIENUM_STOP; } js->win32.device = device; js->win32.guid = di->guidInstance; js->win32.objects = data.objects; js->win32.objectCount = data.objectCount; _glfwInputJoystick(js, GLFW_CONNECTED); return DIENUM_CONTINUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialize joystick interface // void _glfwInitJoysticksWin32(void) { if (_glfw.win32.dinput8.instance) { if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void**) &_glfw.win32.dinput8.api, NULL))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create interface"); } } _glfwDetectJoystickConnectionWin32(); } // Close all opened joystick handles // void _glfwTerminateJoysticksWin32(void) { int jid; for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++) closeJoystick(_glfw.joysticks + jid); if (_glfw.win32.dinput8.api) IDirectInput8_Release(_glfw.win32.dinput8.api); } // Checks for new joysticks after DBT_DEVICEARRIVAL // void _glfwDetectJoystickConnectionWin32(void) { if (_glfw.win32.xinput.instance) { DWORD index; for (index = 0; index < XUSER_MAX_COUNT; index++) { int jid; char guid[33]; XINPUT_CAPABILITIES xic; _GLFWjoystick* js; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { if (_glfw.joysticks[jid].present && _glfw.joysticks[jid].win32.device == NULL && _glfw.joysticks[jid].win32.index == index) { break; } } if (jid <= GLFW_JOYSTICK_LAST) continue; if (XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS) continue; // Generate a joystick GUID that matches the SDL 2.0.5+ one sprintf(guid, "78696e707574%02x000000000000000000", xic.SubType & 0xff); js = _glfwAllocJoystick(getDeviceDescription(&xic), guid, 6, 10, 1); if (!js) continue; js->win32.index = index; _glfwInputJoystick(js, GLFW_CONNECTED); } } if (_glfw.win32.dinput8.api) { if (FAILED(IDirectInput8_EnumDevices(_glfw.win32.dinput8.api, DI8DEVCLASS_GAMECTRL, deviceCallback, NULL, DIEDFL_ALLDEVICES))) { _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to enumerate DirectInput8 devices"); return; } } } // Checks for joystick disconnection after DBT_DEVICEREMOVECOMPLETE // void _glfwDetectJoystickDisconnectionWin32(void) { int jid; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; if (js->present) _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) { if (js->win32.device) { int i, ai = 0, bi = 0, pi = 0; HRESULT result; DIJOYSTATE state; IDirectInputDevice8_Poll(js->win32.device); result = IDirectInputDevice8_GetDeviceState(js->win32.device, sizeof(state), &state); if (result == DIERR_NOTACQUIRED || result == DIERR_INPUTLOST) { IDirectInputDevice8_Acquire(js->win32.device); IDirectInputDevice8_Poll(js->win32.device); result = IDirectInputDevice8_GetDeviceState(js->win32.device, sizeof(state), &state); } if (FAILED(result)) { closeJoystick(js); return GLFW_FALSE; } if (mode == _GLFW_POLL_PRESENCE) return GLFW_TRUE; for (i = 0; i < js->win32.objectCount; i++) { const void* data = (char*) &state + js->win32.objects[i].offset; switch (js->win32.objects[i].type) { case _GLFW_TYPE_AXIS: case _GLFW_TYPE_SLIDER: { const float value = (*((LONG*) data) + 0.5f) / 32767.5f; _glfwInputJoystickAxis(js, ai, value); ai++; break; } case _GLFW_TYPE_BUTTON: { const char value = (*((BYTE*) data) & 0x80) != 0; _glfwInputJoystickButton(js, bi, value); bi++; break; } case _GLFW_TYPE_POV: { const int states[9] = { GLFW_HAT_UP, GLFW_HAT_RIGHT_UP, GLFW_HAT_RIGHT, GLFW_HAT_RIGHT_DOWN, GLFW_HAT_DOWN, GLFW_HAT_LEFT_DOWN, GLFW_HAT_LEFT, GLFW_HAT_LEFT_UP, GLFW_HAT_CENTERED }; // Screams of horror are appropriate at this point int state = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES); if (state < 0 || state > 8) state = 8; _glfwInputJoystickHat(js, pi, states[state]); pi++; break; } } } } else { int i, dpad = 0; DWORD result; XINPUT_STATE xis; const WORD buttons[10] = { XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y, XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER, XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_START, XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB }; result = XInputGetState(js->win32.index, &xis); if (result != ERROR_SUCCESS) { if (result == ERROR_DEVICE_NOT_CONNECTED) closeJoystick(js); return GLFW_FALSE; } if (mode == _GLFW_POLL_PRESENCE) return GLFW_TRUE; _glfwInputJoystickAxis(js, 0, (xis.Gamepad.sThumbLX + 0.5f) / 32767.5f); _glfwInputJoystickAxis(js, 1, -(xis.Gamepad.sThumbLY + 0.5f) / 32767.5f); _glfwInputJoystickAxis(js, 2, (xis.Gamepad.sThumbRX + 0.5f) / 32767.5f); _glfwInputJoystickAxis(js, 3, -(xis.Gamepad.sThumbRY + 0.5f) / 32767.5f); _glfwInputJoystickAxis(js, 4, xis.Gamepad.bLeftTrigger / 127.5f - 1.f); _glfwInputJoystickAxis(js, 5, xis.Gamepad.bRightTrigger / 127.5f - 1.f); for (i = 0; i < 10; i++) { const char value = (xis.Gamepad.wButtons & buttons[i]) ? 1 : 0; _glfwInputJoystickButton(js, i, value); } if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) dpad |= GLFW_HAT_UP; if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) dpad |= GLFW_HAT_RIGHT; if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) dpad |= GLFW_HAT_DOWN; if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) dpad |= GLFW_HAT_LEFT; _glfwInputJoystickHat(js, 0, dpad); } return GLFW_TRUE; } void _glfwPlatformUpdateGamepadGUID(char* guid) { if (strcmp(guid + 20, "504944564944") == 0) { char original[33]; strncpy(original, guid, sizeof(original) - 1); sprintf(guid, "03000000%.4s0000%.4s000000000000", original, original + 4); } } ================================================ FILE: thirdparty/glfw/src/win32_joystick.h ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32 #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } #define _GLFW_PLATFORM_MAPPING_NAME "Windows" // Joystick element (axis, button or slider) // typedef struct _GLFWjoyobjectWin32 { int offset; int type; } _GLFWjoyobjectWin32; // Win32-specific per-joystick data // typedef struct _GLFWjoystickWin32 { _GLFWjoyobjectWin32* objects; int objectCount; IDirectInputDevice8W* device; DWORD index; GUID guid; } _GLFWjoystickWin32; void _glfwInitJoysticksWin32(void); void _glfwTerminateJoysticksWin32(void); void _glfwDetectJoystickConnectionWin32(void); void _glfwDetectJoystickDisconnectionWin32(void); ================================================ FILE: thirdparty/glfw/src/win32_monitor.c ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include #include // Callback for EnumDisplayMonitors in createMonitor // static BOOL CALLBACK monitorCallback(HMONITOR handle, HDC dc, RECT* rect, LPARAM data) { MONITORINFOEXW mi; ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); if (GetMonitorInfoW(handle, (MONITORINFO*) &mi)) { _GLFWmonitor* monitor = (_GLFWmonitor*) data; if (wcscmp(mi.szDevice, monitor->win32.adapterName) == 0) monitor->win32.handle = handle; } return TRUE; } // Create monitor from an adapter and (optionally) a display // static _GLFWmonitor* createMonitor(DISPLAY_DEVICEW* adapter, DISPLAY_DEVICEW* display) { _GLFWmonitor* monitor; int widthMM, heightMM; char* name; HDC dc; DEVMODEW dm; RECT rect; if (display) name = _glfwCreateUTF8FromWideStringWin32(display->DeviceString); else name = _glfwCreateUTF8FromWideStringWin32(adapter->DeviceString); if (!name) return NULL; ZeroMemory(&dm, sizeof(dm)); dm.dmSize = sizeof(dm); EnumDisplaySettingsW(adapter->DeviceName, ENUM_CURRENT_SETTINGS, &dm); dc = CreateDCW(L"DISPLAY", adapter->DeviceName, NULL, NULL); if (IsWindows8Point1OrGreater()) { widthMM = GetDeviceCaps(dc, HORZSIZE); heightMM = GetDeviceCaps(dc, VERTSIZE); } else { widthMM = (int) (dm.dmPelsWidth * 25.4f / GetDeviceCaps(dc, LOGPIXELSX)); heightMM = (int) (dm.dmPelsHeight * 25.4f / GetDeviceCaps(dc, LOGPIXELSY)); } DeleteDC(dc); monitor = _glfwAllocMonitor(name, widthMM, heightMM); free(name); if (adapter->StateFlags & DISPLAY_DEVICE_MODESPRUNED) monitor->win32.modesPruned = GLFW_TRUE; wcscpy(monitor->win32.adapterName, adapter->DeviceName); WideCharToMultiByte(CP_UTF8, 0, adapter->DeviceName, -1, monitor->win32.publicAdapterName, sizeof(monitor->win32.publicAdapterName), NULL, NULL); if (display) { wcscpy(monitor->win32.displayName, display->DeviceName); WideCharToMultiByte(CP_UTF8, 0, display->DeviceName, -1, monitor->win32.publicDisplayName, sizeof(monitor->win32.publicDisplayName), NULL, NULL); } rect.left = dm.dmPosition.x; rect.top = dm.dmPosition.y; rect.right = dm.dmPosition.x + dm.dmPelsWidth; rect.bottom = dm.dmPosition.y + dm.dmPelsHeight; EnumDisplayMonitors(NULL, &rect, monitorCallback, (LPARAM) monitor); return monitor; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Poll for changes in the set of connected monitors // void _glfwPollMonitorsWin32(void) { int i, disconnectedCount; _GLFWmonitor** disconnected = NULL; DWORD adapterIndex, displayIndex; DISPLAY_DEVICEW adapter, display; _GLFWmonitor* monitor; disconnectedCount = _glfw.monitorCount; if (disconnectedCount) { disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*)); memcpy(disconnected, _glfw.monitors, _glfw.monitorCount * sizeof(_GLFWmonitor*)); } for (adapterIndex = 0; ; adapterIndex++) { int type = _GLFW_INSERT_LAST; ZeroMemory(&adapter, sizeof(adapter)); adapter.cb = sizeof(adapter); if (!EnumDisplayDevicesW(NULL, adapterIndex, &adapter, 0)) break; if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE)) continue; if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) type = _GLFW_INSERT_FIRST; for (displayIndex = 0; ; displayIndex++) { ZeroMemory(&display, sizeof(display)); display.cb = sizeof(display); if (!EnumDisplayDevicesW(adapter.DeviceName, displayIndex, &display, 0)) break; if (!(display.StateFlags & DISPLAY_DEVICE_ACTIVE)) continue; for (i = 0; i < disconnectedCount; i++) { if (disconnected[i] && wcscmp(disconnected[i]->win32.displayName, display.DeviceName) == 0) { disconnected[i] = NULL; break; } } if (i < disconnectedCount) continue; monitor = createMonitor(&adapter, &display); if (!monitor) { free(disconnected); return; } _glfwInputMonitor(monitor, GLFW_CONNECTED, type); type = _GLFW_INSERT_LAST; } // HACK: If an active adapter does not have any display devices // (as sometimes happens), add it directly as a monitor if (displayIndex == 0) { for (i = 0; i < disconnectedCount; i++) { if (disconnected[i] && wcscmp(disconnected[i]->win32.adapterName, adapter.DeviceName) == 0) { disconnected[i] = NULL; break; } } if (i < disconnectedCount) continue; monitor = createMonitor(&adapter, NULL); if (!monitor) { free(disconnected); return; } _glfwInputMonitor(monitor, GLFW_CONNECTED, type); } } for (i = 0; i < disconnectedCount; i++) { if (disconnected[i]) _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0); } free(disconnected); } // Change the current video mode // void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired) { GLFWvidmode current; const GLFWvidmode* best; DEVMODEW dm; LONG result; best = _glfwChooseVideoMode(monitor, desired); _glfwPlatformGetVideoMode(monitor, ¤t); if (_glfwCompareVideoModes(¤t, best) == 0) return; ZeroMemory(&dm, sizeof(dm)); dm.dmSize = sizeof(dm); dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY; dm.dmPelsWidth = best->width; dm.dmPelsHeight = best->height; dm.dmBitsPerPel = best->redBits + best->greenBits + best->blueBits; dm.dmDisplayFrequency = best->refreshRate; if (dm.dmBitsPerPel < 15 || dm.dmBitsPerPel >= 24) dm.dmBitsPerPel = 32; result = ChangeDisplaySettingsExW(monitor->win32.adapterName, &dm, NULL, CDS_FULLSCREEN, NULL); if (result == DISP_CHANGE_SUCCESSFUL) monitor->win32.modeChanged = GLFW_TRUE; else { const char* description = "Unknown error"; if (result == DISP_CHANGE_BADDUALVIEW) description = "The system uses DualView"; else if (result == DISP_CHANGE_BADFLAGS) description = "Invalid flags"; else if (result == DISP_CHANGE_BADMODE) description = "Graphics mode not supported"; else if (result == DISP_CHANGE_BADPARAM) description = "Invalid parameter"; else if (result == DISP_CHANGE_FAILED) description = "Graphics mode failed"; else if (result == DISP_CHANGE_NOTUPDATED) description = "Failed to write to registry"; else if (result == DISP_CHANGE_RESTART) description = "Computer restart required"; _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to set video mode: %s", description); } } // Restore the previously saved (original) video mode // void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor) { if (monitor->win32.modeChanged) { ChangeDisplaySettingsExW(monitor->win32.adapterName, NULL, NULL, CDS_FULLSCREEN, NULL); monitor->win32.modeChanged = GLFW_FALSE; } } void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* yscale) { UINT xdpi, ydpi; if (IsWindows8Point1OrGreater()) GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi); else { const HDC dc = GetDC(NULL); xdpi = GetDeviceCaps(dc, LOGPIXELSX); ydpi = GetDeviceCaps(dc, LOGPIXELSY); ReleaseDC(NULL, dc); } if (xscale) *xscale = xdpi / (float) USER_DEFAULT_SCREEN_DPI; if (yscale) *yscale = ydpi / (float) USER_DEFAULT_SCREEN_DPI; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) { } void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { DEVMODEW dm; ZeroMemory(&dm, sizeof(dm)); dm.dmSize = sizeof(dm); EnumDisplaySettingsExW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm, EDS_ROTATEDMODE); if (xpos) *xpos = dm.dmPosition.x; if (ypos) *ypos = dm.dmPosition.y; } void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale) { _glfwGetMonitorContentScaleWin32(monitor->win32.handle, xscale, yscale); } void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height) { MONITORINFO mi = { sizeof(mi) }; GetMonitorInfo(monitor->win32.handle, &mi); if (xpos) *xpos = mi.rcWork.left; if (ypos) *ypos = mi.rcWork.top; if (width) *width = mi.rcWork.right - mi.rcWork.left; if (height) *height = mi.rcWork.bottom - mi.rcWork.top; } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) { int modeIndex = 0, size = 0; GLFWvidmode* result = NULL; *count = 0; for (;;) { int i; GLFWvidmode mode; DEVMODEW dm; ZeroMemory(&dm, sizeof(dm)); dm.dmSize = sizeof(dm); if (!EnumDisplaySettingsW(monitor->win32.adapterName, modeIndex, &dm)) break; modeIndex++; // Skip modes with less than 15 BPP if (dm.dmBitsPerPel < 15) continue; mode.width = dm.dmPelsWidth; mode.height = dm.dmPelsHeight; mode.refreshRate = dm.dmDisplayFrequency; _glfwSplitBPP(dm.dmBitsPerPel, &mode.redBits, &mode.greenBits, &mode.blueBits); for (i = 0; i < *count; i++) { if (_glfwCompareVideoModes(result + i, &mode) == 0) break; } // Skip duplicate modes if (i < *count) continue; if (monitor->win32.modesPruned) { // Skip modes not supported by the connected displays if (ChangeDisplaySettingsExW(monitor->win32.adapterName, &dm, NULL, CDS_TEST, NULL) != DISP_CHANGE_SUCCESSFUL) { continue; } } if (*count == size) { size += 128; result = (GLFWvidmode*) realloc(result, size * sizeof(GLFWvidmode)); } (*count)++; result[*count - 1] = mode; } if (!*count) { // HACK: Report the current mode if no valid modes were found result = calloc(1, sizeof(GLFWvidmode)); _glfwPlatformGetVideoMode(monitor, result); *count = 1; } return result; } void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { DEVMODEW dm; ZeroMemory(&dm, sizeof(dm)); dm.dmSize = sizeof(dm); EnumDisplaySettingsW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm); mode->width = dm.dmPelsWidth; mode->height = dm.dmPelsHeight; mode->refreshRate = dm.dmDisplayFrequency; _glfwSplitBPP(dm.dmBitsPerPel, &mode->redBits, &mode->greenBits, &mode->blueBits); } GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { HDC dc; WORD values[3][256]; dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL); GetDeviceGammaRamp(dc, values); DeleteDC(dc); _glfwAllocGammaArrays(ramp, 256); memcpy(ramp->red, values[0], sizeof(values[0])); memcpy(ramp->green, values[1], sizeof(values[1])); memcpy(ramp->blue, values[2], sizeof(values[2])); return GLFW_TRUE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { HDC dc; WORD values[3][256]; if (ramp->size != 256) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Gamma ramp size must be 256"); return; } memcpy(values[0], ramp->red, sizeof(values[0])); memcpy(values[1], ramp->green, sizeof(values[1])); memcpy(values[2], ramp->blue, sizeof(values[2])); dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL); SetDeviceGammaRamp(dc, values); DeleteDC(dc); } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return monitor->win32.publicAdapterName; } GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return monitor->win32.publicDisplayName; } ================================================ FILE: thirdparty/glfw/src/win32_platform.h ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // We don't need all the fancy stuff #ifndef NOMINMAX #define NOMINMAX #endif #ifndef VC_EXTRALEAN #define VC_EXTRALEAN #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // example to allow applications to correctly declare a GL_ARB_debug_output // callback) but windows.h assumes no one will define APIENTRY before it does #undef APIENTRY // GLFW on Windows is Unicode only and does not work in MBCS mode #ifndef UNICODE #define UNICODE #endif // GLFW requires Windows XP or later #if WINVER < 0x0501 #undef WINVER #define WINVER 0x0501 #endif #if _WIN32_WINNT < 0x0501 #undef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif // GLFW uses DirectInput8 interfaces #define DIRECTINPUT_VERSION 0x0800 // GLFW uses OEM cursor resources #define OEMRESOURCE #include #include #include #include #include // HACK: Define macros that some windows.h variants don't #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif #ifndef WM_DWMCOMPOSITIONCHANGED #define WM_DWMCOMPOSITIONCHANGED 0x031E #endif #ifndef WM_COPYGLOBALDATA #define WM_COPYGLOBALDATA 0x0049 #endif #ifndef WM_UNICHAR #define WM_UNICHAR 0x0109 #endif #ifndef UNICODE_NOCHAR #define UNICODE_NOCHAR 0xFFFF #endif #ifndef WM_DPICHANGED #define WM_DPICHANGED 0x02E0 #endif #ifndef GET_XBUTTON_WPARAM #define GET_XBUTTON_WPARAM(w) (HIWORD(w)) #endif #ifndef EDS_ROTATEDMODE #define EDS_ROTATEDMODE 0x00000004 #endif #ifndef DISPLAY_DEVICE_ACTIVE #define DISPLAY_DEVICE_ACTIVE 0x00000001 #endif #ifndef _WIN32_WINNT_WINBLUE #define _WIN32_WINNT_WINBLUE 0x0602 #endif #ifndef _WIN32_WINNT_WIN8 #define _WIN32_WINNT_WIN8 0x0602 #endif #ifndef WM_GETDPISCALEDSIZE #define WM_GETDPISCALEDSIZE 0x02e4 #endif #ifndef USER_DEFAULT_SCREEN_DPI #define USER_DEFAULT_SCREEN_DPI 96 #endif #ifndef OCR_HAND #define OCR_HAND 32649 #endif #if WINVER < 0x0601 typedef struct { DWORD cbSize; DWORD ExtStatus; } CHANGEFILTERSTRUCT; #ifndef MSGFLT_ALLOW #define MSGFLT_ALLOW 1 #endif #endif /*Windows 7*/ #if WINVER < 0x0600 #define DWM_BB_ENABLE 0x00000001 #define DWM_BB_BLURREGION 0x00000002 typedef struct { DWORD dwFlags; BOOL fEnable; HRGN hRgnBlur; BOOL fTransitionOnMaximized; } DWM_BLURBEHIND; #else #include #endif /*Windows Vista*/ #ifndef DPI_ENUMS_DECLARED typedef enum { PROCESS_DPI_UNAWARE = 0, PROCESS_SYSTEM_DPI_AWARE = 1, PROCESS_PER_MONITOR_DPI_AWARE = 2 } PROCESS_DPI_AWARENESS; typedef enum { MDT_EFFECTIVE_DPI = 0, MDT_ANGULAR_DPI = 1, MDT_RAW_DPI = 2, MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE; #endif /*DPI_ENUMS_DECLARED*/ #ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4) #endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/ // HACK: Define versionhelpers.h functions manually as MinGW lacks the header #define IsWindowsXPOrGreater() \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \ LOBYTE(_WIN32_WINNT_WINXP), 0) #define IsWindowsVistaOrGreater() \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_VISTA), \ LOBYTE(_WIN32_WINNT_VISTA), 0) #define IsWindows7OrGreater() \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN7), \ LOBYTE(_WIN32_WINNT_WIN7), 0) #define IsWindows8OrGreater() \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN8), \ LOBYTE(_WIN32_WINNT_WIN8), 0) #define IsWindows8Point1OrGreater() \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \ LOBYTE(_WIN32_WINNT_WINBLUE), 0) #define _glfwIsWindows10AnniversaryUpdateOrGreaterWin32() \ _glfwIsWindows10BuildOrGreaterWin32(14393) #define _glfwIsWindows10CreatorsUpdateOrGreaterWin32() \ _glfwIsWindows10BuildOrGreaterWin32(15063) // HACK: Define macros that some xinput.h variants don't #ifndef XINPUT_CAPS_WIRELESS #define XINPUT_CAPS_WIRELESS 0x0002 #endif #ifndef XINPUT_DEVSUBTYPE_WHEEL #define XINPUT_DEVSUBTYPE_WHEEL 0x02 #endif #ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 #endif #ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK #define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04 #endif #ifndef XINPUT_DEVSUBTYPE_DANCE_PAD #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 #endif #ifndef XINPUT_DEVSUBTYPE_GUITAR #define XINPUT_DEVSUBTYPE_GUITAR 0x06 #endif #ifndef XINPUT_DEVSUBTYPE_DRUM_KIT #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 #endif #ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD #define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13 #endif #ifndef XUSER_MAX_COUNT #define XUSER_MAX_COUNT 4 #endif // HACK: Define macros that some dinput.h variants don't #ifndef DIDFT_OPTIONAL #define DIDFT_OPTIONAL 0x80000000 #endif // winmm.dll function pointer typedefs typedef DWORD (WINAPI * PFN_timeGetTime)(void); #define timeGetTime _glfw.win32.winmm.GetTime // xinput.dll function pointer typedefs typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*); typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*); #define XInputGetCapabilities _glfw.win32.xinput.GetCapabilities #define XInputGetState _glfw.win32.xinput.GetState // dinput8.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID*,LPUNKNOWN); #define DirectInput8Create _glfw.win32.dinput8.Create // user32.dll function pointer typedefs typedef BOOL (WINAPI * PFN_SetProcessDPIAware)(void); typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,CHANGEFILTERSTRUCT*); typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND); typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE); typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND); typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); #define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_ #define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_ #define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_ #define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_ #define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_ #define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_ // dwmapi.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*); typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID); typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*); #define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled #define DwmFlush _glfw.win32.dwmapi.Flush #define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow // shcore.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); typedef HRESULT (WINAPI * PFN_GetDpiForMonitor)(HMONITOR,MONITOR_DPI_TYPE,UINT*,UINT*); #define SetProcessDpiAwareness _glfw.win32.shcore.SetProcessDpiAwareness_ #define GetDpiForMonitor _glfw.win32.shcore.GetDpiForMonitor_ // ntdll.dll function pointer typedefs typedef LONG (WINAPI * PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*,ULONG,ULONGLONG); #define RtlVerifyVersionInfo _glfw.win32.ntdll.RtlVerifyVersionInfo_ typedef VkFlags VkWin32SurfaceCreateFlagsKHR; typedef struct VkWin32SurfaceCreateInfoKHR { VkStructureType sType; const void* pNext; VkWin32SurfaceCreateFlagsKHR flags; HINSTANCE hinstance; HWND hwnd; } VkWin32SurfaceCreateInfoKHR; typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t); #include "win32_joystick.h" #include "wgl_context.h" #include "egl_context.h" #include "osmesa_context.h" #if !defined(_GLFW_WNDCLASSNAME) #define _GLFW_WNDCLASSNAME L"GLFW30" #endif #define _glfw_dlopen(name) LoadLibraryA(name) #define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle) #define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->win32.handle) #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32 #define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32 #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32 #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32 #define _GLFW_PLATFORM_TLS_STATE _GLFWtlsWin32 win32 #define _GLFW_PLATFORM_MUTEX_STATE _GLFWmutexWin32 win32 // Win32-specific per-window data // typedef struct _GLFWwindowWin32 { HWND handle; HICON bigIcon; HICON smallIcon; GLFWbool cursorTracked; GLFWbool frameAction; GLFWbool iconified; GLFWbool maximized; // Whether to enable framebuffer transparency on DWM GLFWbool transparent; GLFWbool scaleToMonitor; // The last received cursor position, regardless of source int lastCursorPosX, lastCursorPosY; } _GLFWwindowWin32; // Win32-specific global data // typedef struct _GLFWlibraryWin32 { HWND helperWindowHandle; HDEVNOTIFY deviceNotificationHandle; DWORD foregroundLockTimeout; int acquiredMonitorCount; char* clipboardString; short int keycodes[512]; short int scancodes[GLFW_KEY_LAST + 1]; char keynames[GLFW_KEY_LAST + 1][5]; // Where to place the cursor when re-enabled double restoreCursorPosX, restoreCursorPosY; // The window whose disabled cursor mode is active _GLFWwindow* disabledCursorWindow; RAWINPUT* rawInput; int rawInputSize; UINT mouseTrailSize; struct { HINSTANCE instance; PFN_timeGetTime GetTime; } winmm; struct { HINSTANCE instance; PFN_DirectInput8Create Create; IDirectInput8W* api; } dinput8; struct { HINSTANCE instance; PFN_XInputGetCapabilities GetCapabilities; PFN_XInputGetState GetState; } xinput; struct { HINSTANCE instance; PFN_SetProcessDPIAware SetProcessDPIAware_; PFN_ChangeWindowMessageFilterEx ChangeWindowMessageFilterEx_; PFN_EnableNonClientDpiScaling EnableNonClientDpiScaling_; PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_; PFN_GetDpiForWindow GetDpiForWindow_; PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_; } user32; struct { HINSTANCE instance; PFN_DwmIsCompositionEnabled IsCompositionEnabled; PFN_DwmFlush Flush; PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow; } dwmapi; struct { HINSTANCE instance; PFN_SetProcessDpiAwareness SetProcessDpiAwareness_; PFN_GetDpiForMonitor GetDpiForMonitor_; } shcore; struct { HINSTANCE instance; PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_; } ntdll; } _GLFWlibraryWin32; // Win32-specific per-monitor data // typedef struct _GLFWmonitorWin32 { HMONITOR handle; // This size matches the static size of DISPLAY_DEVICE.DeviceName WCHAR adapterName[32]; WCHAR displayName[32]; char publicAdapterName[32]; char publicDisplayName[32]; GLFWbool modesPruned; GLFWbool modeChanged; } _GLFWmonitorWin32; // Win32-specific per-cursor data // typedef struct _GLFWcursorWin32 { HCURSOR handle; } _GLFWcursorWin32; // Win32-specific global timer data // typedef struct _GLFWtimerWin32 { GLFWbool hasPC; uint64_t frequency; } _GLFWtimerWin32; // Win32-specific thread local storage data // typedef struct _GLFWtlsWin32 { GLFWbool allocated; DWORD index; } _GLFWtlsWin32; // Win32-specific mutex data // typedef struct _GLFWmutexWin32 { GLFWbool allocated; CRITICAL_SECTION section; } _GLFWmutexWin32; GLFWbool _glfwRegisterWindowClassWin32(void); void _glfwUnregisterWindowClassWin32(void); WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source); char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source); BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp); BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build); void _glfwInputErrorWin32(int error, const char* description); void _glfwUpdateKeyNamesWin32(void); void _glfwInitTimerWin32(void); void _glfwPollMonitorsWin32(void); void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor); void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* yscale); ================================================ FILE: thirdparty/glfw/src/win32_thread.c ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) { assert(tls->win32.allocated == GLFW_FALSE); tls->win32.index = TlsAlloc(); if (tls->win32.index == TLS_OUT_OF_INDEXES) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to allocate TLS index"); return GLFW_FALSE; } tls->win32.allocated = GLFW_TRUE; return GLFW_TRUE; } void _glfwPlatformDestroyTls(_GLFWtls* tls) { if (tls->win32.allocated) TlsFree(tls->win32.index); memset(tls, 0, sizeof(_GLFWtls)); } void* _glfwPlatformGetTls(_GLFWtls* tls) { assert(tls->win32.allocated == GLFW_TRUE); return TlsGetValue(tls->win32.index); } void _glfwPlatformSetTls(_GLFWtls* tls, void* value) { assert(tls->win32.allocated == GLFW_TRUE); TlsSetValue(tls->win32.index, value); } GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) { assert(mutex->win32.allocated == GLFW_FALSE); InitializeCriticalSection(&mutex->win32.section); return mutex->win32.allocated = GLFW_TRUE; } void _glfwPlatformDestroyMutex(_GLFWmutex* mutex) { if (mutex->win32.allocated) DeleteCriticalSection(&mutex->win32.section); memset(mutex, 0, sizeof(_GLFWmutex)); } void _glfwPlatformLockMutex(_GLFWmutex* mutex) { assert(mutex->win32.allocated == GLFW_TRUE); EnterCriticalSection(&mutex->win32.section); } void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) { assert(mutex->win32.allocated == GLFW_TRUE); LeaveCriticalSection(&mutex->win32.section); } ================================================ FILE: thirdparty/glfw/src/win32_time.c ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Initialise timer // void _glfwInitTimerWin32(void) { uint64_t frequency; if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) { _glfw.timer.win32.hasPC = GLFW_TRUE; _glfw.timer.win32.frequency = frequency; } else { _glfw.timer.win32.hasPC = GLFW_FALSE; _glfw.timer.win32.frequency = 1000; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// uint64_t _glfwPlatformGetTimerValue(void) { if (_glfw.timer.win32.hasPC) { uint64_t value; QueryPerformanceCounter((LARGE_INTEGER*) &value); return value; } else return (uint64_t) timeGetTime(); } uint64_t _glfwPlatformGetTimerFrequency(void) { return _glfw.timer.win32.frequency; } ================================================ FILE: thirdparty/glfw/src/win32_window.c ================================================ //======================================================================== // GLFW 3.3 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include #include #include // Returns the window style for the specified window // static DWORD getWindowStyle(const _GLFWwindow* window) { DWORD style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN; if (window->monitor) style |= WS_POPUP; else { style |= WS_SYSMENU | WS_MINIMIZEBOX; if (window->decorated) { style |= WS_CAPTION; if (window->resizable) style |= WS_MAXIMIZEBOX | WS_THICKFRAME; } else style |= WS_POPUP; } return style; } // Returns the extended window style for the specified window // static DWORD getWindowExStyle(const _GLFWwindow* window) { DWORD style = WS_EX_APPWINDOW; if (window->monitor || window->floating) style |= WS_EX_TOPMOST; return style; } // Returns the image whose area most closely matches the desired one // static const GLFWimage* chooseImage(int count, const GLFWimage* images, int width, int height) { int i, leastDiff = INT_MAX; const GLFWimage* closest = NULL; for (i = 0; i < count; i++) { const int currDiff = abs(images[i].width * images[i].height - width * height); if (currDiff < leastDiff) { closest = images + i; leastDiff = currDiff; } } return closest; } // Creates an RGBA icon or cursor // static HICON createIcon(const GLFWimage* image, int xhot, int yhot, GLFWbool icon) { int i; HDC dc; HICON handle; HBITMAP color, mask; BITMAPV5HEADER bi; ICONINFO ii; unsigned char* target = NULL; unsigned char* source = image->pixels; ZeroMemory(&bi, sizeof(bi)); bi.bV5Size = sizeof(bi); bi.bV5Width = image->width; bi.bV5Height = -image->height; bi.bV5Planes = 1; bi.bV5BitCount = 32; bi.bV5Compression = BI_BITFIELDS; bi.bV5RedMask = 0x00ff0000; bi.bV5GreenMask = 0x0000ff00; bi.bV5BlueMask = 0x000000ff; bi.bV5AlphaMask = 0xff000000; dc = GetDC(NULL); color = CreateDIBSection(dc, (BITMAPINFO*) &bi, DIB_RGB_COLORS, (void**) &target, NULL, (DWORD) 0); ReleaseDC(NULL, dc); if (!color) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create RGBA bitmap"); return NULL; } mask = CreateBitmap(image->width, image->height, 1, 1, NULL); if (!mask) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create mask bitmap"); DeleteObject(color); return NULL; } for (i = 0; i < image->width * image->height; i++) { target[0] = source[2]; target[1] = source[1]; target[2] = source[0]; target[3] = source[3]; target += 4; source += 4; } ZeroMemory(&ii, sizeof(ii)); ii.fIcon = icon; ii.xHotspot = xhot; ii.yHotspot = yhot; ii.hbmMask = mask; ii.hbmColor = color; handle = CreateIconIndirect(&ii); DeleteObject(color); DeleteObject(mask); if (!handle) { if (icon) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create icon"); } else { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create cursor"); } } return handle; } // Translate content area size to full window size according to styles and DPI // static void getFullWindowSize(DWORD style, DWORD exStyle, int contentWidth, int contentHeight, int* fullWidth, int* fullHeight, UINT dpi) { RECT rect = { 0, 0, contentWidth, contentHeight }; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi); else AdjustWindowRectEx(&rect, style, FALSE, exStyle); *fullWidth = rect.right - rect.left; *fullHeight = rect.bottom - rect.top; } // Enforce the content area aspect ratio based on which edge is being dragged // static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area) { int xoff, yoff; UINT dpi = USER_DEFAULT_SCREEN_DPI; const float ratio = (float) window->numer / (float) window->denom; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) dpi = GetDpiForWindow(window->win32.handle); getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), 0, 0, &xoff, &yoff, dpi); if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT || edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT) { area->bottom = area->top + yoff + (int) ((area->right - area->left - xoff) / ratio); } else if (edge == WMSZ_TOPLEFT || edge == WMSZ_TOPRIGHT) { area->top = area->bottom - yoff - (int) ((area->right - area->left - xoff) / ratio); } else if (edge == WMSZ_TOP || edge == WMSZ_BOTTOM) { area->right = area->left + xoff + (int) ((area->bottom - area->top - yoff) * ratio); } } // Updates the cursor image according to its cursor mode // static void updateCursorImage(_GLFWwindow* window) { if (window->cursorMode == GLFW_CURSOR_NORMAL) { if (window->cursor) SetCursor(window->cursor->win32.handle); else SetCursor(LoadCursorW(NULL, IDC_ARROW)); } else SetCursor(NULL); } // Updates the cursor clip rect // static void updateClipRect(_GLFWwindow* window) { if (window) { RECT clipRect; GetClientRect(window->win32.handle, &clipRect); ClientToScreen(window->win32.handle, (POINT*) &clipRect.left); ClientToScreen(window->win32.handle, (POINT*) &clipRect.right); ClipCursor(&clipRect); } else ClipCursor(NULL); } // Enables WM_INPUT messages for the mouse for the specified window // static void enableRawMouseMotion(_GLFWwindow* window) { const RAWINPUTDEVICE rid = { 0x01, 0x02, 0, window->win32.handle }; if (!RegisterRawInputDevices(&rid, 1, sizeof(rid))) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to register raw input device"); } } // Disables WM_INPUT messages for the mouse // static void disableRawMouseMotion(_GLFWwindow* window) { const RAWINPUTDEVICE rid = { 0x01, 0x02, RIDEV_REMOVE, NULL }; if (!RegisterRawInputDevices(&rid, 1, sizeof(rid))) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to remove raw input device"); } } // Apply disabled cursor mode to a focused window // static void disableCursor(_GLFWwindow* window) { _glfw.win32.disabledCursorWindow = window; _glfwPlatformGetCursorPos(window, &_glfw.win32.restoreCursorPosX, &_glfw.win32.restoreCursorPosY); updateCursorImage(window); _glfwCenterCursorInContentArea(window); updateClipRect(window); if (window->rawMouseMotion) enableRawMouseMotion(window); } // Exit disabled cursor mode for the specified window // static void enableCursor(_GLFWwindow* window) { if (window->rawMouseMotion) disableRawMouseMotion(window); _glfw.win32.disabledCursorWindow = NULL; updateClipRect(NULL); _glfwPlatformSetCursorPos(window, _glfw.win32.restoreCursorPosX, _glfw.win32.restoreCursorPosY); updateCursorImage(window); } // Returns whether the cursor is in the content area of the specified window // static GLFWbool cursorInContentArea(_GLFWwindow* window) { RECT area; POINT pos; if (!GetCursorPos(&pos)) return GLFW_FALSE; if (WindowFromPoint(pos) != window->win32.handle) return GLFW_FALSE; GetClientRect(window->win32.handle, &area); ClientToScreen(window->win32.handle, (POINT*) &area.left); ClientToScreen(window->win32.handle, (POINT*) &area.right); return PtInRect(&area, pos); } // Update native window styles to match attributes // static void updateWindowStyles(const _GLFWwindow* window) { RECT rect; DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE); style &= ~(WS_OVERLAPPEDWINDOW | WS_POPUP); style |= getWindowStyle(window); GetClientRect(window->win32.handle, &rect); if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, style, FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); } else AdjustWindowRectEx(&rect, style, FALSE, getWindowExStyle(window)); ClientToScreen(window->win32.handle, (POINT*) &rect.left); ClientToScreen(window->win32.handle, (POINT*) &rect.right); SetWindowLongW(window->win32.handle, GWL_STYLE, style); SetWindowPos(window->win32.handle, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER); } // Update window framebuffer transparency // static void updateFramebufferTransparency(const _GLFWwindow* window) { BOOL enabled; if (!IsWindowsVistaOrGreater()) return; if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) { HRGN region = CreateRectRgn(0, 0, -1, -1); DWM_BLURBEHIND bb = {0}; bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; bb.hRgnBlur = region; bb.fEnable = TRUE; if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb))) { // Decorated windows don't repaint the transparent background // leaving a trail behind animations // HACK: Making the window layered with a transparency color key // seems to fix this. Normally, when specifying // a transparency color key to be used when composing the // layered window, all pixels painted by the window in this // color will be transparent. That doesn't seem to be the // case anymore, at least when used with blur behind window // plus negative region. LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); exStyle |= WS_EX_LAYERED; SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle); // Using a color key not equal to black to fix the trailing // issue. When set to black, something is making the hit test // not resize with the window frame. SetLayeredWindowAttributes(window->win32.handle, RGB(255, 0, 255), 255, LWA_COLORKEY); } DeleteObject(region); } else { LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); exStyle &= ~WS_EX_LAYERED; SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle); RedrawWindow(window->win32.handle, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); } } // Retrieves and translates modifier keys // static int getKeyMods(void) { int mods = 0; if (GetKeyState(VK_SHIFT) & 0x8000) mods |= GLFW_MOD_SHIFT; if (GetKeyState(VK_CONTROL) & 0x8000) mods |= GLFW_MOD_CONTROL; if (GetKeyState(VK_MENU) & 0x8000) mods |= GLFW_MOD_ALT; if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x8000) mods |= GLFW_MOD_SUPER; if (GetKeyState(VK_CAPITAL) & 1) mods |= GLFW_MOD_CAPS_LOCK; if (GetKeyState(VK_NUMLOCK) & 1) mods |= GLFW_MOD_NUM_LOCK; return mods; } static void fitToMonitor(_GLFWwindow* window) { MONITORINFO mi = { sizeof(mi) }; GetMonitorInfo(window->monitor->win32.handle, &mi); SetWindowPos(window->win32.handle, HWND_TOPMOST, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS); } // Make the specified window and its video mode active on its monitor // static void acquireMonitor(_GLFWwindow* window) { if (!_glfw.win32.acquiredMonitorCount) { SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED); // HACK: When mouse trails are enabled the cursor becomes invisible when // the OpenGL ICD switches to page flipping if (IsWindowsXPOrGreater()) { SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0); SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0); } } if (!window->monitor->window) _glfw.win32.acquiredMonitorCount++; _glfwSetVideoModeWin32(window->monitor, &window->videoMode); _glfwInputMonitorWindow(window->monitor, window); } // Remove the window and restore the original video mode // static void releaseMonitor(_GLFWwindow* window) { if (window->monitor->window != window) return; _glfw.win32.acquiredMonitorCount--; if (!_glfw.win32.acquiredMonitorCount) { SetThreadExecutionState(ES_CONTINUOUS); // HACK: Restore mouse trail length saved in acquireMonitor if (IsWindowsXPOrGreater()) SystemParametersInfo(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0); } _glfwInputMonitorWindow(window->monitor, NULL); _glfwRestoreVideoModeWin32(window->monitor); } // Window callback function (handles window messages) // static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { _GLFWwindow* window = GetPropW(hWnd, L"GLFW"); if (!window) { // This is the message handling for the hidden helper window // and for a regular window during its initial creation switch (uMsg) { case WM_NCCREATE: { if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) EnableNonClientDpiScaling(hWnd); break; } case WM_DISPLAYCHANGE: _glfwPollMonitorsWin32(); break; case WM_DEVICECHANGE: { if (wParam == DBT_DEVICEARRIVAL) { DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) _glfwDetectJoystickConnectionWin32(); } else if (wParam == DBT_DEVICEREMOVECOMPLETE) { DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) _glfwDetectJoystickDisconnectionWin32(); } break; } } return DefWindowProcW(hWnd, uMsg, wParam, lParam); } switch (uMsg) { case WM_MOUSEACTIVATE: { // HACK: Postpone cursor disabling when the window was activated by // clicking a caption button if (HIWORD(lParam) == WM_LBUTTONDOWN) { if (LOWORD(lParam) != HTCLIENT) window->win32.frameAction = GLFW_TRUE; } break; } case WM_CAPTURECHANGED: { // HACK: Disable the cursor once the caption button action has been // completed or cancelled if (lParam == 0 && window->win32.frameAction) { if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); window->win32.frameAction = GLFW_FALSE; } break; } case WM_SETFOCUS: { _glfwInputWindowFocus(window, GLFW_TRUE); // HACK: Do not disable cursor while the user is interacting with // a caption button if (window->win32.frameAction) break; if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); return 0; } case WM_KILLFOCUS: { if (window->cursorMode == GLFW_CURSOR_DISABLED) enableCursor(window); if (window->monitor && window->autoIconify) _glfwPlatformIconifyWindow(window); _glfwInputWindowFocus(window, GLFW_FALSE); return 0; } case WM_SYSCOMMAND: { switch (wParam & 0xfff0) { case SC_SCREENSAVE: case SC_MONITORPOWER: { if (window->monitor) { // We are running in full screen mode, so disallow // screen saver and screen blanking return 0; } else break; } // User trying to access application menu using ALT? case SC_KEYMENU: return 0; } break; } case WM_CLOSE: { _glfwInputWindowCloseRequest(window); return 0; } case WM_INPUTLANGCHANGE: { _glfwUpdateKeyNamesWin32(); break; } case WM_CHAR: case WM_SYSCHAR: case WM_UNICHAR: { const GLFWbool plain = (uMsg != WM_SYSCHAR); if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR) { // WM_UNICHAR is not sent by Windows, but is sent by some // third-party input method engine // Returning TRUE here announces support for this message return TRUE; } _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain); return 0; } case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_KEYUP: case WM_SYSKEYUP: { int key, scancode; const int action = (HIWORD(lParam) & KF_UP) ? GLFW_RELEASE : GLFW_PRESS; const int mods = getKeyMods(); scancode = (HIWORD(lParam) & (KF_EXTENDED | 0xff)); if (!scancode) { // NOTE: Some synthetic key messages have a scancode of zero // HACK: Map the virtual key back to a usable scancode scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC); } key = _glfw.win32.keycodes[scancode]; // The Ctrl keys require special handling if (wParam == VK_CONTROL) { if (HIWORD(lParam) & KF_EXTENDED) { // Right side keys have the extended key bit set key = GLFW_KEY_RIGHT_CONTROL; } else { // NOTE: Alt Gr sends Left Ctrl followed by Right Alt // HACK: We only want one event for Alt Gr, so if we detect // this sequence we discard this Left Ctrl message now // and later report Right Alt normally MSG next; const DWORD time = GetMessageTime(); if (PeekMessageW(&next, NULL, 0, 0, PM_NOREMOVE)) { if (next.message == WM_KEYDOWN || next.message == WM_SYSKEYDOWN || next.message == WM_KEYUP || next.message == WM_SYSKEYUP) { if (next.wParam == VK_MENU && (HIWORD(next.lParam) & KF_EXTENDED) && next.time == time) { // Next message is Right Alt down so discard this break; } } } // This is a regular Left Ctrl message key = GLFW_KEY_LEFT_CONTROL; } } else if (wParam == VK_PROCESSKEY) { // IME notifies that keys have been filtered by setting the // virtual key-code to VK_PROCESSKEY break; } if (action == GLFW_RELEASE && wParam == VK_SHIFT) { // HACK: Release both Shift keys on Shift up event, as when both // are pressed the first release does not emit any event // NOTE: The other half of this is in _glfwPlatformPollEvents _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, action, mods); _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, action, mods); } else if (wParam == VK_SNAPSHOT) { // HACK: Key down is not reported for the Print Screen key _glfwInputKey(window, key, scancode, GLFW_PRESS, mods); _glfwInputKey(window, key, scancode, GLFW_RELEASE, mods); } else _glfwInputKey(window, key, scancode, action, mods); break; } case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_XBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: case WM_XBUTTONUP: { int i, button, action; if (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP) button = GLFW_MOUSE_BUTTON_LEFT; else if (uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONUP) button = GLFW_MOUSE_BUTTON_RIGHT; else if (uMsg == WM_MBUTTONDOWN || uMsg == WM_MBUTTONUP) button = GLFW_MOUSE_BUTTON_MIDDLE; else if (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) button = GLFW_MOUSE_BUTTON_4; else button = GLFW_MOUSE_BUTTON_5; if (uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN || uMsg == WM_MBUTTONDOWN || uMsg == WM_XBUTTONDOWN) { action = GLFW_PRESS; } else action = GLFW_RELEASE; for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) { if (window->mouseButtons[i] == GLFW_PRESS) break; } if (i > GLFW_MOUSE_BUTTON_LAST) SetCapture(hWnd); _glfwInputMouseClick(window, button, action, getKeyMods()); for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) { if (window->mouseButtons[i] == GLFW_PRESS) break; } if (i > GLFW_MOUSE_BUTTON_LAST) ReleaseCapture(); if (uMsg == WM_XBUTTONDOWN || uMsg == WM_XBUTTONUP) return TRUE; return 0; } case WM_MOUSEMOVE: { const int x = GET_X_LPARAM(lParam); const int y = GET_Y_LPARAM(lParam); if (!window->win32.cursorTracked) { TRACKMOUSEEVENT tme; ZeroMemory(&tme, sizeof(tme)); tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = window->win32.handle; TrackMouseEvent(&tme); window->win32.cursorTracked = GLFW_TRUE; _glfwInputCursorEnter(window, GLFW_TRUE); } if (window->cursorMode == GLFW_CURSOR_DISABLED) { const int dx = x - window->win32.lastCursorPosX; const int dy = y - window->win32.lastCursorPosY; if (_glfw.win32.disabledCursorWindow != window) break; if (window->rawMouseMotion) break; _glfwInputCursorPos(window, window->virtualCursorPosX + dx, window->virtualCursorPosY + dy); } else _glfwInputCursorPos(window, x, y); window->win32.lastCursorPosX = x; window->win32.lastCursorPosY = y; return 0; } case WM_INPUT: { UINT size = 0; HRAWINPUT ri = (HRAWINPUT) lParam; RAWINPUT* data = NULL; int dx, dy; if (_glfw.win32.disabledCursorWindow != window) break; if (!window->rawMouseMotion) break; GetRawInputData(ri, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); if (size > (UINT) _glfw.win32.rawInputSize) { free(_glfw.win32.rawInput); _glfw.win32.rawInput = calloc(size, 1); _glfw.win32.rawInputSize = size; } size = _glfw.win32.rawInputSize; if (GetRawInputData(ri, RID_INPUT, _glfw.win32.rawInput, &size, sizeof(RAWINPUTHEADER)) == (UINT) -1) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to retrieve raw input data"); break; } data = _glfw.win32.rawInput; if (data->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) { dx = data->data.mouse.lLastX - window->win32.lastCursorPosX; dy = data->data.mouse.lLastY - window->win32.lastCursorPosY; } else { dx = data->data.mouse.lLastX; dy = data->data.mouse.lLastY; } _glfwInputCursorPos(window, window->virtualCursorPosX + dx, window->virtualCursorPosY + dy); window->win32.lastCursorPosX += dx; window->win32.lastCursorPosY += dy; break; } case WM_MOUSELEAVE: { window->win32.cursorTracked = GLFW_FALSE; _glfwInputCursorEnter(window, GLFW_FALSE); return 0; } case WM_MOUSEWHEEL: { _glfwInputScroll(window, 0.0, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA); return 0; } case WM_MOUSEHWHEEL: { // This message is only sent on Windows Vista and later // NOTE: The X-axis is inverted for consistency with macOS and X11 _glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0); return 0; } case WM_ENTERSIZEMOVE: case WM_ENTERMENULOOP: { if (window->win32.frameAction) break; // HACK: Enable the cursor while the user is moving or // resizing the window or using the window menu if (window->cursorMode == GLFW_CURSOR_DISABLED) enableCursor(window); break; } case WM_EXITSIZEMOVE: case WM_EXITMENULOOP: { if (window->win32.frameAction) break; // HACK: Disable the cursor once the user is done moving or // resizing the window or using the menu if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); break; } case WM_SIZE: { const GLFWbool iconified = wParam == SIZE_MINIMIZED; const GLFWbool maximized = wParam == SIZE_MAXIMIZED || (window->win32.maximized && wParam != SIZE_RESTORED); if (_glfw.win32.disabledCursorWindow == window) updateClipRect(window); if (window->win32.iconified != iconified) _glfwInputWindowIconify(window, iconified); if (window->win32.maximized != maximized) _glfwInputWindowMaximize(window, maximized); _glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); _glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); if (window->monitor && window->win32.iconified != iconified) { if (iconified) releaseMonitor(window); else { acquireMonitor(window); fitToMonitor(window); } } window->win32.iconified = iconified; window->win32.maximized = maximized; return 0; } case WM_MOVE: { if (_glfw.win32.disabledCursorWindow == window) updateClipRect(window); // NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as // those macros do not handle negative window positions correctly _glfwInputWindowPos(window, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return 0; } case WM_SIZING: { if (window->numer == GLFW_DONT_CARE || window->denom == GLFW_DONT_CARE) { break; } applyAspectRatio(window, (int) wParam, (RECT*) lParam); return TRUE; } case WM_GETMINMAXINFO: { int xoff, yoff; UINT dpi = USER_DEFAULT_SCREEN_DPI; MINMAXINFO* mmi = (MINMAXINFO*) lParam; if (window->monitor) break; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) dpi = GetDpiForWindow(window->win32.handle); getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), 0, 0, &xoff, &yoff, dpi); if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) { mmi->ptMinTrackSize.x = window->minwidth + xoff; mmi->ptMinTrackSize.y = window->minheight + yoff; } if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) { mmi->ptMaxTrackSize.x = window->maxwidth + xoff; mmi->ptMaxTrackSize.y = window->maxheight + yoff; } if (!window->decorated) { MONITORINFO mi; const HMONITOR mh = MonitorFromWindow(window->win32.handle, MONITOR_DEFAULTTONEAREST); ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); GetMonitorInfo(mh, &mi); mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left; mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top; mmi->ptMaxSize.x = mi.rcWork.right - mi.rcWork.left; mmi->ptMaxSize.y = mi.rcWork.bottom - mi.rcWork.top; } return 0; } case WM_PAINT: { _glfwInputWindowDamage(window); break; } case WM_ERASEBKGND: { return TRUE; } case WM_NCACTIVATE: case WM_NCPAINT: { // Prevent title bar from being drawn after restoring a minimized // undecorated window if (!window->decorated) return TRUE; break; } case WM_DWMCOMPOSITIONCHANGED: { if (window->win32.transparent) updateFramebufferTransparency(window); return 0; } case WM_GETDPISCALEDSIZE: { if (window->win32.scaleToMonitor) break; // Adjust the window size to keep the content area size constant if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) { RECT source = {0}, target = {0}; SIZE* size = (SIZE*) lParam; AdjustWindowRectExForDpi(&source, getWindowStyle(window), FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); AdjustWindowRectExForDpi(&target, getWindowStyle(window), FALSE, getWindowExStyle(window), LOWORD(wParam)); size->cx += (target.right - target.left) - (source.right - source.left); size->cy += (target.bottom - target.top) - (source.bottom - source.top); return TRUE; } break; } case WM_DPICHANGED: { const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; // Only apply the suggested size if the OS is new enough to have // sent a WM_GETDPISCALEDSIZE before this if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) { RECT* suggested = (RECT*) lParam; SetWindowPos(window->win32.handle, HWND_TOP, suggested->left, suggested->top, suggested->right - suggested->left, suggested->bottom - suggested->top, SWP_NOACTIVATE | SWP_NOZORDER); } _glfwInputWindowContentScale(window, xscale, yscale); break; } case WM_SETCURSOR: { if (LOWORD(lParam) == HTCLIENT) { updateCursorImage(window); return TRUE; } break; } case WM_DROPFILES: { HDROP drop = (HDROP) wParam; POINT pt; int i; const int count = DragQueryFileW(drop, 0xffffffff, NULL, 0); char** paths = calloc(count, sizeof(char*)); // Move the mouse to the position of the drop DragQueryPoint(drop, &pt); _glfwInputCursorPos(window, pt.x, pt.y); for (i = 0; i < count; i++) { const UINT length = DragQueryFileW(drop, i, NULL, 0); WCHAR* buffer = calloc((size_t) length + 1, sizeof(WCHAR)); DragQueryFileW(drop, i, buffer, length + 1); paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer); free(buffer); } _glfwInputDrop(window, count, (const char**) paths); for (i = 0; i < count; i++) free(paths[i]); free(paths); DragFinish(drop); return 0; } } return DefWindowProcW(hWnd, uMsg, wParam, lParam); } // Creates the GLFW window // static int createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig) { int xpos, ypos, fullWidth, fullHeight; WCHAR* wideTitle; DWORD style = getWindowStyle(window); DWORD exStyle = getWindowExStyle(window); if (window->monitor) { GLFWvidmode mode; // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor // video mode has been picked in _glfwSetVideoModeWin32 _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); _glfwPlatformGetVideoMode(window->monitor, &mode); fullWidth = mode.width; fullHeight = mode.height; } else { xpos = CW_USEDEFAULT; ypos = CW_USEDEFAULT; window->win32.maximized = wndconfig->maximized; if (wndconfig->maximized) style |= WS_MAXIMIZE; getFullWindowSize(style, exStyle, wndconfig->width, wndconfig->height, &fullWidth, &fullHeight, USER_DEFAULT_SCREEN_DPI); } wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title); if (!wideTitle) return GLFW_FALSE; window->win32.handle = CreateWindowExW(exStyle, _GLFW_WNDCLASSNAME, wideTitle, style, xpos, ypos, fullWidth, fullHeight, NULL, // No parent window NULL, // No window menu GetModuleHandleW(NULL), NULL); free(wideTitle); if (!window->win32.handle) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create window"); return GLFW_FALSE; } SetPropW(window->win32.handle, L"GLFW", window); if (IsWindows7OrGreater()) { ChangeWindowMessageFilterEx(window->win32.handle, WM_DROPFILES, MSGFLT_ALLOW, NULL); ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYDATA, MSGFLT_ALLOW, NULL); ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); } window->win32.scaleToMonitor = wndconfig->scaleToMonitor; // Adjust window rect to account for DPI scaling of the window frame and // (if enabled) DPI scaling of the content area // This cannot be done until we know what monitor the window was placed on if (!window->monitor) { RECT rect = { 0, 0, wndconfig->width, wndconfig->height }; WINDOWPLACEMENT wp = { sizeof(wp) }; if (wndconfig->scaleToMonitor) { float xscale, yscale; _glfwPlatformGetWindowContentScale(window, &xscale, &yscale); rect.right = (int) (rect.right * xscale); rect.bottom = (int) (rect.bottom * yscale); } ClientToScreen(window->win32.handle, (POINT*) &rect.left); ClientToScreen(window->win32.handle, (POINT*) &rect.right); if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, GetDpiForWindow(window->win32.handle)); } else AdjustWindowRectEx(&rect, style, FALSE, exStyle); // Only update the restored window rect as the window may be maximized GetWindowPlacement(window->win32.handle, &wp); wp.rcNormalPosition = rect; wp.showCmd = SW_HIDE; SetWindowPlacement(window->win32.handle, &wp); } DragAcceptFiles(window->win32.handle, TRUE); if (fbconfig->transparent) { updateFramebufferTransparency(window); window->win32.transparent = GLFW_TRUE; } return GLFW_TRUE; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Registers the GLFW window class // GLFWbool _glfwRegisterWindowClassWin32(void) { WNDCLASSEXW wc; ZeroMemory(&wc, sizeof(wc)); wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC) windowProc; wc.hInstance = GetModuleHandleW(NULL); wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.lpszClassName = _GLFW_WNDCLASSNAME; // Load user-provided icon if available wc.hIcon = LoadImageW(GetModuleHandleW(NULL), L"GLFW_ICON", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); if (!wc.hIcon) { // No user-provided icon found, load default icon wc.hIcon = LoadImageW(NULL, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); } if (!RegisterClassExW(&wc)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to register window class"); return GLFW_FALSE; } return GLFW_TRUE; } // Unregisters the GLFW window class // void _glfwUnregisterWindowClassWin32(void) { UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL)); } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { if (!createNativeWindow(window, wndconfig, fbconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) { if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { if (!_glfwInitWGL()) return GLFW_FALSE; if (!_glfwCreateContextWGL(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) { if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { if (!_glfwInitOSMesa()) return GLFW_FALSE; if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } } if (window->monitor) { _glfwPlatformShowWindow(window); _glfwPlatformFocusWindow(window); acquireMonitor(window); fitToMonitor(window); } return GLFW_TRUE; } void _glfwPlatformDestroyWindow(_GLFWwindow* window) { if (window->monitor) releaseMonitor(window); if (window->context.destroy) window->context.destroy(window); if (_glfw.win32.disabledCursorWindow == window) _glfw.win32.disabledCursorWindow = NULL; if (window->win32.handle) { RemovePropW(window->win32.handle, L"GLFW"); DestroyWindow(window->win32.handle); window->win32.handle = NULL; } if (window->win32.bigIcon) DestroyIcon(window->win32.bigIcon); if (window->win32.smallIcon) DestroyIcon(window->win32.smallIcon); } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { WCHAR* wideTitle = _glfwCreateWideStringFromUTF8Win32(title); if (!wideTitle) return; SetWindowTextW(window->win32.handle, wideTitle); free(wideTitle); } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images) { HICON bigIcon = NULL, smallIcon = NULL; if (count) { const GLFWimage* bigImage = chooseImage(count, images, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); const GLFWimage* smallImage = chooseImage(count, images, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); bigIcon = createIcon(bigImage, 0, 0, GLFW_TRUE); smallIcon = createIcon(smallImage, 0, 0, GLFW_TRUE); } else { bigIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICON); smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM); } SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon); SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon); if (window->win32.bigIcon) DestroyIcon(window->win32.bigIcon); if (window->win32.smallIcon) DestroyIcon(window->win32.smallIcon); if (count) { window->win32.bigIcon = bigIcon; window->win32.smallIcon = smallIcon; } } void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { POINT pos = { 0, 0 }; ClientToScreen(window->win32.handle, &pos); if (xpos) *xpos = pos.x; if (ypos) *ypos = pos.y; } void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) { RECT rect = { xpos, ypos, xpos, ypos }; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); } else { AdjustWindowRectEx(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window)); } SetWindowPos(window->win32.handle, NULL, rect.left, rect.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE); } void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { RECT area; GetClientRect(window->win32.handle, &area); if (width) *width = area.right; if (height) *height = area.bottom; } void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { if (window->monitor) { if (window->monitor->window == window) { acquireMonitor(window); fitToMonitor(window); } } else { RECT rect = { 0, 0, width, height }; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); } else { AdjustWindowRectEx(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window)); } SetWindowPos(window->win32.handle, HWND_TOP, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER); } } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { RECT area; if ((minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) && (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)) { return; } GetWindowRect(window->win32.handle, &area); MoveWindow(window->win32.handle, area.left, area.top, area.right - area.left, area.bottom - area.top, TRUE); } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom) { RECT area; if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE) return; GetWindowRect(window->win32.handle, &area); applyAspectRatio(window, WMSZ_BOTTOMRIGHT, &area); MoveWindow(window->win32.handle, area.left, area.top, area.right - area.left, area.bottom - area.top, TRUE); } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { _glfwPlatformGetWindowSize(window, width, height); } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { RECT rect; int width, height; _glfwPlatformGetWindowSize(window, &width, &height); SetRect(&rect, 0, 0, width, height); if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); } else { AdjustWindowRectEx(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window)); } if (left) *left = -rect.left; if (top) *top = -rect.top; if (right) *right = rect.right - width; if (bottom) *bottom = rect.bottom - height; } void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale) { const HANDLE handle = MonitorFromWindow(window->win32.handle, MONITOR_DEFAULTTONEAREST); _glfwGetMonitorContentScaleWin32(handle, xscale, yscale); } void _glfwPlatformIconifyWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_MINIMIZE); } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_RESTORE); } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_MAXIMIZE); } void _glfwPlatformShowWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_SHOWNA); } void _glfwPlatformHideWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_HIDE); } void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { FlashWindow(window->win32.handle, TRUE); } void _glfwPlatformFocusWindow(_GLFWwindow* window) { BringWindowToTop(window->win32.handle); SetForegroundWindow(window->win32.handle); SetFocus(window->win32.handle); } void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate) { if (window->monitor == monitor) { if (monitor) { if (monitor->window == window) { acquireMonitor(window); fitToMonitor(window); } } else { RECT rect = { xpos, ypos, xpos + width, ypos + height }; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); } else { AdjustWindowRectEx(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window)); } SetWindowPos(window->win32.handle, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOCOPYBITS | SWP_NOACTIVATE | SWP_NOZORDER); } return; } if (window->monitor) releaseMonitor(window); _glfwInputWindowMonitor(window, monitor); if (window->monitor) { MONITORINFO mi = { sizeof(mi) }; UINT flags = SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS; if (window->decorated) { DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE); style &= ~WS_OVERLAPPEDWINDOW; style |= getWindowStyle(window); SetWindowLongW(window->win32.handle, GWL_STYLE, style); flags |= SWP_FRAMECHANGED; } acquireMonitor(window); GetMonitorInfo(window->monitor->win32.handle, &mi); SetWindowPos(window->win32.handle, HWND_TOPMOST, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top, flags); } else { HWND after; RECT rect = { xpos, ypos, xpos + width, ypos + height }; DWORD style = GetWindowLongW(window->win32.handle, GWL_STYLE); UINT flags = SWP_NOACTIVATE | SWP_NOCOPYBITS; if (window->decorated) { style &= ~WS_POPUP; style |= getWindowStyle(window); SetWindowLongW(window->win32.handle, GWL_STYLE, style); flags |= SWP_FRAMECHANGED; } if (window->floating) after = HWND_TOPMOST; else after = HWND_NOTOPMOST; if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { AdjustWindowRectExForDpi(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window), GetDpiForWindow(window->win32.handle)); } else { AdjustWindowRectEx(&rect, getWindowStyle(window), FALSE, getWindowExStyle(window)); } SetWindowPos(window->win32.handle, after, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, flags); } } int _glfwPlatformWindowFocused(_GLFWwindow* window) { return window->win32.handle == GetActiveWindow(); } int _glfwPlatformWindowIconified(_GLFWwindow* window) { return IsIconic(window->win32.handle); } int _glfwPlatformWindowVisible(_GLFWwindow* window) { return IsWindowVisible(window->win32.handle); } int _glfwPlatformWindowMaximized(_GLFWwindow* window) { return IsZoomed(window->win32.handle); } int _glfwPlatformWindowHovered(_GLFWwindow* window) { return cursorInContentArea(window); } int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { BOOL enabled; if (!window->win32.transparent) return GLFW_FALSE; if (!IsWindowsVistaOrGreater()) return GLFW_FALSE; return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; } void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { updateWindowStyles(window); } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { updateWindowStyles(window); } void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { const HWND after = enabled ? HWND_TOPMOST : HWND_NOTOPMOST; SetWindowPos(window->win32.handle, after, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { BYTE alpha; DWORD flags; if ((GetWindowLongW(window->win32.handle, GWL_EXSTYLE) & WS_EX_LAYERED) && GetLayeredWindowAttributes(window->win32.handle, NULL, &alpha, &flags)) { if (flags & LWA_ALPHA) return alpha / 255.f; } return 1.f; } void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { if (opacity < 1.f) { const BYTE alpha = (BYTE) (255 * opacity); DWORD style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); style |= WS_EX_LAYERED; SetWindowLongW(window->win32.handle, GWL_EXSTYLE, style); SetLayeredWindowAttributes(window->win32.handle, 0, alpha, LWA_ALPHA); } else { DWORD style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); style &= ~WS_EX_LAYERED; SetWindowLongW(window->win32.handle, GWL_EXSTYLE, style); } } void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled) { if (_glfw.win32.disabledCursorWindow != window) return; if (enabled) enableRawMouseMotion(window); else disableRawMouseMotion(window); } GLFWbool _glfwPlatformRawMouseMotionSupported(void) { return GLFW_TRUE; } void _glfwPlatformPollEvents(void) { MSG msg; HWND handle; _GLFWwindow* window; while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { // NOTE: While GLFW does not itself post WM_QUIT, other processes // may post it to this one, for example Task Manager // HACK: Treat WM_QUIT as a close on all windows window = _glfw.windowListHead; while (window) { _glfwInputWindowCloseRequest(window); window = window->next; } } else { TranslateMessage(&msg); DispatchMessageW(&msg); } } // HACK: Release modifier keys that the system did not emit KEYUP for // NOTE: Shift keys on Windows tend to "stick" when both are pressed as // no key up message is generated by the first key release // NOTE: Windows key is not reported as released by the Win+V hotkey // Other Win hotkeys are handled implicitly by _glfwInputWindowFocus // because they change the input focus // NOTE: The other half of this is in the WM_*KEY* handler in windowProc handle = GetActiveWindow(); if (handle) { window = GetPropW(handle, L"GLFW"); if (window) { int i; const int keys[4][2] = { { VK_LSHIFT, GLFW_KEY_LEFT_SHIFT }, { VK_RSHIFT, GLFW_KEY_RIGHT_SHIFT }, { VK_LWIN, GLFW_KEY_LEFT_SUPER }, { VK_RWIN, GLFW_KEY_RIGHT_SUPER } }; for (i = 0; i < 4; i++) { const int vk = keys[i][0]; const int key = keys[i][1]; const int scancode = _glfw.win32.scancodes[key]; if ((GetKeyState(vk) & 0x8000)) continue; if (window->keys[key] != GLFW_PRESS) continue; _glfwInputKey(window, key, scancode, GLFW_RELEASE, getKeyMods()); } } } window = _glfw.win32.disabledCursorWindow; if (window) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); // NOTE: Re-center the cursor only if it has moved since the last call, // to avoid breaking glfwWaitEvents with WM_MOUSEMOVE if (window->win32.lastCursorPosX != width / 2 || window->win32.lastCursorPosY != height / 2) { _glfwPlatformSetCursorPos(window, width / 2, height / 2); } } } void _glfwPlatformWaitEvents(void) { WaitMessage(); _glfwPlatformPollEvents(); } void _glfwPlatformWaitEventsTimeout(double timeout) { MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLEVENTS); _glfwPlatformPollEvents(); } void _glfwPlatformPostEmptyEvent(void) { PostMessage(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0); } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { POINT pos; if (GetCursorPos(&pos)) { ScreenToClient(window->win32.handle, &pos); if (xpos) *xpos = pos.x; if (ypos) *ypos = pos.y; } } void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos) { POINT pos = { (int) xpos, (int) ypos }; // Store the new position so it can be recognized later window->win32.lastCursorPosX = pos.x; window->win32.lastCursorPosY = pos.y; ClientToScreen(window->win32.handle, &pos); SetCursorPos(pos.x, pos.y); } void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { if (mode == GLFW_CURSOR_DISABLED) { if (_glfwPlatformWindowFocused(window)) disableCursor(window); } else if (_glfw.win32.disabledCursorWindow == window) enableCursor(window); else if (cursorInContentArea(window)) updateCursorImage(window); } const char* _glfwPlatformGetScancodeName(int scancode) { if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) || _glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); return NULL; } return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]]; } int _glfwPlatformGetKeyScancode(int key) { return _glfw.win32.scancodes[key]; } int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) { cursor->win32.handle = (HCURSOR) createIcon(image, xhot, yhot, GLFW_FALSE); if (!cursor->win32.handle) return GLFW_FALSE; return GLFW_TRUE; } int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { int id = 0; if (shape == GLFW_ARROW_CURSOR) id = OCR_NORMAL; else if (shape == GLFW_IBEAM_CURSOR) id = OCR_IBEAM; else if (shape == GLFW_CROSSHAIR_CURSOR) id = OCR_CROSS; else if (shape == GLFW_HAND_CURSOR) id = OCR_HAND; else if (shape == GLFW_HRESIZE_CURSOR) id = OCR_SIZEWE; else if (shape == GLFW_VRESIZE_CURSOR) id = OCR_SIZENS; else return GLFW_FALSE; cursor->win32.handle = LoadImageW(NULL, MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED); if (!cursor->win32.handle) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to create standard cursor"); return GLFW_FALSE; } return GLFW_TRUE; } void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) { if (cursor->win32.handle) DestroyIcon((HICON) cursor->win32.handle); } void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { if (cursorInContentArea(window)) updateCursorImage(window); } void _glfwPlatformSetClipboardString(const char* string) { int characterCount; HANDLE object; WCHAR* buffer; characterCount = MultiByteToWideChar(CP_UTF8, 0, string, -1, NULL, 0); if (!characterCount) return; object = GlobalAlloc(GMEM_MOVEABLE, characterCount * sizeof(WCHAR)); if (!object) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to allocate global handle for clipboard"); return; } buffer = GlobalLock(object); if (!buffer) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to lock global handle"); GlobalFree(object); return; } MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, characterCount); GlobalUnlock(object); if (!OpenClipboard(_glfw.win32.helperWindowHandle)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); GlobalFree(object); return; } EmptyClipboard(); SetClipboardData(CF_UNICODETEXT, object); CloseClipboard(); } const char* _glfwPlatformGetClipboardString(void) { HANDLE object; WCHAR* buffer; if (!OpenClipboard(_glfw.win32.helperWindowHandle)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); return NULL; } object = GetClipboardData(CF_UNICODETEXT); if (!object) { _glfwInputErrorWin32(GLFW_FORMAT_UNAVAILABLE, "Win32: Failed to convert clipboard to string"); CloseClipboard(); return NULL; } buffer = GlobalLock(object); if (!buffer) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to lock global handle"); CloseClipboard(); return NULL; } free(_glfw.win32.clipboardString); _glfw.win32.clipboardString = _glfwCreateUTF8FromWideStringWin32(buffer); GlobalUnlock(object); CloseClipboard(); return _glfw.win32.clipboardString; } void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) { if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_win32_surface) return; extensions[0] = "VK_KHR_surface"; extensions[1] = "VK_KHR_win32_surface"; } int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin32PresentationSupportKHR = (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR) vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); if (!vkGetPhysicalDeviceWin32PresentationSupportKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "Win32: Vulkan instance missing VK_KHR_win32_surface extension"); return GLFW_FALSE; } return vkGetPhysicalDeviceWin32PresentationSupportKHR(device, queuefamily); } VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { VkResult err; VkWin32SurfaceCreateInfoKHR sci; PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; vkCreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR) vkGetInstanceProcAddr(instance, "vkCreateWin32SurfaceKHR"); if (!vkCreateWin32SurfaceKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "Win32: Vulkan instance missing VK_KHR_win32_surface extension"); return VK_ERROR_EXTENSION_NOT_PRESENT; } memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; sci.hinstance = GetModuleHandle(NULL); sci.hwnd = window->win32.handle; err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface); if (err) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create Vulkan surface: %s", _glfwGetVulkanResultString(err)); } return err; } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return window->win32.handle; } ================================================ FILE: thirdparty/glfw/src/window.c ================================================ //======================================================================== // GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // Copyright (c) 2012 Torsten Walluhn // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // Please use C89 style variable declarations in this file because VS 2010 //======================================================================== #include "internal.h" #include #include #include #include ////////////////////////////////////////////////////////////////////////// ////// GLFW event API ////// ////////////////////////////////////////////////////////////////////////// // Notifies shared code that a window has lost or received input focus // void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused) { if (window->callbacks.focus) window->callbacks.focus((GLFWwindow*) window, focused); if (!focused) { int key, button; for (key = 0; key <= GLFW_KEY_LAST; key++) { if (window->keys[key] == GLFW_PRESS) { const int scancode = _glfwPlatformGetKeyScancode(key); _glfwInputKey(window, key, scancode, GLFW_RELEASE, 0); } } for (button = 0; button <= GLFW_MOUSE_BUTTON_LAST; button++) { if (window->mouseButtons[button] == GLFW_PRESS) _glfwInputMouseClick(window, button, GLFW_RELEASE, 0); } } } // Notifies shared code that a window has moved // The position is specified in content area relative screen coordinates // void _glfwInputWindowPos(_GLFWwindow* window, int x, int y) { if (window->callbacks.pos) window->callbacks.pos((GLFWwindow*) window, x, y); } // Notifies shared code that a window has been resized // The size is specified in screen coordinates // void _glfwInputWindowSize(_GLFWwindow* window, int width, int height) { if (window->callbacks.size) window->callbacks.size((GLFWwindow*) window, width, height); } // Notifies shared code that a window has been iconified or restored // void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified) { if (window->callbacks.iconify) window->callbacks.iconify((GLFWwindow*) window, iconified); } // Notifies shared code that a window has been maximized or restored // void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized) { if (window->callbacks.maximize) window->callbacks.maximize((GLFWwindow*) window, maximized); } // Notifies shared code that a window framebuffer has been resized // The size is specified in pixels // void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height) { if (window->callbacks.fbsize) window->callbacks.fbsize((GLFWwindow*) window, width, height); } // Notifies shared code that a window content scale has changed // The scale is specified as the ratio between the current and default DPI // void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale) { if (window->callbacks.scale) window->callbacks.scale((GLFWwindow*) window, xscale, yscale); } // Notifies shared code that the window contents needs updating // void _glfwInputWindowDamage(_GLFWwindow* window) { if (window->callbacks.refresh) window->callbacks.refresh((GLFWwindow*) window); } // Notifies shared code that the user wishes to close a window // void _glfwInputWindowCloseRequest(_GLFWwindow* window) { window->shouldClose = GLFW_TRUE; if (window->callbacks.close) window->callbacks.close((GLFWwindow*) window); } // Notifies shared code that a window has changed its desired monitor // void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor) { window->monitor = monitor; } ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share) { _GLFWfbconfig fbconfig; _GLFWctxconfig ctxconfig; _GLFWwndconfig wndconfig; _GLFWwindow* window; assert(title != NULL); assert(width >= 0); assert(height >= 0); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (width <= 0 || height <= 0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid window size %ix%i", width, height); return NULL; } fbconfig = _glfw.hints.framebuffer; ctxconfig = _glfw.hints.context; wndconfig = _glfw.hints.window; wndconfig.width = width; wndconfig.height = height; wndconfig.title = title; ctxconfig.share = (_GLFWwindow*) share; if (!_glfwIsValidContextConfig(&ctxconfig)) return NULL; window = calloc(1, sizeof(_GLFWwindow)); window->next = _glfw.windowListHead; _glfw.windowListHead = window; window->videoMode.width = width; window->videoMode.height = height; window->videoMode.redBits = fbconfig.redBits; window->videoMode.greenBits = fbconfig.greenBits; window->videoMode.blueBits = fbconfig.blueBits; window->videoMode.refreshRate = _glfw.hints.refreshRate; window->monitor = (_GLFWmonitor*) monitor; window->resizable = wndconfig.resizable; window->decorated = wndconfig.decorated; window->autoIconify = wndconfig.autoIconify; window->floating = wndconfig.floating; window->focusOnShow = wndconfig.focusOnShow; window->cursorMode = GLFW_CURSOR_NORMAL; window->minwidth = GLFW_DONT_CARE; window->minheight = GLFW_DONT_CARE; window->maxwidth = GLFW_DONT_CARE; window->maxheight = GLFW_DONT_CARE; window->numer = GLFW_DONT_CARE; window->denom = GLFW_DONT_CARE; // Open the actual window and create its context if (!_glfwPlatformCreateWindow(window, &wndconfig, &ctxconfig, &fbconfig)) { glfwDestroyWindow((GLFWwindow*) window); return NULL; } if (ctxconfig.client != GLFW_NO_API) { if (!_glfwRefreshContextAttribs(window, &ctxconfig)) { glfwDestroyWindow((GLFWwindow*) window); return NULL; } } if (window->monitor) { if (wndconfig.centerCursor) _glfwCenterCursorInContentArea(window); } else { if (wndconfig.visible) { _glfwPlatformShowWindow(window); if (wndconfig.focused) _glfwPlatformFocusWindow(window); } } return (GLFWwindow*) window; } void glfwDefaultWindowHints(void) { _GLFW_REQUIRE_INIT(); // The default is OpenGL with minimum version 1.0 memset(&_glfw.hints.context, 0, sizeof(_glfw.hints.context)); _glfw.hints.context.client = GLFW_OPENGL_API; _glfw.hints.context.source = GLFW_NATIVE_CONTEXT_API; _glfw.hints.context.major = 1; _glfw.hints.context.minor = 0; // The default is a focused, visible, resizable window with decorations memset(&_glfw.hints.window, 0, sizeof(_glfw.hints.window)); _glfw.hints.window.resizable = GLFW_TRUE; _glfw.hints.window.visible = GLFW_TRUE; _glfw.hints.window.decorated = GLFW_TRUE; _glfw.hints.window.focused = GLFW_TRUE; _glfw.hints.window.autoIconify = GLFW_TRUE; _glfw.hints.window.centerCursor = GLFW_TRUE; _glfw.hints.window.focusOnShow = GLFW_TRUE; // The default is 24 bits of color, 24 bits of depth and 8 bits of stencil, // double buffered memset(&_glfw.hints.framebuffer, 0, sizeof(_glfw.hints.framebuffer)); _glfw.hints.framebuffer.redBits = 8; _glfw.hints.framebuffer.greenBits = 8; _glfw.hints.framebuffer.blueBits = 8; _glfw.hints.framebuffer.alphaBits = 8; _glfw.hints.framebuffer.depthBits = 24; _glfw.hints.framebuffer.stencilBits = 8; _glfw.hints.framebuffer.doublebuffer = GLFW_TRUE; // The default is to select the highest available refresh rate _glfw.hints.refreshRate = GLFW_DONT_CARE; // The default is to use full Retina resolution framebuffers _glfw.hints.window.ns.retina = GLFW_TRUE; } GLFWAPI void glfwWindowHint(int hint, int value) { _GLFW_REQUIRE_INIT(); switch (hint) { case GLFW_RED_BITS: _glfw.hints.framebuffer.redBits = value; return; case GLFW_GREEN_BITS: _glfw.hints.framebuffer.greenBits = value; return; case GLFW_BLUE_BITS: _glfw.hints.framebuffer.blueBits = value; return; case GLFW_ALPHA_BITS: _glfw.hints.framebuffer.alphaBits = value; return; case GLFW_DEPTH_BITS: _glfw.hints.framebuffer.depthBits = value; return; case GLFW_STENCIL_BITS: _glfw.hints.framebuffer.stencilBits = value; return; case GLFW_ACCUM_RED_BITS: _glfw.hints.framebuffer.accumRedBits = value; return; case GLFW_ACCUM_GREEN_BITS: _glfw.hints.framebuffer.accumGreenBits = value; return; case GLFW_ACCUM_BLUE_BITS: _glfw.hints.framebuffer.accumBlueBits = value; return; case GLFW_ACCUM_ALPHA_BITS: _glfw.hints.framebuffer.accumAlphaBits = value; return; case GLFW_AUX_BUFFERS: _glfw.hints.framebuffer.auxBuffers = value; return; case GLFW_STEREO: _glfw.hints.framebuffer.stereo = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_DOUBLEBUFFER: _glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_TRANSPARENT_FRAMEBUFFER: _glfw.hints.framebuffer.transparent = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_SAMPLES: _glfw.hints.framebuffer.samples = value; return; case GLFW_SRGB_CAPABLE: _glfw.hints.framebuffer.sRGB = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_RESIZABLE: _glfw.hints.window.resizable = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_DECORATED: _glfw.hints.window.decorated = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_FOCUSED: _glfw.hints.window.focused = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_AUTO_ICONIFY: _glfw.hints.window.autoIconify = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_FLOATING: _glfw.hints.window.floating = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_MAXIMIZED: _glfw.hints.window.maximized = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_VISIBLE: _glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_COCOA_RETINA_FRAMEBUFFER: _glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_COCOA_GRAPHICS_SWITCHING: _glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_SCALE_TO_MONITOR: _glfw.hints.window.scaleToMonitor = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_CENTER_CURSOR: _glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_FOCUS_ON_SHOW: _glfw.hints.window.focusOnShow = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_CLIENT_API: _glfw.hints.context.client = value; return; case GLFW_CONTEXT_CREATION_API: _glfw.hints.context.source = value; return; case GLFW_CONTEXT_VERSION_MAJOR: _glfw.hints.context.major = value; return; case GLFW_CONTEXT_VERSION_MINOR: _glfw.hints.context.minor = value; return; case GLFW_CONTEXT_ROBUSTNESS: _glfw.hints.context.robustness = value; return; case GLFW_OPENGL_FORWARD_COMPAT: _glfw.hints.context.forward = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_OPENGL_DEBUG_CONTEXT: _glfw.hints.context.debug = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_CONTEXT_NO_ERROR: _glfw.hints.context.noerror = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_OPENGL_PROFILE: _glfw.hints.context.profile = value; return; case GLFW_CONTEXT_RELEASE_BEHAVIOR: _glfw.hints.context.release = value; return; case GLFW_REFRESH_RATE: _glfw.hints.refreshRate = value; return; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint 0x%08X", hint); } GLFWAPI void glfwWindowHintString(int hint, const char* value) { assert(value != NULL); _GLFW_REQUIRE_INIT(); switch (hint) { case GLFW_COCOA_FRAME_NAME: strncpy(_glfw.hints.window.ns.frameName, value, sizeof(_glfw.hints.window.ns.frameName) - 1); return; case GLFW_X11_CLASS_NAME: strncpy(_glfw.hints.window.x11.className, value, sizeof(_glfw.hints.window.x11.className) - 1); return; case GLFW_X11_INSTANCE_NAME: strncpy(_glfw.hints.window.x11.instanceName, value, sizeof(_glfw.hints.window.x11.instanceName) - 1); return; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint); } GLFWAPI void glfwDestroyWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT(); // Allow closing of NULL (to match the behavior of free) if (window == NULL) return; // Clear all callbacks to avoid exposing a half torn-down window object memset(&window->callbacks, 0, sizeof(window->callbacks)); // The window's context must not be current on another thread when the // window is destroyed if (window == _glfwPlatformGetTls(&_glfw.contextSlot)) glfwMakeContextCurrent(NULL); _glfwPlatformDestroyWindow(window); // Unlink window from global linked list { _GLFWwindow** prev = &_glfw.windowListHead; while (*prev != window) prev = &((*prev)->next); *prev = window->next; } free(window); } GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(0); return window->shouldClose; } GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* handle, int value) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); window->shouldClose = value; } GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); assert(title != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformSetWindowTitle(window, title); } GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle, int count, const GLFWimage* images) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); assert(count >= 0); assert(count == 0 || images != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformSetWindowIcon(window, count, images); } GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); if (xpos) *xpos = 0; if (ypos) *ypos = 0; _GLFW_REQUIRE_INIT(); _glfwPlatformGetWindowPos(window, xpos, ypos); } GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (window->monitor) return; _glfwPlatformSetWindowPos(window, xpos, ypos); } GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); if (width) *width = 0; if (height) *height = 0; _GLFW_REQUIRE_INIT(); _glfwPlatformGetWindowSize(window, width, height); } GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); assert(width >= 0); assert(height >= 0); _GLFW_REQUIRE_INIT(); window->videoMode.width = width; window->videoMode.height = height; _glfwPlatformSetWindowSize(window, width, height); } GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle, int minwidth, int minheight, int maxwidth, int maxheight) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (minwidth != GLFW_DONT_CARE && minheight != GLFW_DONT_CARE) { if (minwidth < 0 || minheight < 0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid window minimum size %ix%i", minwidth, minheight); return; } } if (maxwidth != GLFW_DONT_CARE && maxheight != GLFW_DONT_CARE) { if (maxwidth < 0 || maxheight < 0 || maxwidth < minwidth || maxheight < minheight) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid window maximum size %ix%i", maxwidth, maxheight); return; } } window->minwidth = minwidth; window->minheight = minheight; window->maxwidth = maxwidth; window->maxheight = maxheight; if (window->monitor || !window->resizable) return; _glfwPlatformSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); } GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); assert(numer != 0); assert(denom != 0); _GLFW_REQUIRE_INIT(); if (numer != GLFW_DONT_CARE && denom != GLFW_DONT_CARE) { if (numer <= 0 || denom <= 0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid window aspect ratio %i:%i", numer, denom); return; } } window->numer = numer; window->denom = denom; if (window->monitor || !window->resizable) return; _glfwPlatformSetWindowAspectRatio(window, numer, denom); } GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); if (width) *width = 0; if (height) *height = 0; _GLFW_REQUIRE_INIT(); _glfwPlatformGetFramebufferSize(window, width, height); } GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle, int* left, int* top, int* right, int* bottom) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); if (left) *left = 0; if (top) *top = 0; if (right) *right = 0; if (bottom) *bottom = 0; _GLFW_REQUIRE_INIT(); _glfwPlatformGetWindowFrameSize(window, left, top, right, bottom); } GLFWAPI void glfwGetWindowContentScale(GLFWwindow* handle, float* xscale, float* yscale) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); if (xscale) *xscale = 0.f; if (yscale) *yscale = 0.f; _GLFW_REQUIRE_INIT(); _glfwPlatformGetWindowContentScale(window, xscale, yscale); } GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(1.f); return _glfwPlatformGetWindowOpacity(window); } GLFWAPI void glfwSetWindowOpacity(GLFWwindow* handle, float opacity) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); assert(opacity == opacity); assert(opacity >= 0.f); assert(opacity <= 1.f); _GLFW_REQUIRE_INIT(); if (opacity != opacity || opacity < 0.f || opacity > 1.f) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid window opacity %f", opacity); return; } _glfwPlatformSetWindowOpacity(window, opacity); } GLFWAPI void glfwIconifyWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformIconifyWindow(window); } GLFWAPI void glfwRestoreWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformRestoreWindow(window); } GLFWAPI void glfwMaximizeWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (window->monitor) return; _glfwPlatformMaximizeWindow(window); } GLFWAPI void glfwShowWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (window->monitor) return; _glfwPlatformShowWindow(window); if (window->focusOnShow) _glfwPlatformFocusWindow(window); } GLFWAPI void glfwRequestWindowAttention(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformRequestWindowAttention(window); } GLFWAPI void glfwHideWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); if (window->monitor) return; _glfwPlatformHideWindow(window); } GLFWAPI void glfwFocusWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); _glfwPlatformFocusWindow(window); } GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(0); switch (attrib) { case GLFW_FOCUSED: return _glfwPlatformWindowFocused(window); case GLFW_ICONIFIED: return _glfwPlatformWindowIconified(window); case GLFW_VISIBLE: return _glfwPlatformWindowVisible(window); case GLFW_MAXIMIZED: return _glfwPlatformWindowMaximized(window); case GLFW_HOVERED: return _glfwPlatformWindowHovered(window); case GLFW_FOCUS_ON_SHOW: return window->focusOnShow; case GLFW_TRANSPARENT_FRAMEBUFFER: return _glfwPlatformFramebufferTransparent(window); case GLFW_RESIZABLE: return window->resizable; case GLFW_DECORATED: return window->decorated; case GLFW_FLOATING: return window->floating; case GLFW_AUTO_ICONIFY: return window->autoIconify; case GLFW_CLIENT_API: return window->context.client; case GLFW_CONTEXT_CREATION_API: return window->context.source; case GLFW_CONTEXT_VERSION_MAJOR: return window->context.major; case GLFW_CONTEXT_VERSION_MINOR: return window->context.minor; case GLFW_CONTEXT_REVISION: return window->context.revision; case GLFW_CONTEXT_ROBUSTNESS: return window->context.robustness; case GLFW_OPENGL_FORWARD_COMPAT: return window->context.forward; case GLFW_OPENGL_DEBUG_CONTEXT: return window->context.debug; case GLFW_OPENGL_PROFILE: return window->context.profile; case GLFW_CONTEXT_RELEASE_BEHAVIOR: return window->context.release; case GLFW_CONTEXT_NO_ERROR: return window->context.noerror; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib); return 0; } GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); value = value ? GLFW_TRUE : GLFW_FALSE; if (attrib == GLFW_AUTO_ICONIFY) window->autoIconify = value; else if (attrib == GLFW_RESIZABLE) { if (window->resizable == value) return; window->resizable = value; if (!window->monitor) _glfwPlatformSetWindowResizable(window, value); } else if (attrib == GLFW_DECORATED) { if (window->decorated == value) return; window->decorated = value; if (!window->monitor) _glfwPlatformSetWindowDecorated(window, value); } else if (attrib == GLFW_FLOATING) { if (window->floating == value) return; window->floating = value; if (!window->monitor) _glfwPlatformSetWindowFloating(window, value); } else if (attrib == GLFW_FOCUS_ON_SHOW) window->focusOnShow = value; else _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib); } GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return (GLFWmonitor*) window->monitor; } GLFWAPI void glfwSetWindowMonitor(GLFWwindow* wh, GLFWmonitor* mh, int xpos, int ypos, int width, int height, int refreshRate) { _GLFWwindow* window = (_GLFWwindow*) wh; _GLFWmonitor* monitor = (_GLFWmonitor*) mh; assert(window != NULL); assert(width >= 0); assert(height >= 0); _GLFW_REQUIRE_INIT(); if (width <= 0 || height <= 0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid window size %ix%i", width, height); return; } if (refreshRate < 0 && refreshRate != GLFW_DONT_CARE) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid refresh rate %i", refreshRate); return; } window->videoMode.width = width; window->videoMode.height = height; window->videoMode.refreshRate = refreshRate; _glfwPlatformSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate); } GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT(); window->userPointer = pointer; } GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return window->userPointer; } GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle, GLFWwindowposfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.pos, cbfun); return cbfun; } GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle, GLFWwindowsizefun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.size, cbfun); return cbfun; } GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle, GLFWwindowclosefun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.close, cbfun); return cbfun; } GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle, GLFWwindowrefreshfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.refresh, cbfun); return cbfun; } GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle, GLFWwindowfocusfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.focus, cbfun); return cbfun; } GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle, GLFWwindowiconifyfun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.iconify, cbfun); return cbfun; } GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* handle, GLFWwindowmaximizefun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.maximize, cbfun); return cbfun; } GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle, GLFWframebuffersizefun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.fbsize, cbfun); return cbfun; } GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* handle, GLFWwindowcontentscalefun cbfun) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_SWAP_POINTERS(window->callbacks.scale, cbfun); return cbfun; } GLFWAPI void glfwPollEvents(void) { _GLFW_REQUIRE_INIT(); _glfwPlatformPollEvents(); } GLFWAPI void glfwWaitEvents(void) { _GLFW_REQUIRE_INIT(); _glfwPlatformWaitEvents(); } GLFWAPI void glfwWaitEventsTimeout(double timeout) { _GLFW_REQUIRE_INIT(); assert(timeout == timeout); assert(timeout >= 0.0); assert(timeout <= DBL_MAX); if (timeout != timeout || timeout < 0.0 || timeout > DBL_MAX) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid time %f", timeout); return; } _glfwPlatformWaitEventsTimeout(timeout); } GLFWAPI void glfwPostEmptyEvent(void) { _GLFW_REQUIRE_INIT(); _glfwPlatformPostEmptyEvent(); } ================================================ FILE: thirdparty/glfw/src/wl_init.c ================================================ //======================================================================== // GLFW 3.3 Wayland - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include #include #include #include #include #include #include static inline int min(int n1, int n2) { return n1 < n2 ? n1 : n2; } static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, int* which) { int focus; _GLFWwindow* window = _glfw.windowListHead; if (!which) which = &focus; while (window) { if (surface == window->wl.decorations.top.surface) { *which = topDecoration; break; } if (surface == window->wl.decorations.left.surface) { *which = leftDecoration; break; } if (surface == window->wl.decorations.right.surface) { *which = rightDecoration; break; } if (surface == window->wl.decorations.bottom.surface) { *which = bottomDecoration; break; } window = window->next; } return window; } static void pointerHandleEnter(void* data, struct wl_pointer* pointer, uint32_t serial, struct wl_surface* surface, wl_fixed_t sx, wl_fixed_t sy) { // Happens in the case we just destroyed the surface. if (!surface) return; int focus = 0; _GLFWwindow* window = wl_surface_get_user_data(surface); if (!window) { window = findWindowFromDecorationSurface(surface, &focus); if (!window) return; } window->wl.decorations.focus = focus; _glfw.wl.serial = serial; _glfw.wl.pointerFocus = window; window->wl.hovered = GLFW_TRUE; _glfwPlatformSetCursor(window, window->wl.currentCursor); _glfwInputCursorEnter(window, GLFW_TRUE); } static void pointerHandleLeave(void* data, struct wl_pointer* pointer, uint32_t serial, struct wl_surface* surface) { _GLFWwindow* window = _glfw.wl.pointerFocus; if (!window) return; window->wl.hovered = GLFW_FALSE; _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; _glfwInputCursorEnter(window, GLFW_FALSE); _glfw.wl.cursorPreviousName = NULL; } static void setCursor(_GLFWwindow* window, const char* name) { struct wl_buffer* buffer; struct wl_cursor* cursor; struct wl_cursor_image* image; struct wl_surface* surface = _glfw.wl.cursorSurface; struct wl_cursor_theme* theme = _glfw.wl.cursorTheme; int scale = 1; if (window->wl.scale > 1 && _glfw.wl.cursorThemeHiDPI) { // We only support up to scale=2 for now, since libwayland-cursor // requires us to load a different theme for each size. scale = 2; theme = _glfw.wl.cursorThemeHiDPI; } cursor = wl_cursor_theme_get_cursor(theme, name); if (!cursor) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Standard cursor not found"); return; } // TODO: handle animated cursors too. image = cursor->images[0]; if (!image) return; buffer = wl_cursor_image_get_buffer(image); if (!buffer) return; wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, image->hotspot_x / scale, image->hotspot_y / scale); wl_surface_set_buffer_scale(surface, scale); wl_surface_attach(surface, buffer, 0, 0); wl_surface_damage(surface, 0, 0, image->width, image->height); wl_surface_commit(surface); _glfw.wl.cursorPreviousName = name; } static void pointerHandleMotion(void* data, struct wl_pointer* pointer, uint32_t time, wl_fixed_t sx, wl_fixed_t sy) { _GLFWwindow* window = _glfw.wl.pointerFocus; const char* cursorName = NULL; double x, y; if (!window) return; if (window->cursorMode == GLFW_CURSOR_DISABLED) return; x = wl_fixed_to_double(sx); y = wl_fixed_to_double(sy); switch (window->wl.decorations.focus) { case mainWindow: window->wl.cursorPosX = x; window->wl.cursorPosY = y; _glfwInputCursorPos(window, x, y); _glfw.wl.cursorPreviousName = NULL; return; case topDecoration: if (y < _GLFW_DECORATION_WIDTH) cursorName = "n-resize"; else cursorName = "left_ptr"; break; case leftDecoration: if (y < _GLFW_DECORATION_WIDTH) cursorName = "nw-resize"; else cursorName = "w-resize"; break; case rightDecoration: if (y < _GLFW_DECORATION_WIDTH) cursorName = "ne-resize"; else cursorName = "e-resize"; break; case bottomDecoration: if (x < _GLFW_DECORATION_WIDTH) cursorName = "sw-resize"; else if (x > window->wl.width + _GLFW_DECORATION_WIDTH) cursorName = "se-resize"; else cursorName = "s-resize"; break; default: assert(0); } if (_glfw.wl.cursorPreviousName != cursorName) setCursor(window, cursorName); } static void pointerHandleButton(void* data, struct wl_pointer* pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { _GLFWwindow* window = _glfw.wl.pointerFocus; int glfwButton; // Both xdg-shell and wl_shell use the same values. uint32_t edges = WL_SHELL_SURFACE_RESIZE_NONE; if (!window) return; if (button == BTN_LEFT) { switch (window->wl.decorations.focus) { case mainWindow: break; case topDecoration: if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) edges = WL_SHELL_SURFACE_RESIZE_TOP; else { if (window->wl.xdg.toplevel) xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial); else wl_shell_surface_move(window->wl.shellSurface, _glfw.wl.seat, serial); } break; case leftDecoration: if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT; else edges = WL_SHELL_SURFACE_RESIZE_LEFT; break; case rightDecoration: if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT; else edges = WL_SHELL_SURFACE_RESIZE_RIGHT; break; case bottomDecoration: if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH) edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT; else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH) edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT; else edges = WL_SHELL_SURFACE_RESIZE_BOTTOM; break; default: assert(0); } if (edges != WL_SHELL_SURFACE_RESIZE_NONE) { if (window->wl.xdg.toplevel) xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, serial, edges); else wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat, serial, edges); } } else if (button == BTN_RIGHT) { if (window->wl.decorations.focus != mainWindow && window->wl.xdg.toplevel) { xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, _glfw.wl.seat, serial, window->wl.cursorPosX, window->wl.cursorPosY); return; } } // Don’t pass the button to the user if it was related to a decoration. if (window->wl.decorations.focus != mainWindow) return; _glfw.wl.serial = serial; /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev * codes. */ glfwButton = button - BTN_LEFT; _glfwInputMouseClick(window, glfwButton, state == WL_POINTER_BUTTON_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE, _glfw.wl.xkb.modifiers); } static void pointerHandleAxis(void* data, struct wl_pointer* pointer, uint32_t time, uint32_t axis, wl_fixed_t value) { _GLFWwindow* window = _glfw.wl.pointerFocus; double x = 0.0, y = 0.0; // Wayland scroll events are in pointer motion coordinate space (think two // finger scroll). The factor 10 is commonly used to convert to "scroll // step means 1.0. const double scrollFactor = 1.0 / 10.0; if (!window) return; assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL || axis == WL_POINTER_AXIS_VERTICAL_SCROLL); if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) x = wl_fixed_to_double(value) * scrollFactor; else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) y = wl_fixed_to_double(value) * scrollFactor; _glfwInputScroll(window, x, y); } static const struct wl_pointer_listener pointerListener = { pointerHandleEnter, pointerHandleLeave, pointerHandleMotion, pointerHandleButton, pointerHandleAxis, }; static void keyboardHandleKeymap(void* data, struct wl_keyboard* keyboard, uint32_t format, int fd, uint32_t size) { struct xkb_keymap* keymap; struct xkb_state* state; #ifdef HAVE_XKBCOMMON_COMPOSE_H struct xkb_compose_table* composeTable; struct xkb_compose_state* composeState; #endif char* mapStr; const char* locale; if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { close(fd); return; } mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); if (mapStr == MAP_FAILED) { close(fd); return; } keymap = xkb_keymap_new_from_string(_glfw.wl.xkb.context, mapStr, XKB_KEYMAP_FORMAT_TEXT_V1, 0); munmap(mapStr, size); close(fd); if (!keymap) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to compile keymap"); return; } state = xkb_state_new(keymap); if (!state) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create XKB state"); xkb_keymap_unref(keymap); return; } // Look up the preferred locale, falling back to "C" as default. locale = getenv("LC_ALL"); if (!locale) locale = getenv("LC_CTYPE"); if (!locale) locale = getenv("LANG"); if (!locale) locale = "C"; #ifdef HAVE_XKBCOMMON_COMPOSE_H composeTable = xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); if (composeTable) { composeState = xkb_compose_state_new(composeTable, XKB_COMPOSE_STATE_NO_FLAGS); xkb_compose_table_unref(composeTable); if (composeState) _glfw.wl.xkb.composeState = composeState; else _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create XKB compose state"); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create XKB compose table"); } #endif xkb_keymap_unref(_glfw.wl.xkb.keymap); xkb_state_unref(_glfw.wl.xkb.state); _glfw.wl.xkb.keymap = keymap; _glfw.wl.xkb.state = state; _glfw.wl.xkb.controlMask = 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control"); _glfw.wl.xkb.altMask = 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); _glfw.wl.xkb.shiftMask = 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); _glfw.wl.xkb.superMask = 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); _glfw.wl.xkb.capsLockMask = 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock"); _glfw.wl.xkb.numLockMask = 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2"); } static void keyboardHandleEnter(void* data, struct wl_keyboard* keyboard, uint32_t serial, struct wl_surface* surface, struct wl_array* keys) { // Happens in the case we just destroyed the surface. if (!surface) return; _GLFWwindow* window = wl_surface_get_user_data(surface); if (!window) { window = findWindowFromDecorationSurface(surface, NULL); if (!window) return; } _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = window; _glfwInputWindowFocus(window, GLFW_TRUE); } static void keyboardHandleLeave(void* data, struct wl_keyboard* keyboard, uint32_t serial, struct wl_surface* surface) { _GLFWwindow* window = _glfw.wl.keyboardFocus; if (!window) return; _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, GLFW_FALSE); } static int toGLFWKeyCode(uint32_t key) { if (key < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0])) return _glfw.wl.keycodes[key]; return GLFW_KEY_UNKNOWN; } #ifdef HAVE_XKBCOMMON_COMPOSE_H static xkb_keysym_t composeSymbol(xkb_keysym_t sym) { if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState) return sym; if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym) != XKB_COMPOSE_FEED_ACCEPTED) return sym; switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState)) { case XKB_COMPOSE_COMPOSED: return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState); case XKB_COMPOSE_COMPOSING: case XKB_COMPOSE_CANCELLED: return XKB_KEY_NoSymbol; case XKB_COMPOSE_NOTHING: default: return sym; } } #endif static GLFWbool inputChar(_GLFWwindow* window, uint32_t key) { uint32_t code, numSyms; long cp; const xkb_keysym_t *syms; xkb_keysym_t sym; code = key + 8; numSyms = xkb_state_key_get_syms(_glfw.wl.xkb.state, code, &syms); if (numSyms == 1) { #ifdef HAVE_XKBCOMMON_COMPOSE_H sym = composeSymbol(syms[0]); #else sym = syms[0]; #endif cp = _glfwKeySym2Unicode(sym); if (cp != -1) { const int mods = _glfw.wl.xkb.modifiers; const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); _glfwInputChar(window, cp, mods, plain); } } return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, syms[0]); } static void keyboardHandleKey(void* data, struct wl_keyboard* keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { int keyCode; int action; _GLFWwindow* window = _glfw.wl.keyboardFocus; GLFWbool shouldRepeat; struct itimerspec timer = {}; if (!window) return; keyCode = toGLFWKeyCode(key); action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; _glfw.wl.serial = serial; _glfwInputKey(window, keyCode, key, action, _glfw.wl.xkb.modifiers); if (action == GLFW_PRESS) { shouldRepeat = inputChar(window, key); if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0) { _glfw.wl.keyboardLastKey = keyCode; _glfw.wl.keyboardLastScancode = key; if (_glfw.wl.keyboardRepeatRate > 1) timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate; else timer.it_interval.tv_sec = 1; timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000; timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000; } } timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); } static void keyboardHandleModifiers(void* data, struct wl_keyboard* keyboard, uint32_t serial, uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) { xkb_mod_mask_t mask; unsigned int modifiers = 0; _glfw.wl.serial = serial; if (!_glfw.wl.xkb.keymap) return; xkb_state_update_mask(_glfw.wl.xkb.state, modsDepressed, modsLatched, modsLocked, 0, 0, group); mask = xkb_state_serialize_mods(_glfw.wl.xkb.state, XKB_STATE_MODS_DEPRESSED | XKB_STATE_LAYOUT_DEPRESSED | XKB_STATE_MODS_LATCHED | XKB_STATE_LAYOUT_LATCHED); if (mask & _glfw.wl.xkb.controlMask) modifiers |= GLFW_MOD_CONTROL; if (mask & _glfw.wl.xkb.altMask) modifiers |= GLFW_MOD_ALT; if (mask & _glfw.wl.xkb.shiftMask) modifiers |= GLFW_MOD_SHIFT; if (mask & _glfw.wl.xkb.superMask) modifiers |= GLFW_MOD_SUPER; if (mask & _glfw.wl.xkb.capsLockMask) modifiers |= GLFW_MOD_CAPS_LOCK; if (mask & _glfw.wl.xkb.numLockMask) modifiers |= GLFW_MOD_NUM_LOCK; _glfw.wl.xkb.modifiers = modifiers; } #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION static void keyboardHandleRepeatInfo(void* data, struct wl_keyboard* keyboard, int32_t rate, int32_t delay) { if (keyboard != _glfw.wl.keyboard) return; _glfw.wl.keyboardRepeatRate = rate; _glfw.wl.keyboardRepeatDelay = delay; } #endif static const struct wl_keyboard_listener keyboardListener = { keyboardHandleKeymap, keyboardHandleEnter, keyboardHandleLeave, keyboardHandleKey, keyboardHandleModifiers, #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION keyboardHandleRepeatInfo, #endif }; static void seatHandleCapabilities(void* data, struct wl_seat* seat, enum wl_seat_capability caps) { if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer) { _glfw.wl.pointer = wl_seat_get_pointer(seat); wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer) { wl_pointer_destroy(_glfw.wl.pointer); _glfw.wl.pointer = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard) { _glfw.wl.keyboard = wl_seat_get_keyboard(seat); wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, NULL); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard) { wl_keyboard_destroy(_glfw.wl.keyboard); _glfw.wl.keyboard = NULL; } } static void seatHandleName(void* data, struct wl_seat* seat, const char* name) { } static const struct wl_seat_listener seatListener = { seatHandleCapabilities, seatHandleName, }; static void dataOfferHandleOffer(void* data, struct wl_data_offer* dataOffer, const char* mimeType) { } static const struct wl_data_offer_listener dataOfferListener = { dataOfferHandleOffer, }; static void dataDeviceHandleDataOffer(void* data, struct wl_data_device* dataDevice, struct wl_data_offer* id) { if (_glfw.wl.dataOffer) wl_data_offer_destroy(_glfw.wl.dataOffer); _glfw.wl.dataOffer = id; wl_data_offer_add_listener(_glfw.wl.dataOffer, &dataOfferListener, NULL); } static void dataDeviceHandleEnter(void* data, struct wl_data_device* dataDevice, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id) { } static void dataDeviceHandleLeave(void* data, struct wl_data_device* dataDevice) { } static void dataDeviceHandleMotion(void* data, struct wl_data_device* dataDevice, uint32_t time, wl_fixed_t x, wl_fixed_t y) { } static void dataDeviceHandleDrop(void* data, struct wl_data_device* dataDevice) { } static void dataDeviceHandleSelection(void* data, struct wl_data_device* dataDevice, struct wl_data_offer* id) { } static const struct wl_data_device_listener dataDeviceListener = { dataDeviceHandleDataOffer, dataDeviceHandleEnter, dataDeviceHandleLeave, dataDeviceHandleMotion, dataDeviceHandleDrop, dataDeviceHandleSelection, }; static void wmBaseHandlePing(void* data, struct xdg_wm_base* wmBase, uint32_t serial) { xdg_wm_base_pong(wmBase, serial); } static const struct xdg_wm_base_listener wmBaseListener = { wmBaseHandlePing }; static void registryHandleGlobal(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version) { if (strcmp(interface, "wl_compositor") == 0) { _glfw.wl.compositorVersion = min(3, version); _glfw.wl.compositor = wl_registry_bind(registry, name, &wl_compositor_interface, _glfw.wl.compositorVersion); } else if (strcmp(interface, "wl_subcompositor") == 0) { _glfw.wl.subcompositor = wl_registry_bind(registry, name, &wl_subcompositor_interface, 1); } else if (strcmp(interface, "wl_shm") == 0) { _glfw.wl.shm = wl_registry_bind(registry, name, &wl_shm_interface, 1); } else if (strcmp(interface, "wl_shell") == 0) { _glfw.wl.shell = wl_registry_bind(registry, name, &wl_shell_interface, 1); } else if (strcmp(interface, "wl_output") == 0) { _glfwAddOutputWayland(name, version); } else if (strcmp(interface, "wl_seat") == 0) { if (!_glfw.wl.seat) { _glfw.wl.seatVersion = min(4, version); _glfw.wl.seat = wl_registry_bind(registry, name, &wl_seat_interface, _glfw.wl.seatVersion); wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL); } } else if (strcmp(interface, "wl_data_device_manager") == 0) { if (!_glfw.wl.dataDeviceManager) { _glfw.wl.dataDeviceManager = wl_registry_bind(registry, name, &wl_data_device_manager_interface, 1); } } else if (strcmp(interface, "xdg_wm_base") == 0) { _glfw.wl.wmBase = wl_registry_bind(registry, name, &xdg_wm_base_interface, 1); xdg_wm_base_add_listener(_glfw.wl.wmBase, &wmBaseListener, NULL); } else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0) { _glfw.wl.decorationManager = wl_registry_bind(registry, name, &zxdg_decoration_manager_v1_interface, 1); } else if (strcmp(interface, "wp_viewporter") == 0) { _glfw.wl.viewporter = wl_registry_bind(registry, name, &wp_viewporter_interface, 1); } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) { _glfw.wl.relativePointerManager = wl_registry_bind(registry, name, &zwp_relative_pointer_manager_v1_interface, 1); } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { _glfw.wl.pointerConstraints = wl_registry_bind(registry, name, &zwp_pointer_constraints_v1_interface, 1); } else if (strcmp(interface, "zwp_idle_inhibit_manager_v1") == 0) { _glfw.wl.idleInhibitManager = wl_registry_bind(registry, name, &zwp_idle_inhibit_manager_v1_interface, 1); } } static void registryHandleGlobalRemove(void *data, struct wl_registry *registry, uint32_t name) { int i; _GLFWmonitor* monitor; for (i = 0; i < _glfw.monitorCount; ++i) { monitor = _glfw.monitors[i]; if (monitor->wl.name == name) { _glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0); return; } } } static const struct wl_registry_listener registryListener = { registryHandleGlobal, registryHandleGlobalRemove }; // Create key code translation tables // static void createKeyTables(void) { int scancode; memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes)); memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes)); _glfw.wl.keycodes[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT; _glfw.wl.keycodes[KEY_1] = GLFW_KEY_1; _glfw.wl.keycodes[KEY_2] = GLFW_KEY_2; _glfw.wl.keycodes[KEY_3] = GLFW_KEY_3; _glfw.wl.keycodes[KEY_4] = GLFW_KEY_4; _glfw.wl.keycodes[KEY_5] = GLFW_KEY_5; _glfw.wl.keycodes[KEY_6] = GLFW_KEY_6; _glfw.wl.keycodes[KEY_7] = GLFW_KEY_7; _glfw.wl.keycodes[KEY_8] = GLFW_KEY_8; _glfw.wl.keycodes[KEY_9] = GLFW_KEY_9; _glfw.wl.keycodes[KEY_0] = GLFW_KEY_0; _glfw.wl.keycodes[KEY_SPACE] = GLFW_KEY_SPACE; _glfw.wl.keycodes[KEY_MINUS] = GLFW_KEY_MINUS; _glfw.wl.keycodes[KEY_EQUAL] = GLFW_KEY_EQUAL; _glfw.wl.keycodes[KEY_Q] = GLFW_KEY_Q; _glfw.wl.keycodes[KEY_W] = GLFW_KEY_W; _glfw.wl.keycodes[KEY_E] = GLFW_KEY_E; _glfw.wl.keycodes[KEY_R] = GLFW_KEY_R; _glfw.wl.keycodes[KEY_T] = GLFW_KEY_T; _glfw.wl.keycodes[KEY_Y] = GLFW_KEY_Y; _glfw.wl.keycodes[KEY_U] = GLFW_KEY_U; _glfw.wl.keycodes[KEY_I] = GLFW_KEY_I; _glfw.wl.keycodes[KEY_O] = GLFW_KEY_O; _glfw.wl.keycodes[KEY_P] = GLFW_KEY_P; _glfw.wl.keycodes[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET; _glfw.wl.keycodes[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET; _glfw.wl.keycodes[KEY_A] = GLFW_KEY_A; _glfw.wl.keycodes[KEY_S] = GLFW_KEY_S; _glfw.wl.keycodes[KEY_D] = GLFW_KEY_D; _glfw.wl.keycodes[KEY_F] = GLFW_KEY_F; _glfw.wl.keycodes[KEY_G] = GLFW_KEY_G; _glfw.wl.keycodes[KEY_H] = GLFW_KEY_H; _glfw.wl.keycodes[KEY_J] = GLFW_KEY_J; _glfw.wl.keycodes[KEY_K] = GLFW_KEY_K; _glfw.wl.keycodes[KEY_L] = GLFW_KEY_L; _glfw.wl.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON; _glfw.wl.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE; _glfw.wl.keycodes[KEY_Z] = GLFW_KEY_Z; _glfw.wl.keycodes[KEY_X] = GLFW_KEY_X; _glfw.wl.keycodes[KEY_C] = GLFW_KEY_C; _glfw.wl.keycodes[KEY_V] = GLFW_KEY_V; _glfw.wl.keycodes[KEY_B] = GLFW_KEY_B; _glfw.wl.keycodes[KEY_N] = GLFW_KEY_N; _glfw.wl.keycodes[KEY_M] = GLFW_KEY_M; _glfw.wl.keycodes[KEY_COMMA] = GLFW_KEY_COMMA; _glfw.wl.keycodes[KEY_DOT] = GLFW_KEY_PERIOD; _glfw.wl.keycodes[KEY_SLASH] = GLFW_KEY_SLASH; _glfw.wl.keycodes[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH; _glfw.wl.keycodes[KEY_ESC] = GLFW_KEY_ESCAPE; _glfw.wl.keycodes[KEY_TAB] = GLFW_KEY_TAB; _glfw.wl.keycodes[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT; _glfw.wl.keycodes[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT; _glfw.wl.keycodes[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL; _glfw.wl.keycodes[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL; _glfw.wl.keycodes[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT; _glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT; _glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER; _glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER; _glfw.wl.keycodes[KEY_MENU] = GLFW_KEY_MENU; _glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK; _glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK; _glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN; _glfw.wl.keycodes[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK; _glfw.wl.keycodes[KEY_PAUSE] = GLFW_KEY_PAUSE; _glfw.wl.keycodes[KEY_DELETE] = GLFW_KEY_DELETE; _glfw.wl.keycodes[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE; _glfw.wl.keycodes[KEY_ENTER] = GLFW_KEY_ENTER; _glfw.wl.keycodes[KEY_HOME] = GLFW_KEY_HOME; _glfw.wl.keycodes[KEY_END] = GLFW_KEY_END; _glfw.wl.keycodes[KEY_PAGEUP] = GLFW_KEY_PAGE_UP; _glfw.wl.keycodes[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN; _glfw.wl.keycodes[KEY_INSERT] = GLFW_KEY_INSERT; _glfw.wl.keycodes[KEY_LEFT] = GLFW_KEY_LEFT; _glfw.wl.keycodes[KEY_RIGHT] = GLFW_KEY_RIGHT; _glfw.wl.keycodes[KEY_DOWN] = GLFW_KEY_DOWN; _glfw.wl.keycodes[KEY_UP] = GLFW_KEY_UP; _glfw.wl.keycodes[KEY_F1] = GLFW_KEY_F1; _glfw.wl.keycodes[KEY_F2] = GLFW_KEY_F2; _glfw.wl.keycodes[KEY_F3] = GLFW_KEY_F3; _glfw.wl.keycodes[KEY_F4] = GLFW_KEY_F4; _glfw.wl.keycodes[KEY_F5] = GLFW_KEY_F5; _glfw.wl.keycodes[KEY_F6] = GLFW_KEY_F6; _glfw.wl.keycodes[KEY_F7] = GLFW_KEY_F7; _glfw.wl.keycodes[KEY_F8] = GLFW_KEY_F8; _glfw.wl.keycodes[KEY_F9] = GLFW_KEY_F9; _glfw.wl.keycodes[KEY_F10] = GLFW_KEY_F10; _glfw.wl.keycodes[KEY_F11] = GLFW_KEY_F11; _glfw.wl.keycodes[KEY_F12] = GLFW_KEY_F12; _glfw.wl.keycodes[KEY_F13] = GLFW_KEY_F13; _glfw.wl.keycodes[KEY_F14] = GLFW_KEY_F14; _glfw.wl.keycodes[KEY_F15] = GLFW_KEY_F15; _glfw.wl.keycodes[KEY_F16] = GLFW_KEY_F16; _glfw.wl.keycodes[KEY_F17] = GLFW_KEY_F17; _glfw.wl.keycodes[KEY_F18] = GLFW_KEY_F18; _glfw.wl.keycodes[KEY_F19] = GLFW_KEY_F19; _glfw.wl.keycodes[KEY_F20] = GLFW_KEY_F20; _glfw.wl.keycodes[KEY_F21] = GLFW_KEY_F21; _glfw.wl.keycodes[KEY_F22] = GLFW_KEY_F22; _glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23; _glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24; _glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE; _glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY; _glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT; _glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD; _glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0; _glfw.wl.keycodes[KEY_KP1] = GLFW_KEY_KP_1; _glfw.wl.keycodes[KEY_KP2] = GLFW_KEY_KP_2; _glfw.wl.keycodes[KEY_KP3] = GLFW_KEY_KP_3; _glfw.wl.keycodes[KEY_KP4] = GLFW_KEY_KP_4; _glfw.wl.keycodes[KEY_KP5] = GLFW_KEY_KP_5; _glfw.wl.keycodes[KEY_KP6] = GLFW_KEY_KP_6; _glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7; _glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8; _glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9; _glfw.wl.keycodes[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL; _glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL; _glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER; for (scancode = 0; scancode < 256; scancode++) { if (_glfw.wl.keycodes[scancode] > 0) _glfw.wl.scancodes[_glfw.wl.keycodes[scancode]] = scancode; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformInit(void) { const char *cursorTheme; const char *cursorSizeStr; char *cursorSizeEnd; long cursorSizeLong; int cursorSize; _glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0"); if (!_glfw.wl.cursor.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to open libwayland-cursor"); return GLFW_FALSE; } _glfw.wl.cursor.theme_load = (PFN_wl_cursor_theme_load) _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_load"); _glfw.wl.cursor.theme_destroy = (PFN_wl_cursor_theme_destroy) _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_destroy"); _glfw.wl.cursor.theme_get_cursor = (PFN_wl_cursor_theme_get_cursor) _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_get_cursor"); _glfw.wl.cursor.image_get_buffer = (PFN_wl_cursor_image_get_buffer) _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_image_get_buffer"); _glfw.wl.egl.handle = _glfw_dlopen("libwayland-egl.so.1"); if (!_glfw.wl.egl.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to open libwayland-egl"); return GLFW_FALSE; } _glfw.wl.egl.window_create = (PFN_wl_egl_window_create) _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_create"); _glfw.wl.egl.window_destroy = (PFN_wl_egl_window_destroy) _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_destroy"); _glfw.wl.egl.window_resize = (PFN_wl_egl_window_resize) _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_resize"); _glfw.wl.xkb.handle = _glfw_dlopen("libxkbcommon.so.0"); if (!_glfw.wl.xkb.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to open libxkbcommon"); return GLFW_FALSE; } _glfw.wl.xkb.context_new = (PFN_xkb_context_new) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_context_new"); _glfw.wl.xkb.context_unref = (PFN_xkb_context_unref) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_context_unref"); _glfw.wl.xkb.keymap_new_from_string = (PFN_xkb_keymap_new_from_string) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_new_from_string"); _glfw.wl.xkb.keymap_unref = (PFN_xkb_keymap_unref) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_unref"); _glfw.wl.xkb.keymap_mod_get_index = (PFN_xkb_keymap_mod_get_index) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index"); _glfw.wl.xkb.keymap_key_repeats = (PFN_xkb_keymap_key_repeats) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats"); _glfw.wl.xkb.state_new = (PFN_xkb_state_new) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_new"); _glfw.wl.xkb.state_unref = (PFN_xkb_state_unref) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_unref"); _glfw.wl.xkb.state_key_get_syms = (PFN_xkb_state_key_get_syms) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_syms"); _glfw.wl.xkb.state_update_mask = (PFN_xkb_state_update_mask) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask"); _glfw.wl.xkb.state_serialize_mods = (PFN_xkb_state_serialize_mods) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_serialize_mods"); #ifdef HAVE_XKBCOMMON_COMPOSE_H _glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale"); _glfw.wl.xkb.compose_table_unref = (PFN_xkb_compose_table_unref) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_unref"); _glfw.wl.xkb.compose_state_new = (PFN_xkb_compose_state_new) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_new"); _glfw.wl.xkb.compose_state_unref = (PFN_xkb_compose_state_unref) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_unref"); _glfw.wl.xkb.compose_state_feed = (PFN_xkb_compose_state_feed) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_feed"); _glfw.wl.xkb.compose_state_get_status = (PFN_xkb_compose_state_get_status) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_status"); _glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym"); #endif _glfw.wl.display = wl_display_connect(NULL); if (!_glfw.wl.display) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to connect to display"); return GLFW_FALSE; } _glfw.wl.registry = wl_display_get_registry(_glfw.wl.display); wl_registry_add_listener(_glfw.wl.registry, ®istryListener, NULL); createKeyTables(); _glfw.wl.xkb.context = xkb_context_new(0); if (!_glfw.wl.xkb.context) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to initialize xkb context"); return GLFW_FALSE; } // Sync so we got all registry objects wl_display_roundtrip(_glfw.wl.display); // Sync so we got all initial output events wl_display_roundtrip(_glfw.wl.display); #ifdef __linux__ if (!_glfwInitJoysticksLinux()) return GLFW_FALSE; #endif _glfwInitTimerPOSIX(); _glfw.wl.timerfd = -1; if (_glfw.wl.seatVersion >= 4) _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); if (_glfw.wl.pointer && _glfw.wl.shm) { cursorTheme = getenv("XCURSOR_THEME"); cursorSizeStr = getenv("XCURSOR_SIZE"); cursorSize = 32; if (cursorSizeStr) { errno = 0; cursorSizeLong = strtol(cursorSizeStr, &cursorSizeEnd, 10); if (!*cursorSizeEnd && !errno && cursorSizeLong > 0 && cursorSizeLong <= INT_MAX) cursorSize = (int)cursorSizeLong; } _glfw.wl.cursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, _glfw.wl.shm); if (!_glfw.wl.cursorTheme) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unable to load default cursor theme"); return GLFW_FALSE; } // If this happens to be NULL, we just fallback to the scale=1 version. _glfw.wl.cursorThemeHiDPI = wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm); _glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor); _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); } if (_glfw.wl.seat && _glfw.wl.dataDeviceManager) { _glfw.wl.dataDevice = wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager, _glfw.wl.seat); wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL); _glfw.wl.clipboardString = malloc(4096); if (!_glfw.wl.clipboardString) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unable to allocate clipboard memory"); return GLFW_FALSE; } _glfw.wl.clipboardSize = 4096; } return GLFW_TRUE; } void _glfwPlatformTerminate(void) { #ifdef __linux__ _glfwTerminateJoysticksLinux(); #endif _glfwTerminateEGL(); if (_glfw.wl.egl.handle) { _glfw_dlclose(_glfw.wl.egl.handle); _glfw.wl.egl.handle = NULL; } #ifdef HAVE_XKBCOMMON_COMPOSE_H if (_glfw.wl.xkb.composeState) xkb_compose_state_unref(_glfw.wl.xkb.composeState); #endif if (_glfw.wl.xkb.keymap) xkb_keymap_unref(_glfw.wl.xkb.keymap); if (_glfw.wl.xkb.state) xkb_state_unref(_glfw.wl.xkb.state); if (_glfw.wl.xkb.context) xkb_context_unref(_glfw.wl.xkb.context); if (_glfw.wl.xkb.handle) { _glfw_dlclose(_glfw.wl.xkb.handle); _glfw.wl.xkb.handle = NULL; } if (_glfw.wl.cursorTheme) wl_cursor_theme_destroy(_glfw.wl.cursorTheme); if (_glfw.wl.cursorThemeHiDPI) wl_cursor_theme_destroy(_glfw.wl.cursorThemeHiDPI); if (_glfw.wl.cursor.handle) { _glfw_dlclose(_glfw.wl.cursor.handle); _glfw.wl.cursor.handle = NULL; } if (_glfw.wl.cursorSurface) wl_surface_destroy(_glfw.wl.cursorSurface); if (_glfw.wl.subcompositor) wl_subcompositor_destroy(_glfw.wl.subcompositor); if (_glfw.wl.compositor) wl_compositor_destroy(_glfw.wl.compositor); if (_glfw.wl.shm) wl_shm_destroy(_glfw.wl.shm); if (_glfw.wl.shell) wl_shell_destroy(_glfw.wl.shell); if (_glfw.wl.viewporter) wp_viewporter_destroy(_glfw.wl.viewporter); if (_glfw.wl.decorationManager) zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); if (_glfw.wl.wmBase) xdg_wm_base_destroy(_glfw.wl.wmBase); if (_glfw.wl.dataSource) wl_data_source_destroy(_glfw.wl.dataSource); if (_glfw.wl.dataDevice) wl_data_device_destroy(_glfw.wl.dataDevice); if (_glfw.wl.dataOffer) wl_data_offer_destroy(_glfw.wl.dataOffer); if (_glfw.wl.dataDeviceManager) wl_data_device_manager_destroy(_glfw.wl.dataDeviceManager); if (_glfw.wl.pointer) wl_pointer_destroy(_glfw.wl.pointer); if (_glfw.wl.keyboard) wl_keyboard_destroy(_glfw.wl.keyboard); if (_glfw.wl.seat) wl_seat_destroy(_glfw.wl.seat); if (_glfw.wl.relativePointerManager) zwp_relative_pointer_manager_v1_destroy(_glfw.wl.relativePointerManager); if (_glfw.wl.pointerConstraints) zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints); if (_glfw.wl.idleInhibitManager) zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager); if (_glfw.wl.registry) wl_registry_destroy(_glfw.wl.registry); if (_glfw.wl.display) { wl_display_flush(_glfw.wl.display); wl_display_disconnect(_glfw.wl.display); } if (_glfw.wl.timerfd >= 0) close(_glfw.wl.timerfd); if (_glfw.wl.cursorTimerfd >= 0) close(_glfw.wl.cursorTimerfd); if (_glfw.wl.clipboardString) free(_glfw.wl.clipboardString); if (_glfw.wl.clipboardSendString) free(_glfw.wl.clipboardSendString); } const char* _glfwPlatformGetVersionString(void) { return _GLFW_VERSION_NUMBER " Wayland EGL OSMesa" #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) " clock_gettime" #else " gettimeofday" #endif " evdev" #if defined(_GLFW_BUILD_DLL) " shared" #endif ; } ================================================ FILE: thirdparty/glfw/src/wl_monitor.c ================================================ //======================================================================== // GLFW 3.3 Wayland - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include static void outputHandleGeometry(void* data, struct wl_output* output, int32_t x, int32_t y, int32_t physicalWidth, int32_t physicalHeight, int32_t subpixel, const char* make, const char* model, int32_t transform) { struct _GLFWmonitor *monitor = data; char name[1024]; monitor->wl.x = x; monitor->wl.y = y; monitor->widthMM = physicalWidth; monitor->heightMM = physicalHeight; snprintf(name, sizeof(name), "%s %s", make, model); monitor->name = _glfw_strdup(name); } static void outputHandleMode(void* data, struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) { struct _GLFWmonitor *monitor = data; GLFWvidmode mode; mode.width = width; mode.height = height; mode.redBits = 8; mode.greenBits = 8; mode.blueBits = 8; mode.refreshRate = (int) round(refresh / 1000.0); monitor->modeCount++; monitor->modes = realloc(monitor->modes, monitor->modeCount * sizeof(GLFWvidmode)); monitor->modes[monitor->modeCount - 1] = mode; if (flags & WL_OUTPUT_MODE_CURRENT) monitor->wl.currentMode = monitor->modeCount - 1; } static void outputHandleDone(void* data, struct wl_output* output) { struct _GLFWmonitor *monitor = data; _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); } static void outputHandleScale(void* data, struct wl_output* output, int32_t factor) { struct _GLFWmonitor *monitor = data; monitor->wl.scale = factor; } static const struct wl_output_listener outputListener = { outputHandleGeometry, outputHandleMode, outputHandleDone, outputHandleScale, }; ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// void _glfwAddOutputWayland(uint32_t name, uint32_t version) { _GLFWmonitor *monitor; struct wl_output *output; if (version < 2) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unsupported output interface version"); return; } // The actual name of this output will be set in the geometry handler. monitor = _glfwAllocMonitor(NULL, 0, 0); output = wl_registry_bind(_glfw.wl.registry, name, &wl_output_interface, 2); if (!output) { _glfwFreeMonitor(monitor); return; } monitor->wl.scale = 1; monitor->wl.output = output; monitor->wl.name = name; wl_output_add_listener(output, &outputListener, monitor); } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) { if (monitor->wl.output) wl_output_destroy(monitor->wl.output); } void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { if (xpos) *xpos = monitor->wl.x; if (ypos) *ypos = monitor->wl.y; } void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale) { if (xscale) *xscale = (float) monitor->wl.scale; if (yscale) *yscale = (float) monitor->wl.scale; } void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height) { if (xpos) *xpos = monitor->wl.x; if (ypos) *ypos = monitor->wl.y; if (width) *width = monitor->modes[monitor->wl.currentMode].width; if (height) *height = monitor->modes[monitor->wl.currentMode].height; } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) { *found = monitor->modeCount; return monitor->modes; } void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { *mode = monitor->modes[monitor->wl.currentMode]; } GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Gamma ramp access is not available"); return GLFW_FALSE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Gamma ramp access is not available"); } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return monitor->wl.output; } ================================================ FILE: thirdparty/glfw/src/wl_platform.h ================================================ //======================================================================== // GLFW 3.3 Wayland - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #ifdef HAVE_XKBCOMMON_COMPOSE_H #include #endif #include typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; typedef struct VkWaylandSurfaceCreateInfoKHR { VkStructureType sType; const void* pNext; VkWaylandSurfaceCreateFlagsKHR flags; struct wl_display* display; struct wl_surface* surface; } VkWaylandSurfaceCreateInfoKHR; typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*); #include "posix_thread.h" #include "posix_time.h" #ifdef __linux__ #include "linux_joystick.h" #else #include "null_joystick.h" #endif #include "xkb_unicode.h" #include "egl_context.h" #include "osmesa_context.h" #include "wayland-xdg-shell-client-protocol.h" #include "wayland-xdg-decoration-client-protocol.h" #include "wayland-viewporter-client-protocol.h" #include "wayland-relative-pointer-unstable-v1-client-protocol.h" #include "wayland-pointer-constraints-unstable-v1-client-protocol.h" #include "wayland-idle-inhibit-unstable-v1-client-protocol.h" #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlsym(handle, name) dlsym(handle, name) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native) #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display) #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl #define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; } #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; } struct wl_cursor_image { uint32_t width; uint32_t height; uint32_t hotspot_x; uint32_t hotspot_y; uint32_t delay; }; struct wl_cursor { unsigned int image_count; struct wl_cursor_image** images; char* name; }; typedef struct wl_cursor_theme* (* PFN_wl_cursor_theme_load)(const char*, int, struct wl_shm*); typedef void (* PFN_wl_cursor_theme_destroy)(struct wl_cursor_theme*); typedef struct wl_cursor* (* PFN_wl_cursor_theme_get_cursor)(struct wl_cursor_theme*, const char*); typedef struct wl_buffer* (* PFN_wl_cursor_image_get_buffer)(struct wl_cursor_image*); #define wl_cursor_theme_load _glfw.wl.cursor.theme_load #define wl_cursor_theme_destroy _glfw.wl.cursor.theme_destroy #define wl_cursor_theme_get_cursor _glfw.wl.cursor.theme_get_cursor #define wl_cursor_image_get_buffer _glfw.wl.cursor.image_get_buffer typedef struct wl_egl_window* (* PFN_wl_egl_window_create)(struct wl_surface*, int, int); typedef void (* PFN_wl_egl_window_destroy)(struct wl_egl_window*); typedef void (* PFN_wl_egl_window_resize)(struct wl_egl_window*, int, int, int, int); #define wl_egl_window_create _glfw.wl.egl.window_create #define wl_egl_window_destroy _glfw.wl.egl.window_destroy #define wl_egl_window_resize _glfw.wl.egl.window_resize typedef struct xkb_context* (* PFN_xkb_context_new)(enum xkb_context_flags); typedef void (* PFN_xkb_context_unref)(struct xkb_context*); typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags); typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*); typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*); typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t); typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*); typedef void (* PFN_xkb_state_unref)(struct xkb_state*); typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**); typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t); typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum xkb_state_component); #define xkb_context_new _glfw.wl.xkb.context_new #define xkb_context_unref _glfw.wl.xkb.context_unref #define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string #define xkb_keymap_unref _glfw.wl.xkb.keymap_unref #define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index #define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats #define xkb_state_new _glfw.wl.xkb.state_new #define xkb_state_unref _glfw.wl.xkb.state_unref #define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms #define xkb_state_update_mask _glfw.wl.xkb.state_update_mask #define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods #ifdef HAVE_XKBCOMMON_COMPOSE_H typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags); typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*); typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags); typedef void (* PFN_xkb_compose_state_unref)(struct xkb_compose_state*); typedef enum xkb_compose_feed_result (* PFN_xkb_compose_state_feed)(struct xkb_compose_state*, xkb_keysym_t); typedef enum xkb_compose_status (* PFN_xkb_compose_state_get_status)(struct xkb_compose_state*); typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_state*); #define xkb_compose_table_new_from_locale _glfw.wl.xkb.compose_table_new_from_locale #define xkb_compose_table_unref _glfw.wl.xkb.compose_table_unref #define xkb_compose_state_new _glfw.wl.xkb.compose_state_new #define xkb_compose_state_unref _glfw.wl.xkb.compose_state_unref #define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed #define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status #define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym #endif #define _GLFW_DECORATION_WIDTH 4 #define _GLFW_DECORATION_TOP 24 #define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH) #define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH) typedef enum _GLFWdecorationSideWayland { mainWindow, topDecoration, leftDecoration, rightDecoration, bottomDecoration, } _GLFWdecorationSideWayland; typedef struct _GLFWdecorationWayland { struct wl_surface* surface; struct wl_subsurface* subsurface; struct wp_viewport* viewport; } _GLFWdecorationWayland; // Wayland-specific per-window data // typedef struct _GLFWwindowWayland { int width, height; GLFWbool visible; GLFWbool maximized; GLFWbool hovered; GLFWbool transparent; struct wl_surface* surface; struct wl_egl_window* native; struct wl_shell_surface* shellSurface; struct wl_callback* callback; struct { struct xdg_surface* surface; struct xdg_toplevel* toplevel; struct zxdg_toplevel_decoration_v1* decoration; } xdg; _GLFWcursor* currentCursor; double cursorPosX, cursorPosY; char* title; // We need to track the monitors the window spans on to calculate the // optimal scaling factor. int scale; _GLFWmonitor** monitors; int monitorsCount; int monitorsSize; struct { struct zwp_relative_pointer_v1* relativePointer; struct zwp_locked_pointer_v1* lockedPointer; } pointerLock; struct zwp_idle_inhibitor_v1* idleInhibitor; GLFWbool wasFullscreen; struct { GLFWbool serverSide; struct wl_buffer* buffer; _GLFWdecorationWayland top, left, right, bottom; int focus; } decorations; } _GLFWwindowWayland; // Wayland-specific global data // typedef struct _GLFWlibraryWayland { struct wl_display* display; struct wl_registry* registry; struct wl_compositor* compositor; struct wl_subcompositor* subcompositor; struct wl_shell* shell; struct wl_shm* shm; struct wl_seat* seat; struct wl_pointer* pointer; struct wl_keyboard* keyboard; struct wl_data_device_manager* dataDeviceManager; struct wl_data_device* dataDevice; struct wl_data_offer* dataOffer; struct wl_data_source* dataSource; struct xdg_wm_base* wmBase; struct zxdg_decoration_manager_v1* decorationManager; struct wp_viewporter* viewporter; struct zwp_relative_pointer_manager_v1* relativePointerManager; struct zwp_pointer_constraints_v1* pointerConstraints; struct zwp_idle_inhibit_manager_v1* idleInhibitManager; int compositorVersion; int seatVersion; struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorThemeHiDPI; struct wl_surface* cursorSurface; const char* cursorPreviousName; int cursorTimerfd; uint32_t serial; int32_t keyboardRepeatRate; int32_t keyboardRepeatDelay; int keyboardLastKey; int keyboardLastScancode; char* clipboardString; size_t clipboardSize; char* clipboardSendString; size_t clipboardSendSize; int timerfd; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; struct { void* handle; struct xkb_context* context; struct xkb_keymap* keymap; struct xkb_state* state; #ifdef HAVE_XKBCOMMON_COMPOSE_H struct xkb_compose_state* composeState; #endif xkb_mod_mask_t controlMask; xkb_mod_mask_t altMask; xkb_mod_mask_t shiftMask; xkb_mod_mask_t superMask; xkb_mod_mask_t capsLockMask; xkb_mod_mask_t numLockMask; unsigned int modifiers; PFN_xkb_context_new context_new; PFN_xkb_context_unref context_unref; PFN_xkb_keymap_new_from_string keymap_new_from_string; PFN_xkb_keymap_unref keymap_unref; PFN_xkb_keymap_mod_get_index keymap_mod_get_index; PFN_xkb_keymap_key_repeats keymap_key_repeats; PFN_xkb_state_new state_new; PFN_xkb_state_unref state_unref; PFN_xkb_state_key_get_syms state_key_get_syms; PFN_xkb_state_update_mask state_update_mask; PFN_xkb_state_serialize_mods state_serialize_mods; #ifdef HAVE_XKBCOMMON_COMPOSE_H PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale; PFN_xkb_compose_table_unref compose_table_unref; PFN_xkb_compose_state_new compose_state_new; PFN_xkb_compose_state_unref compose_state_unref; PFN_xkb_compose_state_feed compose_state_feed; PFN_xkb_compose_state_get_status compose_state_get_status; PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym; #endif } xkb; _GLFWwindow* pointerFocus; _GLFWwindow* keyboardFocus; struct { void* handle; PFN_wl_cursor_theme_load theme_load; PFN_wl_cursor_theme_destroy theme_destroy; PFN_wl_cursor_theme_get_cursor theme_get_cursor; PFN_wl_cursor_image_get_buffer image_get_buffer; } cursor; struct { void* handle; PFN_wl_egl_window_create window_create; PFN_wl_egl_window_destroy window_destroy; PFN_wl_egl_window_resize window_resize; } egl; } _GLFWlibraryWayland; // Wayland-specific per-monitor data // typedef struct _GLFWmonitorWayland { struct wl_output* output; uint32_t name; int currentMode; int x; int y; int scale; } _GLFWmonitorWayland; // Wayland-specific per-cursor data // typedef struct _GLFWcursorWayland { struct wl_cursor* cursor; struct wl_cursor* cursorHiDPI; struct wl_buffer* buffer; int width, height; int xhot, yhot; int currentImage; } _GLFWcursorWayland; void _glfwAddOutputWayland(uint32_t name, uint32_t version); ================================================ FILE: thirdparty/glfw/src/wl_window.c ================================================ //======================================================================== // GLFW 3.3 Wayland - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #define _GNU_SOURCE #include "internal.h" #include #include #include #include #include #include #include #include #include static void shellSurfaceHandlePing(void* data, struct wl_shell_surface* shellSurface, uint32_t serial) { wl_shell_surface_pong(shellSurface, serial); } static void shellSurfaceHandleConfigure(void* data, struct wl_shell_surface* shellSurface, uint32_t edges, int32_t width, int32_t height) { _GLFWwindow* window = data; float aspectRatio; float targetRatio; if (!window->monitor) { if (_glfw.wl.viewporter && window->decorated) { width -= _GLFW_DECORATION_HORIZONTAL; height -= _GLFW_DECORATION_VERTICAL; } if (width < 1) width = 1; if (height < 1) height = 1; if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) { aspectRatio = (float)width / (float)height; targetRatio = (float)window->numer / (float)window->denom; if (aspectRatio < targetRatio) height = width / targetRatio; else if (aspectRatio > targetRatio) width = height * targetRatio; } if (window->minwidth != GLFW_DONT_CARE && width < window->minwidth) width = window->minwidth; else if (window->maxwidth != GLFW_DONT_CARE && width > window->maxwidth) width = window->maxwidth; if (window->minheight != GLFW_DONT_CARE && height < window->minheight) height = window->minheight; else if (window->maxheight != GLFW_DONT_CARE && height > window->maxheight) height = window->maxheight; } _glfwInputWindowSize(window, width, height); _glfwPlatformSetWindowSize(window, width, height); _glfwInputWindowDamage(window); } static void shellSurfaceHandlePopupDone(void* data, struct wl_shell_surface* shellSurface) { } static const struct wl_shell_surface_listener shellSurfaceListener = { shellSurfaceHandlePing, shellSurfaceHandleConfigure, shellSurfaceHandlePopupDone }; static int createTmpfileCloexec(char* tmpname) { int fd; fd = mkostemp(tmpname, O_CLOEXEC); if (fd >= 0) unlink(tmpname); return fd; } /* * Create a new, unique, anonymous file of the given size, and * return the file descriptor for it. The file descriptor is set * CLOEXEC. The file is immediately suitable for mmap()'ing * the given size at offset zero. * * The file should not have a permanent backing store like a disk, * but may have if XDG_RUNTIME_DIR is not properly implemented in OS. * * The file name is deleted from the file system. * * The file is suitable for buffer sharing between processes by * transmitting the file descriptor over Unix sockets using the * SCM_RIGHTS methods. * * posix_fallocate() is used to guarantee that disk space is available * for the file at the given size. If disk space is insufficient, errno * is set to ENOSPC. If posix_fallocate() is not supported, program may * receive SIGBUS on accessing mmap()'ed file contents instead. */ static int createAnonymousFile(off_t size) { static const char template[] = "/glfw-shared-XXXXXX"; const char* path; char* name; int fd; int ret; #ifdef HAVE_MEMFD_CREATE fd = memfd_create("glfw-shared", MFD_CLOEXEC | MFD_ALLOW_SEALING); if (fd >= 0) { // We can add this seal before calling posix_fallocate(), as the file // is currently zero-sized anyway. // // There is also no need to check for the return value, we couldn’t do // anything with it anyway. fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); } else #elif defined(SHM_ANON) fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600); if (fd < 0) #endif { path = getenv("XDG_RUNTIME_DIR"); if (!path) { errno = ENOENT; return -1; } name = calloc(strlen(path) + sizeof(template), 1); strcpy(name, path); strcat(name, template); fd = createTmpfileCloexec(name); free(name); if (fd < 0) return -1; } #if defined(SHM_ANON) // posix_fallocate does not work on SHM descriptors ret = ftruncate(fd, size); #else ret = posix_fallocate(fd, 0, size); #endif if (ret != 0) { close(fd); errno = ret; return -1; } return fd; } static struct wl_buffer* createShmBuffer(const GLFWimage* image) { struct wl_shm_pool* pool; struct wl_buffer* buffer; int stride = image->width * 4; int length = image->width * image->height * 4; void* data; int fd, i; fd = createAnonymousFile(length); if (fd < 0) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Creating a buffer file for %d B failed: %m", length); return NULL; } data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (data == MAP_FAILED) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: mmap failed: %m"); close(fd); return NULL; } pool = wl_shm_create_pool(_glfw.wl.shm, fd, length); close(fd); unsigned char* source = (unsigned char*) image->pixels; unsigned char* target = data; for (i = 0; i < image->width * image->height; i++, source += 4) { unsigned int alpha = source[3]; *target++ = (unsigned char) ((source[2] * alpha) / 255); *target++ = (unsigned char) ((source[1] * alpha) / 255); *target++ = (unsigned char) ((source[0] * alpha) / 255); *target++ = (unsigned char) alpha; } buffer = wl_shm_pool_create_buffer(pool, 0, image->width, image->height, stride, WL_SHM_FORMAT_ARGB8888); munmap(data, length); wl_shm_pool_destroy(pool); return buffer; } static void createDecoration(_GLFWdecorationWayland* decoration, struct wl_surface* parent, struct wl_buffer* buffer, GLFWbool opaque, int x, int y, int width, int height) { struct wl_region* region; decoration->surface = wl_compositor_create_surface(_glfw.wl.compositor); decoration->subsurface = wl_subcompositor_get_subsurface(_glfw.wl.subcompositor, decoration->surface, parent); wl_subsurface_set_position(decoration->subsurface, x, y); decoration->viewport = wp_viewporter_get_viewport(_glfw.wl.viewporter, decoration->surface); wp_viewport_set_destination(decoration->viewport, width, height); wl_surface_attach(decoration->surface, buffer, 0, 0); if (opaque) { region = wl_compositor_create_region(_glfw.wl.compositor); wl_region_add(region, 0, 0, width, height); wl_surface_set_opaque_region(decoration->surface, region); wl_surface_commit(decoration->surface); wl_region_destroy(region); } else wl_surface_commit(decoration->surface); } static void createDecorations(_GLFWwindow* window) { unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; GLFWbool opaque = (data[3] == 255); if (!_glfw.wl.viewporter || !window->decorated || window->wl.decorations.serverSide) return; if (!window->wl.decorations.buffer) window->wl.decorations.buffer = createShmBuffer(&image); if (!window->wl.decorations.buffer) return; createDecoration(&window->wl.decorations.top, window->wl.surface, window->wl.decorations.buffer, opaque, 0, -_GLFW_DECORATION_TOP, window->wl.width, _GLFW_DECORATION_TOP); createDecoration(&window->wl.decorations.left, window->wl.surface, window->wl.decorations.buffer, opaque, -_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); createDecoration(&window->wl.decorations.right, window->wl.surface, window->wl.decorations.buffer, opaque, window->wl.width, -_GLFW_DECORATION_TOP, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); createDecoration(&window->wl.decorations.bottom, window->wl.surface, window->wl.decorations.buffer, opaque, -_GLFW_DECORATION_WIDTH, window->wl.height, window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); } static void destroyDecoration(_GLFWdecorationWayland* decoration) { if (decoration->surface) wl_surface_destroy(decoration->surface); if (decoration->subsurface) wl_subsurface_destroy(decoration->subsurface); if (decoration->viewport) wp_viewport_destroy(decoration->viewport); decoration->surface = NULL; decoration->subsurface = NULL; decoration->viewport = NULL; } static void destroyDecorations(_GLFWwindow* window) { destroyDecoration(&window->wl.decorations.top); destroyDecoration(&window->wl.decorations.left); destroyDecoration(&window->wl.decorations.right); destroyDecoration(&window->wl.decorations.bottom); } static void xdgDecorationHandleConfigure(void* data, struct zxdg_toplevel_decoration_v1* decoration, uint32_t mode) { _GLFWwindow* window = data; window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); if (!window->wl.decorations.serverSide) createDecorations(window); } static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = { xdgDecorationHandleConfigure, }; // Makes the surface considered as XRGB instead of ARGB. static void setOpaqueRegion(_GLFWwindow* window) { struct wl_region* region; region = wl_compositor_create_region(_glfw.wl.compositor); if (!region) return; wl_region_add(region, 0, 0, window->wl.width, window->wl.height); wl_surface_set_opaque_region(window->wl.surface, region); wl_surface_commit(window->wl.surface); wl_region_destroy(region); } static void resizeWindow(_GLFWwindow* window) { int scale = window->wl.scale; int scaledWidth = window->wl.width * scale; int scaledHeight = window->wl.height * scale; wl_egl_window_resize(window->wl.native, scaledWidth, scaledHeight, 0, 0); if (!window->wl.transparent) setOpaqueRegion(window); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); _glfwInputWindowContentScale(window, scale, scale); if (!window->wl.decorations.top.surface) return; // Top decoration. wp_viewport_set_destination(window->wl.decorations.top.viewport, window->wl.width, _GLFW_DECORATION_TOP); wl_surface_commit(window->wl.decorations.top.surface); // Left decoration. wp_viewport_set_destination(window->wl.decorations.left.viewport, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); wl_surface_commit(window->wl.decorations.left.surface); // Right decoration. wl_subsurface_set_position(window->wl.decorations.right.subsurface, window->wl.width, -_GLFW_DECORATION_TOP); wp_viewport_set_destination(window->wl.decorations.right.viewport, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); wl_surface_commit(window->wl.decorations.right.surface); // Bottom decoration. wl_subsurface_set_position(window->wl.decorations.bottom.subsurface, -_GLFW_DECORATION_WIDTH, window->wl.height); wp_viewport_set_destination(window->wl.decorations.bottom.viewport, window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); wl_surface_commit(window->wl.decorations.bottom.surface); } static void checkScaleChange(_GLFWwindow* window) { int scale = 1; int i; int monitorScale; // Check if we will be able to set the buffer scale or not. if (_glfw.wl.compositorVersion < 3) return; // Get the scale factor from the highest scale monitor. for (i = 0; i < window->wl.monitorsCount; ++i) { monitorScale = window->wl.monitors[i]->wl.scale; if (scale < monitorScale) scale = monitorScale; } // Only change the framebuffer size if the scale changed. if (scale != window->wl.scale) { window->wl.scale = scale; wl_surface_set_buffer_scale(window->wl.surface, scale); resizeWindow(window); } } static void surfaceHandleEnter(void *data, struct wl_surface *surface, struct wl_output *output) { _GLFWwindow* window = data; _GLFWmonitor* monitor = wl_output_get_user_data(output); if (window->wl.monitorsCount + 1 > window->wl.monitorsSize) { ++window->wl.monitorsSize; window->wl.monitors = realloc(window->wl.monitors, window->wl.monitorsSize * sizeof(_GLFWmonitor*)); } window->wl.monitors[window->wl.monitorsCount++] = monitor; checkScaleChange(window); } static void surfaceHandleLeave(void *data, struct wl_surface *surface, struct wl_output *output) { _GLFWwindow* window = data; _GLFWmonitor* monitor = wl_output_get_user_data(output); GLFWbool found; int i; for (i = 0, found = GLFW_FALSE; i < window->wl.monitorsCount - 1; ++i) { if (monitor == window->wl.monitors[i]) found = GLFW_TRUE; if (found) window->wl.monitors[i] = window->wl.monitors[i + 1]; } window->wl.monitors[--window->wl.monitorsCount] = NULL; checkScaleChange(window); } static const struct wl_surface_listener surfaceListener = { surfaceHandleEnter, surfaceHandleLeave }; static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) { if (enable && !window->wl.idleInhibitor && _glfw.wl.idleInhibitManager) { window->wl.idleInhibitor = zwp_idle_inhibit_manager_v1_create_inhibitor( _glfw.wl.idleInhibitManager, window->wl.surface); if (!window->wl.idleInhibitor) _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Idle inhibitor creation failed"); } else if (!enable && window->wl.idleInhibitor) { zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor); window->wl.idleInhibitor = NULL; } } static GLFWbool createSurface(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); if (!window->wl.surface) return GLFW_FALSE; wl_surface_add_listener(window->wl.surface, &surfaceListener, window); wl_surface_set_user_data(window->wl.surface, window); window->wl.native = wl_egl_window_create(window->wl.surface, wndconfig->width, wndconfig->height); if (!window->wl.native) return GLFW_FALSE; window->wl.width = wndconfig->width; window->wl.height = wndconfig->height; window->wl.scale = 1; if (!window->wl.transparent) setOpaqueRegion(window); return GLFW_TRUE; } static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, int refreshRate) { if (window->wl.xdg.toplevel) { xdg_toplevel_set_fullscreen( window->wl.xdg.toplevel, monitor->wl.output); } else if (window->wl.shellSurface) { wl_shell_surface_set_fullscreen( window->wl.shellSurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, refreshRate * 1000, // Convert Hz to mHz. monitor->wl.output); } setIdleInhibitor(window, GLFW_TRUE); if (!window->wl.decorations.serverSide) destroyDecorations(window); } static GLFWbool createShellSurface(_GLFWwindow* window) { if (!_glfw.wl.shell) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: wl_shell protocol not available"); return GLFW_FALSE; } window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell, window->wl.surface); if (!window->wl.shellSurface) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Shell surface creation failed"); return GLFW_FALSE; } wl_shell_surface_add_listener(window->wl.shellSurface, &shellSurfaceListener, window); if (window->wl.title) wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title); if (window->monitor) { setFullscreen(window, window->monitor, 0); } else if (window->wl.maximized) { wl_shell_surface_set_maximized(window->wl.shellSurface, NULL); setIdleInhibitor(window, GLFW_FALSE); createDecorations(window); } else { wl_shell_surface_set_toplevel(window->wl.shellSurface); setIdleInhibitor(window, GLFW_FALSE); createDecorations(window); } wl_surface_commit(window->wl.surface); return GLFW_TRUE; } static void xdgToplevelHandleConfigure(void* data, struct xdg_toplevel* toplevel, int32_t width, int32_t height, struct wl_array* states) { _GLFWwindow* window = data; float aspectRatio; float targetRatio; uint32_t* state; GLFWbool maximized = GLFW_FALSE; GLFWbool fullscreen = GLFW_FALSE; GLFWbool activated = GLFW_FALSE; wl_array_for_each(state, states) { switch (*state) { case XDG_TOPLEVEL_STATE_MAXIMIZED: maximized = GLFW_TRUE; break; case XDG_TOPLEVEL_STATE_FULLSCREEN: fullscreen = GLFW_TRUE; break; case XDG_TOPLEVEL_STATE_RESIZING: break; case XDG_TOPLEVEL_STATE_ACTIVATED: activated = GLFW_TRUE; break; } } if (width != 0 && height != 0) { if (!maximized && !fullscreen) { if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) { aspectRatio = (float)width / (float)height; targetRatio = (float)window->numer / (float)window->denom; if (aspectRatio < targetRatio) height = width / targetRatio; else if (aspectRatio > targetRatio) width = height * targetRatio; } } _glfwInputWindowSize(window, width, height); _glfwPlatformSetWindowSize(window, width, height); _glfwInputWindowDamage(window); } if (window->wl.wasFullscreen && window->autoIconify) { if (!activated || !fullscreen) { _glfwPlatformIconifyWindow(window); window->wl.wasFullscreen = GLFW_FALSE; } } if (fullscreen && activated) window->wl.wasFullscreen = GLFW_TRUE; _glfwInputWindowFocus(window, activated); } static void xdgToplevelHandleClose(void* data, struct xdg_toplevel* toplevel) { _GLFWwindow* window = data; _glfwInputWindowCloseRequest(window); } static const struct xdg_toplevel_listener xdgToplevelListener = { xdgToplevelHandleConfigure, xdgToplevelHandleClose }; static void xdgSurfaceHandleConfigure(void* data, struct xdg_surface* surface, uint32_t serial) { xdg_surface_ack_configure(surface, serial); } static const struct xdg_surface_listener xdgSurfaceListener = { xdgSurfaceHandleConfigure }; static void setXdgDecorations(_GLFWwindow* window) { if (_glfw.wl.decorationManager) { window->wl.xdg.decoration = zxdg_decoration_manager_v1_get_toplevel_decoration( _glfw.wl.decorationManager, window->wl.xdg.toplevel); zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, &xdgDecorationListener, window); zxdg_toplevel_decoration_v1_set_mode( window->wl.xdg.decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); } else { window->wl.decorations.serverSide = GLFW_FALSE; createDecorations(window); } } static GLFWbool createXdgSurface(_GLFWwindow* window) { window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase, window->wl.surface); if (!window->wl.xdg.surface) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: xdg-surface creation failed"); return GLFW_FALSE; } xdg_surface_add_listener(window->wl.xdg.surface, &xdgSurfaceListener, window); window->wl.xdg.toplevel = xdg_surface_get_toplevel(window->wl.xdg.surface); if (!window->wl.xdg.toplevel) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: xdg-toplevel creation failed"); return GLFW_FALSE; } xdg_toplevel_add_listener(window->wl.xdg.toplevel, &xdgToplevelListener, window); if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title); if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) xdg_toplevel_set_min_size(window->wl.xdg.toplevel, window->minwidth, window->minheight); if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) xdg_toplevel_set_max_size(window->wl.xdg.toplevel, window->maxwidth, window->maxheight); if (window->monitor) { xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, window->monitor->wl.output); setIdleInhibitor(window, GLFW_TRUE); } else if (window->wl.maximized) { xdg_toplevel_set_maximized(window->wl.xdg.toplevel); setIdleInhibitor(window, GLFW_FALSE); setXdgDecorations(window); } else { setIdleInhibitor(window, GLFW_FALSE); setXdgDecorations(window); } wl_surface_commit(window->wl.surface); wl_display_roundtrip(_glfw.wl.display); return GLFW_TRUE; } static void setCursorImage(_GLFWwindow* window, _GLFWcursorWayland* cursorWayland) { struct itimerspec timer = {}; struct wl_cursor* wlCursor = cursorWayland->cursor; struct wl_cursor_image* image; struct wl_buffer* buffer; struct wl_surface* surface = _glfw.wl.cursorSurface; int scale = 1; if (!wlCursor) buffer = cursorWayland->buffer; else { if (window->wl.scale > 1 && cursorWayland->cursorHiDPI) { wlCursor = cursorWayland->cursorHiDPI; scale = 2; } image = wlCursor->images[cursorWayland->currentImage]; buffer = wl_cursor_image_get_buffer(image); if (!buffer) return; timer.it_value.tv_sec = image->delay / 1000; timer.it_value.tv_nsec = (image->delay % 1000) * 1000000; timerfd_settime(_glfw.wl.cursorTimerfd, 0, &timer, NULL); cursorWayland->width = image->width; cursorWayland->height = image->height; cursorWayland->xhot = image->hotspot_x; cursorWayland->yhot = image->hotspot_y; } wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, cursorWayland->xhot / scale, cursorWayland->yhot / scale); wl_surface_set_buffer_scale(surface, scale); wl_surface_attach(surface, buffer, 0, 0); wl_surface_damage(surface, 0, 0, cursorWayland->width, cursorWayland->height); wl_surface_commit(surface); } static void incrementCursorImage(_GLFWwindow* window) { _GLFWcursor* cursor; if (!window || window->wl.decorations.focus != mainWindow) return; cursor = window->wl.currentCursor; if (cursor && cursor->wl.cursor) { cursor->wl.currentImage += 1; cursor->wl.currentImage %= cursor->wl.cursor->image_count; setCursorImage(window, &cursor->wl); } } static void handleEvents(int timeout) { struct wl_display* display = _glfw.wl.display; struct pollfd fds[] = { { wl_display_get_fd(display), POLLIN }, { _glfw.wl.timerfd, POLLIN }, { _glfw.wl.cursorTimerfd, POLLIN }, }; ssize_t read_ret; uint64_t repeats, i; while (wl_display_prepare_read(display) != 0) wl_display_dispatch_pending(display); // If an error different from EAGAIN happens, we have likely been // disconnected from the Wayland session, try to handle that the best we // can. if (wl_display_flush(display) < 0 && errno != EAGAIN) { _GLFWwindow* window = _glfw.windowListHead; while (window) { _glfwInputWindowCloseRequest(window); window = window->next; } wl_display_cancel_read(display); return; } if (poll(fds, 3, timeout) > 0) { if (fds[0].revents & POLLIN) { wl_display_read_events(display); wl_display_dispatch_pending(display); } else { wl_display_cancel_read(display); } if (fds[1].revents & POLLIN) { read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats)); if (read_ret != 8) return; for (i = 0; i < repeats; ++i) _glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey, _glfw.wl.keyboardLastScancode, GLFW_REPEAT, _glfw.wl.xkb.modifiers); } if (fds[2].revents & POLLIN) { read_ret = read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)); if (read_ret != 8) return; incrementCursorImage(_glfw.wl.pointerFocus); } } else { wl_display_cancel_read(display); } } // Translates a GLFW standard cursor to a theme cursor name // static char *translateCursorShape(int shape) { switch (shape) { case GLFW_ARROW_CURSOR: return "left_ptr"; case GLFW_IBEAM_CURSOR: return "xterm"; case GLFW_CROSSHAIR_CURSOR: return "crosshair"; case GLFW_HAND_CURSOR: return "hand2"; case GLFW_HRESIZE_CURSOR: return "sb_h_double_arrow"; case GLFW_VRESIZE_CURSOR: return "sb_v_double_arrow"; } return NULL; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { window->wl.transparent = fbconfig->transparent; if (!createSurface(window, wndconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) { if (ctxconfig->source == GLFW_EGL_CONTEXT_API || ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { if (!_glfwInitOSMesa()) return GLFW_FALSE; if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } } if (wndconfig->title) window->wl.title = _glfw_strdup(wndconfig->title); if (wndconfig->visible) { if (_glfw.wl.wmBase) { if (!createXdgSurface(window)) return GLFW_FALSE; } else { if (!createShellSurface(window)) return GLFW_FALSE; } window->wl.visible = GLFW_TRUE; } else { window->wl.xdg.surface = NULL; window->wl.xdg.toplevel = NULL; window->wl.shellSurface = NULL; window->wl.visible = GLFW_FALSE; } window->wl.currentCursor = NULL; window->wl.monitors = calloc(1, sizeof(_GLFWmonitor*)); window->wl.monitorsCount = 0; window->wl.monitorsSize = 1; return GLFW_TRUE; } void _glfwPlatformDestroyWindow(_GLFWwindow* window) { if (window == _glfw.wl.pointerFocus) { _glfw.wl.pointerFocus = NULL; _glfwInputCursorEnter(window, GLFW_FALSE); } if (window == _glfw.wl.keyboardFocus) { _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, GLFW_FALSE); } if (window->wl.idleInhibitor) zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor); if (window->context.destroy) window->context.destroy(window); destroyDecorations(window); if (window->wl.xdg.decoration) zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); if (window->wl.decorations.buffer) wl_buffer_destroy(window->wl.decorations.buffer); if (window->wl.native) wl_egl_window_destroy(window->wl.native); if (window->wl.shellSurface) wl_shell_surface_destroy(window->wl.shellSurface); if (window->wl.xdg.toplevel) xdg_toplevel_destroy(window->wl.xdg.toplevel); if (window->wl.xdg.surface) xdg_surface_destroy(window->wl.xdg.surface); if (window->wl.surface) wl_surface_destroy(window->wl.surface); free(window->wl.title); free(window->wl.monitors); } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { if (window->wl.title) free(window->wl.title); window->wl.title = _glfw_strdup(title); if (window->wl.xdg.toplevel) xdg_toplevel_set_title(window->wl.xdg.toplevel, title); else if (window->wl.shellSurface) wl_shell_surface_set_title(window->wl.shellSurface, title); } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Setting window icon not supported"); } void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { // A Wayland client is not aware of its position, so just warn and leave it // as (0, 0) _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window position retrieval not supported"); } void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) { // A Wayland client can not set its position, so just warn _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window position setting not supported"); } void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { if (width) *width = window->wl.width; if (height) *height = window->wl.height; } void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { window->wl.width = width; window->wl.height = height; resizeWindow(window); } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { if (_glfw.wl.wmBase) { if (window->wl.xdg.toplevel) { if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) minwidth = minheight = 0; if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE) maxwidth = maxheight = 0; xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight); xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight); wl_surface_commit(window->wl.surface); } } else { // TODO: find out how to trigger a resize. // The actual limits are checked in the wl_shell_surface::configure handler. } } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom) { // TODO: find out how to trigger a resize. // The actual limits are checked in the wl_shell_surface::configure handler. } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { _glfwPlatformGetWindowSize(window, width, height); *width *= window->wl.scale; *height *= window->wl.scale; } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) { if (top) *top = _GLFW_DECORATION_TOP; if (left) *left = _GLFW_DECORATION_WIDTH; if (right) *right = _GLFW_DECORATION_WIDTH; if (bottom) *bottom = _GLFW_DECORATION_WIDTH; } } void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale) { if (xscale) *xscale = (float) window->wl.scale; if (yscale) *yscale = (float) window->wl.scale; } void _glfwPlatformIconifyWindow(_GLFWwindow* window) { if (_glfw.wl.wmBase) { if (window->wl.xdg.toplevel) xdg_toplevel_set_minimized(window->wl.xdg.toplevel); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Iconify window not supported on wl_shell"); } } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { if (window->wl.xdg.toplevel) { if (window->monitor) xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); if (window->wl.maximized) xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do here. } else if (window->wl.shellSurface) { if (window->monitor || window->wl.maximized) wl_shell_surface_set_toplevel(window->wl.shellSurface); } _glfwInputWindowMonitor(window, NULL); window->wl.maximized = GLFW_FALSE; } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (window->wl.xdg.toplevel) { xdg_toplevel_set_maximized(window->wl.xdg.toplevel); } else if (window->wl.shellSurface) { // Let the compositor select the best output. wl_shell_surface_set_maximized(window->wl.shellSurface, NULL); } window->wl.maximized = GLFW_TRUE; } void _glfwPlatformShowWindow(_GLFWwindow* window) { if (!window->wl.visible) { if (_glfw.wl.wmBase) createXdgSurface(window); else if (!window->wl.shellSurface) createShellSurface(window); window->wl.visible = GLFW_TRUE; } } void _glfwPlatformHideWindow(_GLFWwindow* window) { if (window->wl.xdg.toplevel) { xdg_toplevel_destroy(window->wl.xdg.toplevel); xdg_surface_destroy(window->wl.xdg.surface); window->wl.xdg.toplevel = NULL; window->wl.xdg.surface = NULL; } else if (window->wl.shellSurface) { wl_shell_surface_destroy(window->wl.shellSurface); window->wl.shellSurface = NULL; } window->wl.visible = GLFW_FALSE; } void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { // TODO _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window attention request not implemented yet"); } void _glfwPlatformFocusWindow(_GLFWwindow* window) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Focusing a window requires user interaction"); } void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate) { if (monitor) { setFullscreen(window, monitor, refreshRate); } else { if (window->wl.xdg.toplevel) xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); else if (window->wl.shellSurface) wl_shell_surface_set_toplevel(window->wl.shellSurface); setIdleInhibitor(window, GLFW_FALSE); if (!_glfw.wl.decorationManager) createDecorations(window); } _glfwInputWindowMonitor(window, monitor); } int _glfwPlatformWindowFocused(_GLFWwindow* window) { return _glfw.wl.keyboardFocus == window; } int _glfwPlatformWindowIconified(_GLFWwindow* window) { // wl_shell doesn't have any iconified concept, and xdg-shell doesn’t give // any way to request whether a surface is iconified. return GLFW_FALSE; } int _glfwPlatformWindowVisible(_GLFWwindow* window) { return window->wl.visible; } int _glfwPlatformWindowMaximized(_GLFWwindow* window) { return window->wl.maximized; } int _glfwPlatformWindowHovered(_GLFWwindow* window) { return window->wl.hovered; } int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { return window->wl.transparent; } void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { // TODO _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window attribute setting not implemented yet"); } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { if (!window->monitor) { if (enabled) createDecorations(window); else destroyDecorations(window); } } void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { // TODO _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window attribute setting not implemented yet"); } float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { return 1.f; } void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { } void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled) { // This is handled in relativePointerHandleRelativeMotion } GLFWbool _glfwPlatformRawMouseMotionSupported(void) { return GLFW_TRUE; } void _glfwPlatformPollEvents(void) { handleEvents(0); } void _glfwPlatformWaitEvents(void) { handleEvents(-1); } void _glfwPlatformWaitEventsTimeout(double timeout) { handleEvents((int) (timeout * 1e3)); } void _glfwPlatformPostEmptyEvent(void) { wl_display_sync(_glfw.wl.display); } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { if (xpos) *xpos = window->wl.cursorPosX; if (ypos) *ypos = window->wl.cursorPosY; } static GLFWbool isPointerLocked(_GLFWwindow* window); void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { if (isPointerLocked(window)) { zwp_locked_pointer_v1_set_cursor_position_hint( window->wl.pointerLock.lockedPointer, wl_fixed_from_double(x), wl_fixed_from_double(y)); wl_surface_commit(window->wl.surface); } } void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { _glfwPlatformSetCursor(window, window->wl.currentCursor); } const char* _glfwPlatformGetScancodeName(int scancode) { // TODO return NULL; } int _glfwPlatformGetKeyScancode(int key) { return _glfw.wl.scancodes[key]; } int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) { cursor->wl.buffer = createShmBuffer(image); if (!cursor->wl.buffer) return GLFW_FALSE; cursor->wl.width = image->width; cursor->wl.height = image->height; cursor->wl.xhot = xhot; cursor->wl.yhot = yhot; return GLFW_TRUE; } int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { struct wl_cursor* standardCursor; standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, translateCursorShape(shape)); if (!standardCursor) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Standard cursor \"%s\" not found", translateCursorShape(shape)); return GLFW_FALSE; } cursor->wl.cursor = standardCursor; cursor->wl.currentImage = 0; if (_glfw.wl.cursorThemeHiDPI) { standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, translateCursorShape(shape)); cursor->wl.cursorHiDPI = standardCursor; } return GLFW_TRUE; } void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) { // If it's a standard cursor we don't need to do anything here if (cursor->wl.cursor) return; if (cursor->wl.buffer) wl_buffer_destroy(cursor->wl.buffer); } static void relativePointerHandleRelativeMotion(void* data, struct zwp_relative_pointer_v1* pointer, uint32_t timeHi, uint32_t timeLo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dxUnaccel, wl_fixed_t dyUnaccel) { _GLFWwindow* window = data; double xpos = window->virtualCursorPosX; double ypos = window->virtualCursorPosY; if (window->cursorMode != GLFW_CURSOR_DISABLED) return; if (window->rawMouseMotion) { xpos += wl_fixed_to_double(dxUnaccel); ypos += wl_fixed_to_double(dyUnaccel); } else { xpos += wl_fixed_to_double(dx); ypos += wl_fixed_to_double(dy); } _glfwInputCursorPos(window, xpos, ypos); } static const struct zwp_relative_pointer_v1_listener relativePointerListener = { relativePointerHandleRelativeMotion }; static void lockedPointerHandleLocked(void* data, struct zwp_locked_pointer_v1* lockedPointer) { } static void unlockPointer(_GLFWwindow* window) { struct zwp_relative_pointer_v1* relativePointer = window->wl.pointerLock.relativePointer; struct zwp_locked_pointer_v1* lockedPointer = window->wl.pointerLock.lockedPointer; zwp_relative_pointer_v1_destroy(relativePointer); zwp_locked_pointer_v1_destroy(lockedPointer); window->wl.pointerLock.relativePointer = NULL; window->wl.pointerLock.lockedPointer = NULL; } static void lockPointer(_GLFWwindow* window); static void lockedPointerHandleUnlocked(void* data, struct zwp_locked_pointer_v1* lockedPointer) { } static const struct zwp_locked_pointer_v1_listener lockedPointerListener = { lockedPointerHandleLocked, lockedPointerHandleUnlocked }; static void lockPointer(_GLFWwindow* window) { struct zwp_relative_pointer_v1* relativePointer; struct zwp_locked_pointer_v1* lockedPointer; if (!_glfw.wl.relativePointerManager) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: no relative pointer manager"); return; } relativePointer = zwp_relative_pointer_manager_v1_get_relative_pointer( _glfw.wl.relativePointerManager, _glfw.wl.pointer); zwp_relative_pointer_v1_add_listener(relativePointer, &relativePointerListener, window); lockedPointer = zwp_pointer_constraints_v1_lock_pointer( _glfw.wl.pointerConstraints, window->wl.surface, _glfw.wl.pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); zwp_locked_pointer_v1_add_listener(lockedPointer, &lockedPointerListener, window); window->wl.pointerLock.relativePointer = relativePointer; window->wl.pointerLock.lockedPointer = lockedPointer; wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); } static GLFWbool isPointerLocked(_GLFWwindow* window) { return window->wl.pointerLock.lockedPointer != NULL; } void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { struct wl_cursor* defaultCursor; struct wl_cursor* defaultCursorHiDPI = NULL; if (!_glfw.wl.pointer) return; window->wl.currentCursor = cursor; // If we're not in the correct window just save the cursor // the next time the pointer enters the window the cursor will change if (window != _glfw.wl.pointerFocus || window->wl.decorations.focus != mainWindow) return; // Unlock possible pointer lock if no longer disabled. if (window->cursorMode != GLFW_CURSOR_DISABLED && isPointerLocked(window)) unlockPointer(window); if (window->cursorMode == GLFW_CURSOR_NORMAL) { if (cursor) setCursorImage(window, &cursor->wl); else { defaultCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr"); if (!defaultCursor) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Standard cursor not found"); return; } if (_glfw.wl.cursorThemeHiDPI) defaultCursorHiDPI = wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, "left_ptr"); _GLFWcursorWayland cursorWayland = { defaultCursor, defaultCursorHiDPI, NULL, 0, 0, 0, 0, 0 }; setCursorImage(window, &cursorWayland); } } else if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (!isPointerLocked(window)) lockPointer(window); } else if (window->cursorMode == GLFW_CURSOR_HIDDEN) { wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); } } static void dataSourceHandleTarget(void* data, struct wl_data_source* dataSource, const char* mimeType) { if (_glfw.wl.dataSource != dataSource) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unknown clipboard data source"); return; } } static void dataSourceHandleSend(void* data, struct wl_data_source* dataSource, const char* mimeType, int fd) { const char* string = _glfw.wl.clipboardSendString; size_t len = _glfw.wl.clipboardSendSize; int ret; if (_glfw.wl.dataSource != dataSource) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unknown clipboard data source"); return; } if (!string) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Copy requested from an invalid string"); return; } if (strcmp(mimeType, "text/plain;charset=utf-8") != 0) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Wrong MIME type asked from clipboard"); close(fd); return; } while (len > 0) { ret = write(fd, string, len); if (ret == -1 && errno == EINTR) continue; if (ret == -1) { // TODO: also report errno maybe. _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Error while writing the clipboard"); close(fd); return; } len -= ret; } close(fd); } static void dataSourceHandleCancelled(void* data, struct wl_data_source* dataSource) { wl_data_source_destroy(dataSource); if (_glfw.wl.dataSource != dataSource) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unknown clipboard data source"); return; } _glfw.wl.dataSource = NULL; } static const struct wl_data_source_listener dataSourceListener = { dataSourceHandleTarget, dataSourceHandleSend, dataSourceHandleCancelled, }; void _glfwPlatformSetClipboardString(const char* string) { if (_glfw.wl.dataSource) { wl_data_source_destroy(_glfw.wl.dataSource); _glfw.wl.dataSource = NULL; } if (_glfw.wl.clipboardSendString) { free(_glfw.wl.clipboardSendString); _glfw.wl.clipboardSendString = NULL; } _glfw.wl.clipboardSendString = strdup(string); if (!_glfw.wl.clipboardSendString) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Impossible to allocate clipboard string"); return; } _glfw.wl.clipboardSendSize = strlen(string); _glfw.wl.dataSource = wl_data_device_manager_create_data_source(_glfw.wl.dataDeviceManager); if (!_glfw.wl.dataSource) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Impossible to create clipboard source"); free(_glfw.wl.clipboardSendString); return; } wl_data_source_add_listener(_glfw.wl.dataSource, &dataSourceListener, NULL); wl_data_source_offer(_glfw.wl.dataSource, "text/plain;charset=utf-8"); wl_data_device_set_selection(_glfw.wl.dataDevice, _glfw.wl.dataSource, _glfw.wl.serial); } static GLFWbool growClipboardString(void) { char* clipboard = _glfw.wl.clipboardString; clipboard = realloc(clipboard, _glfw.wl.clipboardSize * 2); if (!clipboard) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Impossible to grow clipboard string"); return GLFW_FALSE; } _glfw.wl.clipboardString = clipboard; _glfw.wl.clipboardSize = _glfw.wl.clipboardSize * 2; return GLFW_TRUE; } const char* _glfwPlatformGetClipboardString(void) { int fds[2]; int ret; size_t len = 0; if (!_glfw.wl.dataOffer) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "No clipboard data has been sent yet"); return NULL; } ret = pipe2(fds, O_CLOEXEC); if (ret < 0) { // TODO: also report errno maybe? _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Impossible to create clipboard pipe fds"); return NULL; } wl_data_offer_receive(_glfw.wl.dataOffer, "text/plain;charset=utf-8", fds[1]); close(fds[1]); // XXX: this is a huge hack, this function shouldn’t be synchronous! handleEvents(-1); while (1) { // Grow the clipboard if we need to paste something bigger, there is no // shrink operation yet. if (len + 4096 > _glfw.wl.clipboardSize) { if (!growClipboardString()) { close(fds[0]); return NULL; } } // Then read from the fd to the clipboard, handling all known errors. ret = read(fds[0], _glfw.wl.clipboardString + len, 4096); if (ret == 0) break; if (ret == -1 && errno == EINTR) continue; if (ret == -1) { // TODO: also report errno maybe. _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Impossible to read from clipboard fd"); close(fds[0]); return NULL; } len += ret; } close(fds[0]); if (len + 1 > _glfw.wl.clipboardSize) { if (!growClipboardString()) return NULL; } _glfw.wl.clipboardString[len] = '\0'; return _glfw.wl.clipboardString; } void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) { if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_wayland_surface) return; extensions[0] = "VK_KHR_surface"; extensions[1] = "VK_KHR_wayland_surface"; } int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR vkGetPhysicalDeviceWaylandPresentationSupportKHR = (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR) vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); if (!vkGetPhysicalDeviceWaylandPresentationSupportKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "Wayland: Vulkan instance missing VK_KHR_wayland_surface extension"); return VK_NULL_HANDLE; } return vkGetPhysicalDeviceWaylandPresentationSupportKHR(device, queuefamily, _glfw.wl.display); } VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { VkResult err; VkWaylandSurfaceCreateInfoKHR sci; PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR; vkCreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR) vkGetInstanceProcAddr(instance, "vkCreateWaylandSurfaceKHR"); if (!vkCreateWaylandSurfaceKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "Wayland: Vulkan instance missing VK_KHR_wayland_surface extension"); return VK_ERROR_EXTENSION_NOT_PRESENT; } memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; sci.display = _glfw.wl.display; sci.surface = window->wl.surface; err = vkCreateWaylandSurfaceKHR(instance, &sci, allocator, surface); if (err) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create Vulkan surface: %s", _glfwGetVulkanResultString(err)); } return err; } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI struct wl_display* glfwGetWaylandDisplay(void) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return _glfw.wl.display; } GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return window->wl.surface; } ================================================ FILE: thirdparty/glfw/src/x11_init.c ================================================ //======================================================================== // GLFW 3.3 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include #include // Translate an X11 key code to a GLFW key code. // static int translateKeyCode(int scancode) { int keySym; // Valid key code range is [8,255], according to the Xlib manual if (scancode < 8 || scancode > 255) return GLFW_KEY_UNKNOWN; if (_glfw.x11.xkb.available) { // Try secondary keysym, for numeric keypad keys // Note: This way we always force "NumLock = ON", which is intentional // since the returned key code should correspond to a physical // location. keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 1); switch (keySym) { case XK_KP_0: return GLFW_KEY_KP_0; case XK_KP_1: return GLFW_KEY_KP_1; case XK_KP_2: return GLFW_KEY_KP_2; case XK_KP_3: return GLFW_KEY_KP_3; case XK_KP_4: return GLFW_KEY_KP_4; case XK_KP_5: return GLFW_KEY_KP_5; case XK_KP_6: return GLFW_KEY_KP_6; case XK_KP_7: return GLFW_KEY_KP_7; case XK_KP_8: return GLFW_KEY_KP_8; case XK_KP_9: return GLFW_KEY_KP_9; case XK_KP_Separator: case XK_KP_Decimal: return GLFW_KEY_KP_DECIMAL; case XK_KP_Equal: return GLFW_KEY_KP_EQUAL; case XK_KP_Enter: return GLFW_KEY_KP_ENTER; default: break; } // Now try primary keysym for function keys (non-printable keys) // These should not depend on the current keyboard layout keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 0); } else { int dummy; KeySym* keySyms; keySyms = XGetKeyboardMapping(_glfw.x11.display, scancode, 1, &dummy); keySym = keySyms[0]; XFree(keySyms); } switch (keySym) { case XK_Escape: return GLFW_KEY_ESCAPE; case XK_Tab: return GLFW_KEY_TAB; case XK_Shift_L: return GLFW_KEY_LEFT_SHIFT; case XK_Shift_R: return GLFW_KEY_RIGHT_SHIFT; case XK_Control_L: return GLFW_KEY_LEFT_CONTROL; case XK_Control_R: return GLFW_KEY_RIGHT_CONTROL; case XK_Meta_L: case XK_Alt_L: return GLFW_KEY_LEFT_ALT; case XK_Mode_switch: // Mapped to Alt_R on many keyboards case XK_ISO_Level3_Shift: // AltGr on at least some machines case XK_Meta_R: case XK_Alt_R: return GLFW_KEY_RIGHT_ALT; case XK_Super_L: return GLFW_KEY_LEFT_SUPER; case XK_Super_R: return GLFW_KEY_RIGHT_SUPER; case XK_Menu: return GLFW_KEY_MENU; case XK_Num_Lock: return GLFW_KEY_NUM_LOCK; case XK_Caps_Lock: return GLFW_KEY_CAPS_LOCK; case XK_Print: return GLFW_KEY_PRINT_SCREEN; case XK_Scroll_Lock: return GLFW_KEY_SCROLL_LOCK; case XK_Pause: return GLFW_KEY_PAUSE; case XK_Delete: return GLFW_KEY_DELETE; case XK_BackSpace: return GLFW_KEY_BACKSPACE; case XK_Return: return GLFW_KEY_ENTER; case XK_Home: return GLFW_KEY_HOME; case XK_End: return GLFW_KEY_END; case XK_Page_Up: return GLFW_KEY_PAGE_UP; case XK_Page_Down: return GLFW_KEY_PAGE_DOWN; case XK_Insert: return GLFW_KEY_INSERT; case XK_Left: return GLFW_KEY_LEFT; case XK_Right: return GLFW_KEY_RIGHT; case XK_Down: return GLFW_KEY_DOWN; case XK_Up: return GLFW_KEY_UP; case XK_F1: return GLFW_KEY_F1; case XK_F2: return GLFW_KEY_F2; case XK_F3: return GLFW_KEY_F3; case XK_F4: return GLFW_KEY_F4; case XK_F5: return GLFW_KEY_F5; case XK_F6: return GLFW_KEY_F6; case XK_F7: return GLFW_KEY_F7; case XK_F8: return GLFW_KEY_F8; case XK_F9: return GLFW_KEY_F9; case XK_F10: return GLFW_KEY_F10; case XK_F11: return GLFW_KEY_F11; case XK_F12: return GLFW_KEY_F12; case XK_F13: return GLFW_KEY_F13; case XK_F14: return GLFW_KEY_F14; case XK_F15: return GLFW_KEY_F15; case XK_F16: return GLFW_KEY_F16; case XK_F17: return GLFW_KEY_F17; case XK_F18: return GLFW_KEY_F18; case XK_F19: return GLFW_KEY_F19; case XK_F20: return GLFW_KEY_F20; case XK_F21: return GLFW_KEY_F21; case XK_F22: return GLFW_KEY_F22; case XK_F23: return GLFW_KEY_F23; case XK_F24: return GLFW_KEY_F24; case XK_F25: return GLFW_KEY_F25; // Numeric keypad case XK_KP_Divide: return GLFW_KEY_KP_DIVIDE; case XK_KP_Multiply: return GLFW_KEY_KP_MULTIPLY; case XK_KP_Subtract: return GLFW_KEY_KP_SUBTRACT; case XK_KP_Add: return GLFW_KEY_KP_ADD; // These should have been detected in secondary keysym test above! case XK_KP_Insert: return GLFW_KEY_KP_0; case XK_KP_End: return GLFW_KEY_KP_1; case XK_KP_Down: return GLFW_KEY_KP_2; case XK_KP_Page_Down: return GLFW_KEY_KP_3; case XK_KP_Left: return GLFW_KEY_KP_4; case XK_KP_Right: return GLFW_KEY_KP_6; case XK_KP_Home: return GLFW_KEY_KP_7; case XK_KP_Up: return GLFW_KEY_KP_8; case XK_KP_Page_Up: return GLFW_KEY_KP_9; case XK_KP_Delete: return GLFW_KEY_KP_DECIMAL; case XK_KP_Equal: return GLFW_KEY_KP_EQUAL; case XK_KP_Enter: return GLFW_KEY_KP_ENTER; // Last resort: Check for printable keys (should not happen if the XKB // extension is available). This will give a layout dependent mapping // (which is wrong, and we may miss some keys, especially on non-US // keyboards), but it's better than nothing... case XK_a: return GLFW_KEY_A; case XK_b: return GLFW_KEY_B; case XK_c: return GLFW_KEY_C; case XK_d: return GLFW_KEY_D; case XK_e: return GLFW_KEY_E; case XK_f: return GLFW_KEY_F; case XK_g: return GLFW_KEY_G; case XK_h: return GLFW_KEY_H; case XK_i: return GLFW_KEY_I; case XK_j: return GLFW_KEY_J; case XK_k: return GLFW_KEY_K; case XK_l: return GLFW_KEY_L; case XK_m: return GLFW_KEY_M; case XK_n: return GLFW_KEY_N; case XK_o: return GLFW_KEY_O; case XK_p: return GLFW_KEY_P; case XK_q: return GLFW_KEY_Q; case XK_r: return GLFW_KEY_R; case XK_s: return GLFW_KEY_S; case XK_t: return GLFW_KEY_T; case XK_u: return GLFW_KEY_U; case XK_v: return GLFW_KEY_V; case XK_w: return GLFW_KEY_W; case XK_x: return GLFW_KEY_X; case XK_y: return GLFW_KEY_Y; case XK_z: return GLFW_KEY_Z; case XK_1: return GLFW_KEY_1; case XK_2: return GLFW_KEY_2; case XK_3: return GLFW_KEY_3; case XK_4: return GLFW_KEY_4; case XK_5: return GLFW_KEY_5; case XK_6: return GLFW_KEY_6; case XK_7: return GLFW_KEY_7; case XK_8: return GLFW_KEY_8; case XK_9: return GLFW_KEY_9; case XK_0: return GLFW_KEY_0; case XK_space: return GLFW_KEY_SPACE; case XK_minus: return GLFW_KEY_MINUS; case XK_equal: return GLFW_KEY_EQUAL; case XK_bracketleft: return GLFW_KEY_LEFT_BRACKET; case XK_bracketright: return GLFW_KEY_RIGHT_BRACKET; case XK_backslash: return GLFW_KEY_BACKSLASH; case XK_semicolon: return GLFW_KEY_SEMICOLON; case XK_apostrophe: return GLFW_KEY_APOSTROPHE; case XK_grave: return GLFW_KEY_GRAVE_ACCENT; case XK_comma: return GLFW_KEY_COMMA; case XK_period: return GLFW_KEY_PERIOD; case XK_slash: return GLFW_KEY_SLASH; case XK_less: return GLFW_KEY_WORLD_1; // At least in some layouts... default: break; } // No matching translation was found return GLFW_KEY_UNKNOWN; } // Create key code translation tables // static void createKeyTables(void) { int scancode, key; memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes)); memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes)); if (_glfw.x11.xkb.available) { // Use XKB to determine physical key locations independently of the // current keyboard layout char name[XkbKeyNameLength + 1]; XkbDescPtr desc = XkbGetMap(_glfw.x11.display, 0, XkbUseCoreKbd); XkbGetNames(_glfw.x11.display, XkbKeyNamesMask, desc); // Find the X11 key code -> GLFW key code mapping for (scancode = desc->min_key_code; scancode <= desc->max_key_code; scancode++) { memcpy(name, desc->names->keys[scancode].name, XkbKeyNameLength); name[XkbKeyNameLength] = '\0'; // Map the key name to a GLFW key code. Note: We only map printable // keys here, and we use the US keyboard layout. The rest of the // keys (function keys) are mapped using traditional KeySym // translations. if (strcmp(name, "TLDE") == 0) key = GLFW_KEY_GRAVE_ACCENT; else if (strcmp(name, "AE01") == 0) key = GLFW_KEY_1; else if (strcmp(name, "AE02") == 0) key = GLFW_KEY_2; else if (strcmp(name, "AE03") == 0) key = GLFW_KEY_3; else if (strcmp(name, "AE04") == 0) key = GLFW_KEY_4; else if (strcmp(name, "AE05") == 0) key = GLFW_KEY_5; else if (strcmp(name, "AE06") == 0) key = GLFW_KEY_6; else if (strcmp(name, "AE07") == 0) key = GLFW_KEY_7; else if (strcmp(name, "AE08") == 0) key = GLFW_KEY_8; else if (strcmp(name, "AE09") == 0) key = GLFW_KEY_9; else if (strcmp(name, "AE10") == 0) key = GLFW_KEY_0; else if (strcmp(name, "AE11") == 0) key = GLFW_KEY_MINUS; else if (strcmp(name, "AE12") == 0) key = GLFW_KEY_EQUAL; else if (strcmp(name, "AD01") == 0) key = GLFW_KEY_Q; else if (strcmp(name, "AD02") == 0) key = GLFW_KEY_W; else if (strcmp(name, "AD03") == 0) key = GLFW_KEY_E; else if (strcmp(name, "AD04") == 0) key = GLFW_KEY_R; else if (strcmp(name, "AD05") == 0) key = GLFW_KEY_T; else if (strcmp(name, "AD06") == 0) key = GLFW_KEY_Y; else if (strcmp(name, "AD07") == 0) key = GLFW_KEY_U; else if (strcmp(name, "AD08") == 0) key = GLFW_KEY_I; else if (strcmp(name, "AD09") == 0) key = GLFW_KEY_O; else if (strcmp(name, "AD10") == 0) key = GLFW_KEY_P; else if (strcmp(name, "AD11") == 0) key = GLFW_KEY_LEFT_BRACKET; else if (strcmp(name, "AD12") == 0) key = GLFW_KEY_RIGHT_BRACKET; else if (strcmp(name, "AC01") == 0) key = GLFW_KEY_A; else if (strcmp(name, "AC02") == 0) key = GLFW_KEY_S; else if (strcmp(name, "AC03") == 0) key = GLFW_KEY_D; else if (strcmp(name, "AC04") == 0) key = GLFW_KEY_F; else if (strcmp(name, "AC05") == 0) key = GLFW_KEY_G; else if (strcmp(name, "AC06") == 0) key = GLFW_KEY_H; else if (strcmp(name, "AC07") == 0) key = GLFW_KEY_J; else if (strcmp(name, "AC08") == 0) key = GLFW_KEY_K; else if (strcmp(name, "AC09") == 0) key = GLFW_KEY_L; else if (strcmp(name, "AC10") == 0) key = GLFW_KEY_SEMICOLON; else if (strcmp(name, "AC11") == 0) key = GLFW_KEY_APOSTROPHE; else if (strcmp(name, "AB01") == 0) key = GLFW_KEY_Z; else if (strcmp(name, "AB02") == 0) key = GLFW_KEY_X; else if (strcmp(name, "AB03") == 0) key = GLFW_KEY_C; else if (strcmp(name, "AB04") == 0) key = GLFW_KEY_V; else if (strcmp(name, "AB05") == 0) key = GLFW_KEY_B; else if (strcmp(name, "AB06") == 0) key = GLFW_KEY_N; else if (strcmp(name, "AB07") == 0) key = GLFW_KEY_M; else if (strcmp(name, "AB08") == 0) key = GLFW_KEY_COMMA; else if (strcmp(name, "AB09") == 0) key = GLFW_KEY_PERIOD; else if (strcmp(name, "AB10") == 0) key = GLFW_KEY_SLASH; else if (strcmp(name, "BKSL") == 0) key = GLFW_KEY_BACKSLASH; else if (strcmp(name, "LSGT") == 0) key = GLFW_KEY_WORLD_1; else key = GLFW_KEY_UNKNOWN; if ((scancode >= 0) && (scancode < 256)) _glfw.x11.keycodes[scancode] = key; } XkbFreeNames(desc, XkbKeyNamesMask, True); XkbFreeKeyboard(desc, 0, True); } for (scancode = 0; scancode < 256; scancode++) { // Translate the un-translated key codes using traditional X11 KeySym // lookups if (_glfw.x11.keycodes[scancode] < 0) _glfw.x11.keycodes[scancode] = translateKeyCode(scancode); // Store the reverse translation for faster key name lookup if (_glfw.x11.keycodes[scancode] > 0) _glfw.x11.scancodes[_glfw.x11.keycodes[scancode]] = scancode; } } // Check whether the IM has a usable style // static GLFWbool hasUsableInputMethodStyle(void) { GLFWbool found = GLFW_FALSE; XIMStyles* styles = NULL; if (XGetIMValues(_glfw.x11.im, XNQueryInputStyle, &styles, NULL) != NULL) return GLFW_FALSE; for (unsigned int i = 0; i < styles->count_styles; i++) { if (styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing)) { found = GLFW_TRUE; break; } } XFree(styles); return found; } // Check whether the specified atom is supported // static Atom getSupportedAtom(Atom* supportedAtoms, unsigned long atomCount, const char* atomName) { const Atom atom = XInternAtom(_glfw.x11.display, atomName, False); for (unsigned int i = 0; i < atomCount; i++) { if (supportedAtoms[i] == atom) return atom; } return None; } // Check whether the running window manager is EWMH-compliant // static void detectEWMH(void) { // First we read the _NET_SUPPORTING_WM_CHECK property on the root window Window* windowFromRoot = NULL; if (!_glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_SUPPORTING_WM_CHECK, XA_WINDOW, (unsigned char**) &windowFromRoot)) { return; } _glfwGrabErrorHandlerX11(); // If it exists, it should be the XID of a top-level window // Then we look for the same property on that window Window* windowFromChild = NULL; if (!_glfwGetWindowPropertyX11(*windowFromRoot, _glfw.x11.NET_SUPPORTING_WM_CHECK, XA_WINDOW, (unsigned char**) &windowFromChild)) { XFree(windowFromRoot); return; } _glfwReleaseErrorHandlerX11(); // If the property exists, it should contain the XID of the window if (*windowFromRoot != *windowFromChild) { XFree(windowFromRoot); XFree(windowFromChild); return; } XFree(windowFromRoot); XFree(windowFromChild); // We are now fairly sure that an EWMH-compliant WM is currently running // We can now start querying the WM about what features it supports by // looking in the _NET_SUPPORTED property on the root window // It should contain a list of supported EWMH protocol and state atoms Atom* supportedAtoms = NULL; const unsigned long atomCount = _glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_SUPPORTED, XA_ATOM, (unsigned char**) &supportedAtoms); // See which of the atoms we support that are supported by the WM _glfw.x11.NET_WM_STATE = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE"); _glfw.x11.NET_WM_STATE_ABOVE = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE"); _glfw.x11.NET_WM_STATE_FULLSCREEN = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN"); _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT"); _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ"); _glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION"); _glfw.x11.NET_WM_FULLSCREEN_MONITORS = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS"); _glfw.x11.NET_WM_WINDOW_TYPE = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE"); _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL"); _glfw.x11.NET_WORKAREA = getSupportedAtom(supportedAtoms, atomCount, "_NET_WORKAREA"); _glfw.x11.NET_CURRENT_DESKTOP = getSupportedAtom(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP"); _glfw.x11.NET_ACTIVE_WINDOW = getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW"); _glfw.x11.NET_FRAME_EXTENTS = getSupportedAtom(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS"); _glfw.x11.NET_REQUEST_FRAME_EXTENTS = getSupportedAtom(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS"); if (supportedAtoms) XFree(supportedAtoms); } // Look for and initialize supported X11 extensions // static GLFWbool initExtensions(void) { _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1"); if (_glfw.x11.vidmode.handle) { _glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension) _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeQueryExtension"); _glfw.x11.vidmode.GetGammaRamp = (PFN_XF86VidModeGetGammaRamp) _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeGetGammaRamp"); _glfw.x11.vidmode.SetGammaRamp = (PFN_XF86VidModeSetGammaRamp) _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeSetGammaRamp"); _glfw.x11.vidmode.GetGammaRampSize = (PFN_XF86VidModeGetGammaRampSize) _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeGetGammaRampSize"); _glfw.x11.vidmode.available = XF86VidModeQueryExtension(_glfw.x11.display, &_glfw.x11.vidmode.eventBase, &_glfw.x11.vidmode.errorBase); } #if defined(__CYGWIN__) _glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so"); #else _glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6"); #endif if (_glfw.x11.xi.handle) { _glfw.x11.xi.QueryVersion = (PFN_XIQueryVersion) _glfw_dlsym(_glfw.x11.xi.handle, "XIQueryVersion"); _glfw.x11.xi.SelectEvents = (PFN_XISelectEvents) _glfw_dlsym(_glfw.x11.xi.handle, "XISelectEvents"); if (XQueryExtension(_glfw.x11.display, "XInputExtension", &_glfw.x11.xi.majorOpcode, &_glfw.x11.xi.eventBase, &_glfw.x11.xi.errorBase)) { _glfw.x11.xi.major = 2; _glfw.x11.xi.minor = 0; if (XIQueryVersion(_glfw.x11.display, &_glfw.x11.xi.major, &_glfw.x11.xi.minor) == Success) { _glfw.x11.xi.available = GLFW_TRUE; } } } #if defined(__CYGWIN__) _glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so"); #else _glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2"); #endif if (_glfw.x11.randr.handle) { _glfw.x11.randr.AllocGamma = (PFN_XRRAllocGamma) _glfw_dlsym(_glfw.x11.randr.handle, "XRRAllocGamma"); _glfw.x11.randr.FreeGamma = (PFN_XRRFreeGamma) _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeGamma"); _glfw.x11.randr.FreeCrtcInfo = (PFN_XRRFreeCrtcInfo) _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeCrtcInfo"); _glfw.x11.randr.FreeGamma = (PFN_XRRFreeGamma) _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeGamma"); _glfw.x11.randr.FreeOutputInfo = (PFN_XRRFreeOutputInfo) _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeOutputInfo"); _glfw.x11.randr.FreeScreenResources = (PFN_XRRFreeScreenResources) _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeScreenResources"); _glfw.x11.randr.GetCrtcGamma = (PFN_XRRGetCrtcGamma) _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetCrtcGamma"); _glfw.x11.randr.GetCrtcGammaSize = (PFN_XRRGetCrtcGammaSize) _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetCrtcGammaSize"); _glfw.x11.randr.GetCrtcInfo = (PFN_XRRGetCrtcInfo) _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetCrtcInfo"); _glfw.x11.randr.GetOutputInfo = (PFN_XRRGetOutputInfo) _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetOutputInfo"); _glfw.x11.randr.GetOutputPrimary = (PFN_XRRGetOutputPrimary) _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetOutputPrimary"); _glfw.x11.randr.GetScreenResourcesCurrent = (PFN_XRRGetScreenResourcesCurrent) _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetScreenResourcesCurrent"); _glfw.x11.randr.QueryExtension = (PFN_XRRQueryExtension) _glfw_dlsym(_glfw.x11.randr.handle, "XRRQueryExtension"); _glfw.x11.randr.QueryVersion = (PFN_XRRQueryVersion) _glfw_dlsym(_glfw.x11.randr.handle, "XRRQueryVersion"); _glfw.x11.randr.SelectInput = (PFN_XRRSelectInput) _glfw_dlsym(_glfw.x11.randr.handle, "XRRSelectInput"); _glfw.x11.randr.SetCrtcConfig = (PFN_XRRSetCrtcConfig) _glfw_dlsym(_glfw.x11.randr.handle, "XRRSetCrtcConfig"); _glfw.x11.randr.SetCrtcGamma = (PFN_XRRSetCrtcGamma) _glfw_dlsym(_glfw.x11.randr.handle, "XRRSetCrtcGamma"); _glfw.x11.randr.UpdateConfiguration = (PFN_XRRUpdateConfiguration) _glfw_dlsym(_glfw.x11.randr.handle, "XRRUpdateConfiguration"); if (XRRQueryExtension(_glfw.x11.display, &_glfw.x11.randr.eventBase, &_glfw.x11.randr.errorBase)) { if (XRRQueryVersion(_glfw.x11.display, &_glfw.x11.randr.major, &_glfw.x11.randr.minor)) { // The GLFW RandR path requires at least version 1.3 if (_glfw.x11.randr.major > 1 || _glfw.x11.randr.minor >= 3) _glfw.x11.randr.available = GLFW_TRUE; } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to query RandR version"); } } } if (_glfw.x11.randr.available) { XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0])) { // This is likely an older Nvidia driver with broken gamma support // Flag it as useless and fall back to xf86vm gamma, if available _glfw.x11.randr.gammaBroken = GLFW_TRUE; } if (!sr->ncrtc) { // A system without CRTCs is likely a system with broken RandR // Disable the RandR monitor path and fall back to core functions _glfw.x11.randr.monitorBroken = GLFW_TRUE; } XRRFreeScreenResources(sr); } if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRSelectInput(_glfw.x11.display, _glfw.x11.root, RROutputChangeNotifyMask); } #if defined(__CYGWIN__) _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so"); #else _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1"); #endif if (_glfw.x11.xcursor.handle) { _glfw.x11.xcursor.ImageCreate = (PFN_XcursorImageCreate) _glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageCreate"); _glfw.x11.xcursor.ImageDestroy = (PFN_XcursorImageDestroy) _glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy"); _glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor) _glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor"); } #if defined(__CYGWIN__) _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so"); #else _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1"); #endif if (_glfw.x11.xinerama.handle) { _glfw.x11.xinerama.IsActive = (PFN_XineramaIsActive) _glfw_dlsym(_glfw.x11.xinerama.handle, "XineramaIsActive"); _glfw.x11.xinerama.QueryExtension = (PFN_XineramaQueryExtension) _glfw_dlsym(_glfw.x11.xinerama.handle, "XineramaQueryExtension"); _glfw.x11.xinerama.QueryScreens = (PFN_XineramaQueryScreens) _glfw_dlsym(_glfw.x11.xinerama.handle, "XineramaQueryScreens"); if (XineramaQueryExtension(_glfw.x11.display, &_glfw.x11.xinerama.major, &_glfw.x11.xinerama.minor)) { if (XineramaIsActive(_glfw.x11.display)) _glfw.x11.xinerama.available = GLFW_TRUE; } } _glfw.x11.xkb.major = 1; _glfw.x11.xkb.minor = 0; _glfw.x11.xkb.available = XkbQueryExtension(_glfw.x11.display, &_glfw.x11.xkb.majorOpcode, &_glfw.x11.xkb.eventBase, &_glfw.x11.xkb.errorBase, &_glfw.x11.xkb.major, &_glfw.x11.xkb.minor); if (_glfw.x11.xkb.available) { Bool supported; if (XkbSetDetectableAutoRepeat(_glfw.x11.display, True, &supported)) { if (supported) _glfw.x11.xkb.detectable = GLFW_TRUE; } _glfw.x11.xkb.group = 0; XkbStateRec state; if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success) { XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask); _glfw.x11.xkb.group = (unsigned int)state.group; } } #if defined(__CYGWIN__) _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so"); #else _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1"); #endif if (_glfw.x11.x11xcb.handle) { _glfw.x11.x11xcb.GetXCBConnection = (PFN_XGetXCBConnection) _glfw_dlsym(_glfw.x11.x11xcb.handle, "XGetXCBConnection"); } #if defined(__CYGWIN__) _glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so"); #else _glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1"); #endif if (_glfw.x11.xrender.handle) { _glfw.x11.xrender.QueryExtension = (PFN_XRenderQueryExtension) _glfw_dlsym(_glfw.x11.xrender.handle, "XRenderQueryExtension"); _glfw.x11.xrender.QueryVersion = (PFN_XRenderQueryVersion) _glfw_dlsym(_glfw.x11.xrender.handle, "XRenderQueryVersion"); _glfw.x11.xrender.FindVisualFormat = (PFN_XRenderFindVisualFormat) _glfw_dlsym(_glfw.x11.xrender.handle, "XRenderFindVisualFormat"); if (XRenderQueryExtension(_glfw.x11.display, &_glfw.x11.xrender.errorBase, &_glfw.x11.xrender.eventBase)) { if (XRenderQueryVersion(_glfw.x11.display, &_glfw.x11.xrender.major, &_glfw.x11.xrender.minor)) { _glfw.x11.xrender.available = GLFW_TRUE; } } } // Update the key code LUT // FIXME: We should listen to XkbMapNotify events to track changes to // the keyboard mapping. createKeyTables(); // String format atoms _glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False); _glfw.x11.UTF8_STRING = XInternAtom(_glfw.x11.display, "UTF8_STRING", False); _glfw.x11.ATOM_PAIR = XInternAtom(_glfw.x11.display, "ATOM_PAIR", False); // Custom selection property atom _glfw.x11.GLFW_SELECTION = XInternAtom(_glfw.x11.display, "GLFW_SELECTION", False); // ICCCM standard clipboard atoms _glfw.x11.TARGETS = XInternAtom(_glfw.x11.display, "TARGETS", False); _glfw.x11.MULTIPLE = XInternAtom(_glfw.x11.display, "MULTIPLE", False); _glfw.x11.PRIMARY = XInternAtom(_glfw.x11.display, "PRIMARY", False); _glfw.x11.INCR = XInternAtom(_glfw.x11.display, "INCR", False); _glfw.x11.CLIPBOARD = XInternAtom(_glfw.x11.display, "CLIPBOARD", False); // Clipboard manager atoms _glfw.x11.CLIPBOARD_MANAGER = XInternAtom(_glfw.x11.display, "CLIPBOARD_MANAGER", False); _glfw.x11.SAVE_TARGETS = XInternAtom(_glfw.x11.display, "SAVE_TARGETS", False); // Xdnd (drag and drop) atoms _glfw.x11.XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", False); _glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", False); _glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", False); _glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", False); _glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", False); _glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", False); _glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", False); _glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False); _glfw.x11.XdndTypeList = XInternAtom(_glfw.x11.display, "XdndTypeList", False); _glfw.x11.text_uri_list = XInternAtom(_glfw.x11.display, "text/uri-list", False); // ICCCM, EWMH and Motif window property atoms // These can be set safely even without WM support // The EWMH atoms that require WM support are handled in detectEWMH _glfw.x11.WM_PROTOCOLS = XInternAtom(_glfw.x11.display, "WM_PROTOCOLS", False); _glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False); _glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display, "WM_DELETE_WINDOW", False); _glfw.x11.NET_SUPPORTED = XInternAtom(_glfw.x11.display, "_NET_SUPPORTED", False); _glfw.x11.NET_SUPPORTING_WM_CHECK = XInternAtom(_glfw.x11.display, "_NET_SUPPORTING_WM_CHECK", False); _glfw.x11.NET_WM_ICON = XInternAtom(_glfw.x11.display, "_NET_WM_ICON", False); _glfw.x11.NET_WM_PING = XInternAtom(_glfw.x11.display, "_NET_WM_PING", False); _glfw.x11.NET_WM_PID = XInternAtom(_glfw.x11.display, "_NET_WM_PID", False); _glfw.x11.NET_WM_NAME = XInternAtom(_glfw.x11.display, "_NET_WM_NAME", False); _glfw.x11.NET_WM_ICON_NAME = XInternAtom(_glfw.x11.display, "_NET_WM_ICON_NAME", False); _glfw.x11.NET_WM_BYPASS_COMPOSITOR = XInternAtom(_glfw.x11.display, "_NET_WM_BYPASS_COMPOSITOR", False); _glfw.x11.NET_WM_WINDOW_OPACITY = XInternAtom(_glfw.x11.display, "_NET_WM_WINDOW_OPACITY", False); _glfw.x11.MOTIF_WM_HINTS = XInternAtom(_glfw.x11.display, "_MOTIF_WM_HINTS", False); // The compositing manager selection name contains the screen number { char name[32]; snprintf(name, sizeof(name), "_NET_WM_CM_S%u", _glfw.x11.screen); _glfw.x11.NET_WM_CM_Sx = XInternAtom(_glfw.x11.display, name, False); } // Detect whether an EWMH-conformant window manager is running detectEWMH(); return GLFW_TRUE; } // Retrieve system content scale via folklore heuristics // static void getSystemContentScale(float* xscale, float* yscale) { // Start by assuming the default X11 DPI // NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it // would be set to 96, so assume that is the case if we cannot find it float xdpi = 96.f, ydpi = 96.f; // NOTE: Basing the scale on Xft.dpi where available should provide the most // consistent user experience (matches Qt, Gtk, etc), although not // always the most accurate one char* rms = XResourceManagerString(_glfw.x11.display); if (rms) { XrmDatabase db = XrmGetStringDatabase(rms); if (db) { XrmValue value; char* type = NULL; if (XrmGetResource(db, "Xft.dpi", "Xft.Dpi", &type, &value)) { if (type && strcmp(type, "String") == 0) xdpi = ydpi = atof(value.addr); } XrmDestroyDatabase(db); } } *xscale = xdpi / 96.f; *yscale = ydpi / 96.f; } // Create a blank cursor for hidden and disabled cursor modes // static Cursor createHiddenCursor(void) { unsigned char pixels[16 * 16 * 4] = { 0 }; GLFWimage image = { 16, 16, pixels }; return _glfwCreateCursorX11(&image, 0, 0); } // Create a helper window for IPC // static Window createHelperWindow(void) { XSetWindowAttributes wa; wa.event_mask = PropertyChangeMask; return XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, 1, 1, 0, 0, InputOnly, DefaultVisual(_glfw.x11.display, _glfw.x11.screen), CWEventMask, &wa); } // X error handler // static int errorHandler(Display *display, XErrorEvent* event) { _glfw.x11.errorCode = event->error_code; return 0; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Sets the X error handler callback // void _glfwGrabErrorHandlerX11(void) { _glfw.x11.errorCode = Success; XSetErrorHandler(errorHandler); } // Clears the X error handler callback // void _glfwReleaseErrorHandlerX11(void) { // Synchronize to make sure all commands are processed XSync(_glfw.x11.display, False); XSetErrorHandler(NULL); } // Reports the specified error, appending information about the last X error // void _glfwInputErrorX11(int error, const char* message) { char buffer[_GLFW_MESSAGE_SIZE]; XGetErrorText(_glfw.x11.display, _glfw.x11.errorCode, buffer, sizeof(buffer)); _glfwInputError(error, "%s: %s", message, buffer); } // Creates a native cursor object from the specified image and hotspot // Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot) { int i; Cursor cursor; if (!_glfw.x11.xcursor.handle) return None; XcursorImage* native = XcursorImageCreate(image->width, image->height); if (native == NULL) return None; native->xhot = xhot; native->yhot = yhot; unsigned char* source = (unsigned char*) image->pixels; XcursorPixel* target = native->pixels; for (i = 0; i < image->width * image->height; i++, target++, source += 4) { unsigned int alpha = source[3]; *target = (alpha << 24) | ((unsigned char) ((source[0] * alpha) / 255) << 16) | ((unsigned char) ((source[1] * alpha) / 255) << 8) | ((unsigned char) ((source[2] * alpha) / 255) << 0); } cursor = XcursorImageLoadCursor(_glfw.x11.display, native); XcursorImageDestroy(native); return cursor; } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformInit(void) { #if !defined(X_HAVE_UTF8_STRING) // HACK: If the current locale is "C" and the Xlib UTF-8 functions are // unavailable, apply the environment's locale in the hope that it's // both available and not "C" // This is done because the "C" locale breaks wide character input, // which is what we fall back on when UTF-8 support is missing if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0) setlocale(LC_CTYPE, ""); #endif XInitThreads(); XrmInitialize(); _glfw.x11.display = XOpenDisplay(NULL); if (!_glfw.x11.display) { const char* display = getenv("DISPLAY"); if (display) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open display %s", display); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: The DISPLAY environment variable is missing"); } return GLFW_FALSE; } _glfw.x11.screen = DefaultScreen(_glfw.x11.display); _glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen); _glfw.x11.context = XUniqueContext(); getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY); if (!initExtensions()) return GLFW_FALSE; _glfw.x11.helperWindowHandle = createHelperWindow(); _glfw.x11.hiddenCursorHandle = createHiddenCursor(); if (XSupportsLocale()) { XSetLocaleModifiers(""); _glfw.x11.im = XOpenIM(_glfw.x11.display, 0, NULL, NULL); if (_glfw.x11.im) { if (!hasUsableInputMethodStyle()) { XCloseIM(_glfw.x11.im); _glfw.x11.im = NULL; } } } #if defined(__linux__) if (!_glfwInitJoysticksLinux()) return GLFW_FALSE; #endif _glfwInitTimerPOSIX(); _glfwPollMonitorsX11(); return GLFW_TRUE; } void _glfwPlatformTerminate(void) { if (_glfw.x11.helperWindowHandle) { if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) == _glfw.x11.helperWindowHandle) { _glfwPushSelectionToManagerX11(); } XDestroyWindow(_glfw.x11.display, _glfw.x11.helperWindowHandle); _glfw.x11.helperWindowHandle = None; } if (_glfw.x11.hiddenCursorHandle) { XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle); _glfw.x11.hiddenCursorHandle = (Cursor) 0; } free(_glfw.x11.primarySelectionString); free(_glfw.x11.clipboardString); if (_glfw.x11.im) { XCloseIM(_glfw.x11.im); _glfw.x11.im = NULL; } if (_glfw.x11.display) { XCloseDisplay(_glfw.x11.display); _glfw.x11.display = NULL; } if (_glfw.x11.x11xcb.handle) { _glfw_dlclose(_glfw.x11.x11xcb.handle); _glfw.x11.x11xcb.handle = NULL; } if (_glfw.x11.xcursor.handle) { _glfw_dlclose(_glfw.x11.xcursor.handle); _glfw.x11.xcursor.handle = NULL; } if (_glfw.x11.randr.handle) { _glfw_dlclose(_glfw.x11.randr.handle); _glfw.x11.randr.handle = NULL; } if (_glfw.x11.xinerama.handle) { _glfw_dlclose(_glfw.x11.xinerama.handle); _glfw.x11.xinerama.handle = NULL; } if (_glfw.x11.xrender.handle) { _glfw_dlclose(_glfw.x11.xrender.handle); _glfw.x11.xrender.handle = NULL; } if (_glfw.x11.vidmode.handle) { _glfw_dlclose(_glfw.x11.vidmode.handle); _glfw.x11.vidmode.handle = NULL; } if (_glfw.x11.xi.handle) { _glfw_dlclose(_glfw.x11.xi.handle); _glfw.x11.xi.handle = NULL; } // NOTE: These need to be unloaded after XCloseDisplay, as they register // cleanup callbacks that get called by that function _glfwTerminateEGL(); _glfwTerminateGLX(); #if defined(__linux__) _glfwTerminateJoysticksLinux(); #endif } const char* _glfwPlatformGetVersionString(void) { return _GLFW_VERSION_NUMBER " X11 GLX EGL OSMesa" #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) " clock_gettime" #else " gettimeofday" #endif #if defined(__linux__) " evdev" #endif #if defined(_GLFW_BUILD_DLL) " shared" #endif ; } ================================================ FILE: thirdparty/glfw/src/x11_monitor.c ================================================ //======================================================================== // GLFW 3.3 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include // Check whether the display mode should be included in enumeration // static GLFWbool modeIsGood(const XRRModeInfo* mi) { return (mi->modeFlags & RR_Interlace) == 0; } // Calculates the refresh rate, in Hz, from the specified RandR mode info // static int calculateRefreshRate(const XRRModeInfo* mi) { if (mi->hTotal && mi->vTotal) return (int) round((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal)); else return 0; } // Returns the mode info for a RandR mode XID // static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id) { for (int i = 0; i < sr->nmode; i++) { if (sr->modes[i].id == id) return sr->modes + i; } return NULL; } // Convert RandR mode info to GLFW video mode // static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi, const XRRCrtcInfo* ci) { GLFWvidmode mode; if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270) { mode.width = mi->height; mode.height = mi->width; } else { mode.width = mi->width; mode.height = mi->height; } mode.refreshRate = calculateRefreshRate(mi); _glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen), &mode.redBits, &mode.greenBits, &mode.blueBits); return mode; } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Poll for changes in the set of connected monitors // void _glfwPollMonitorsX11(void) { if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { int disconnectedCount, screenCount = 0; _GLFWmonitor** disconnected = NULL; XineramaScreenInfo* screens = NULL; XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); RROutput primary = XRRGetOutputPrimary(_glfw.x11.display, _glfw.x11.root); if (_glfw.x11.xinerama.available) screens = XineramaQueryScreens(_glfw.x11.display, &screenCount); disconnectedCount = _glfw.monitorCount; if (disconnectedCount) { disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*)); memcpy(disconnected, _glfw.monitors, _glfw.monitorCount * sizeof(_GLFWmonitor*)); } for (int i = 0; i < sr->noutput; i++) { int j, type, widthMM, heightMM; XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]); if (oi->connection != RR_Connected || oi->crtc == None) { XRRFreeOutputInfo(oi); continue; } for (j = 0; j < disconnectedCount; j++) { if (disconnected[j] && disconnected[j]->x11.output == sr->outputs[i]) { disconnected[j] = NULL; break; } } if (j < disconnectedCount) { XRRFreeOutputInfo(oi); continue; } XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc); if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270) { widthMM = oi->mm_height; heightMM = oi->mm_width; } else { widthMM = oi->mm_width; heightMM = oi->mm_height; } if (widthMM <= 0 || heightMM <= 0) { // HACK: If RandR does not provide a physical size, assume the // X11 default 96 DPI and calcuate from the CRTC viewport // NOTE: These members are affected by rotation, unlike the mode // info and output info members widthMM = (int) (ci->width * 25.4f / 96.f); heightMM = (int) (ci->height * 25.4f / 96.f); } _GLFWmonitor* monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM); monitor->x11.output = sr->outputs[i]; monitor->x11.crtc = oi->crtc; for (j = 0; j < screenCount; j++) { if (screens[j].x_org == ci->x && screens[j].y_org == ci->y && screens[j].width == ci->width && screens[j].height == ci->height) { monitor->x11.index = j; break; } } if (monitor->x11.output == primary) type = _GLFW_INSERT_FIRST; else type = _GLFW_INSERT_LAST; _glfwInputMonitor(monitor, GLFW_CONNECTED, type); XRRFreeOutputInfo(oi); XRRFreeCrtcInfo(ci); } XRRFreeScreenResources(sr); if (screens) XFree(screens); for (int i = 0; i < disconnectedCount; i++) { if (disconnected[i]) _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0); } free(disconnected); } else { const int widthMM = DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen); const int heightMM = DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen); _glfwInputMonitor(_glfwAllocMonitor("Display", widthMM, heightMM), GLFW_CONNECTED, _GLFW_INSERT_FIRST); } } // Set the current video mode for the specified monitor // void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired) { if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { GLFWvidmode current; RRMode native = None; const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired); _glfwPlatformGetVideoMode(monitor, ¤t); if (_glfwCompareVideoModes(¤t, best) == 0) return; XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output); for (int i = 0; i < oi->nmode; i++) { const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]); if (!modeIsGood(mi)) continue; const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci); if (_glfwCompareVideoModes(best, &mode) == 0) { native = mi->id; break; } } if (native) { if (monitor->x11.oldMode == None) monitor->x11.oldMode = ci->mode; XRRSetCrtcConfig(_glfw.x11.display, sr, monitor->x11.crtc, CurrentTime, ci->x, ci->y, native, ci->rotation, ci->outputs, ci->noutput); } XRRFreeOutputInfo(oi); XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); } } // Restore the saved (original) video mode for the specified monitor // void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor) { if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { if (monitor->x11.oldMode == None) return; XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); XRRSetCrtcConfig(_glfw.x11.display, sr, monitor->x11.crtc, CurrentTime, ci->x, ci->y, monitor->x11.oldMode, ci->rotation, ci->outputs, ci->noutput); XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); monitor->x11.oldMode = None; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) { } void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); if (ci) { if (xpos) *xpos = ci->x; if (ypos) *ypos = ci->y; XRRFreeCrtcInfo(ci); } XRRFreeScreenResources(sr); } } void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale) { if (xscale) *xscale = _glfw.x11.contentScaleX; if (yscale) *yscale = _glfw.x11.contentScaleY; } void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height) { int areaX = 0, areaY = 0, areaWidth = 0, areaHeight = 0; if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); areaX = ci->x; areaY = ci->y; const XRRModeInfo* mi = getModeInfo(sr, ci->mode); if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270) { areaWidth = mi->height; areaHeight = mi->width; } else { areaWidth = mi->width; areaHeight = mi->height; } XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); } else { areaWidth = DisplayWidth(_glfw.x11.display, _glfw.x11.screen); areaHeight = DisplayHeight(_glfw.x11.display, _glfw.x11.screen); } if (_glfw.x11.NET_WORKAREA && _glfw.x11.NET_CURRENT_DESKTOP) { Atom* extents = NULL; Atom* desktop = NULL; const unsigned long extentCount = _glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_WORKAREA, XA_CARDINAL, (unsigned char**) &extents); if (_glfwGetWindowPropertyX11(_glfw.x11.root, _glfw.x11.NET_CURRENT_DESKTOP, XA_CARDINAL, (unsigned char**) &desktop) > 0) { if (extentCount >= 4 && *desktop < extentCount / 4) { const int globalX = extents[*desktop * 4 + 0]; const int globalY = extents[*desktop * 4 + 1]; const int globalWidth = extents[*desktop * 4 + 2]; const int globalHeight = extents[*desktop * 4 + 3]; if (areaX < globalX) { areaWidth -= globalX - areaX; areaX = globalX; } if (areaY < globalY) { areaHeight -= globalY - areaY; areaY = globalY; } if (areaX + areaWidth > globalX + globalWidth) areaWidth = globalX - areaX + globalWidth; if (areaY + areaHeight > globalY + globalHeight) areaHeight = globalY - areaY + globalHeight; } } if (extents) XFree(extents); if (desktop) XFree(desktop); } if (xpos) *xpos = areaX; if (ypos) *ypos = areaY; if (width) *width = areaWidth; if (height) *height = areaHeight; } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) { GLFWvidmode* result; *count = 0; if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output); result = calloc(oi->nmode, sizeof(GLFWvidmode)); for (int i = 0; i < oi->nmode; i++) { const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]); if (!modeIsGood(mi)) continue; const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci); int j; for (j = 0; j < *count; j++) { if (_glfwCompareVideoModes(result + j, &mode) == 0) break; } // Skip duplicate modes if (j < *count) continue; (*count)++; result[*count - 1] = mode; } XRRFreeOutputInfo(oi); XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); } else { *count = 1; result = calloc(1, sizeof(GLFWvidmode)); _glfwPlatformGetVideoMode(monitor, result); } return result; } void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); if (ci) { const XRRModeInfo* mi = getModeInfo(sr, ci->mode); if (mi) // mi can be NULL if the monitor has been disconnected *mode = vidmodeFromModeInfo(mi, ci); XRRFreeCrtcInfo(ci); } XRRFreeScreenResources(sr); } else { mode->width = DisplayWidth(_glfw.x11.display, _glfw.x11.screen); mode->height = DisplayHeight(_glfw.x11.display, _glfw.x11.screen); mode->refreshRate = 0; _glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen), &mode->redBits, &mode->greenBits, &mode->blueBits); } } GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) { const size_t size = XRRGetCrtcGammaSize(_glfw.x11.display, monitor->x11.crtc); XRRCrtcGamma* gamma = XRRGetCrtcGamma(_glfw.x11.display, monitor->x11.crtc); _glfwAllocGammaArrays(ramp, size); memcpy(ramp->red, gamma->red, size * sizeof(unsigned short)); memcpy(ramp->green, gamma->green, size * sizeof(unsigned short)); memcpy(ramp->blue, gamma->blue, size * sizeof(unsigned short)); XRRFreeGamma(gamma); return GLFW_TRUE; } else if (_glfw.x11.vidmode.available) { int size; XF86VidModeGetGammaRampSize(_glfw.x11.display, _glfw.x11.screen, &size); _glfwAllocGammaArrays(ramp, size); XF86VidModeGetGammaRamp(_glfw.x11.display, _glfw.x11.screen, ramp->size, ramp->red, ramp->green, ramp->blue); return GLFW_TRUE; } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Gamma ramp access not supported by server"); return GLFW_FALSE; } } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) { if (XRRGetCrtcGammaSize(_glfw.x11.display, monitor->x11.crtc) != ramp->size) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Gamma ramp size must match current ramp size"); return; } XRRCrtcGamma* gamma = XRRAllocGamma(ramp->size); memcpy(gamma->red, ramp->red, ramp->size * sizeof(unsigned short)); memcpy(gamma->green, ramp->green, ramp->size * sizeof(unsigned short)); memcpy(gamma->blue, ramp->blue, ramp->size * sizeof(unsigned short)); XRRSetCrtcGamma(_glfw.x11.display, monitor->x11.crtc, gamma); XRRFreeGamma(gamma); } else if (_glfw.x11.vidmode.available) { XF86VidModeSetGammaRamp(_glfw.x11.display, _glfw.x11.screen, ramp->size, (unsigned short*) ramp->red, (unsigned short*) ramp->green, (unsigned short*) ramp->blue); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Gamma ramp access not supported by server"); } } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(None); return monitor->x11.crtc; } GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(None); return monitor->x11.output; } ================================================ FILE: thirdparty/glfw/src/x11_platform.h ================================================ //======================================================================== // GLFW 3.3 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #include #include // The XRandR extension provides mode setting and gamma control #include // The Xkb extension provides improved keyboard support #include // The Xinerama extension provides legacy monitor indices #include // The XInput extension provides raw mouse motion input #include typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int); typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*); typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*); typedef void (* PFN_XRRFreeOutputInfo)(XRROutputInfo*); typedef void (* PFN_XRRFreeScreenResources)(XRRScreenResources*); typedef XRRCrtcGamma* (* PFN_XRRGetCrtcGamma)(Display*,RRCrtc); typedef int (* PFN_XRRGetCrtcGammaSize)(Display*,RRCrtc); typedef XRRCrtcInfo* (* PFN_XRRGetCrtcInfo) (Display*,XRRScreenResources*,RRCrtc); typedef XRROutputInfo* (* PFN_XRRGetOutputInfo)(Display*,XRRScreenResources*,RROutput); typedef RROutput (* PFN_XRRGetOutputPrimary)(Display*,Window); typedef XRRScreenResources* (* PFN_XRRGetScreenResourcesCurrent)(Display*,Window); typedef Bool (* PFN_XRRQueryExtension)(Display*,int*,int*); typedef Status (* PFN_XRRQueryVersion)(Display*,int*,int*); typedef void (* PFN_XRRSelectInput)(Display*,Window,int); typedef Status (* PFN_XRRSetCrtcConfig)(Display*,XRRScreenResources*,RRCrtc,Time,int,int,RRMode,Rotation,RROutput*,int); typedef void (* PFN_XRRSetCrtcGamma)(Display*,RRCrtc,XRRCrtcGamma*); typedef int (* PFN_XRRUpdateConfiguration)(XEvent*); #define XRRAllocGamma _glfw.x11.randr.AllocGamma #define XRRFreeCrtcInfo _glfw.x11.randr.FreeCrtcInfo #define XRRFreeGamma _glfw.x11.randr.FreeGamma #define XRRFreeOutputInfo _glfw.x11.randr.FreeOutputInfo #define XRRFreeScreenResources _glfw.x11.randr.FreeScreenResources #define XRRGetCrtcGamma _glfw.x11.randr.GetCrtcGamma #define XRRGetCrtcGammaSize _glfw.x11.randr.GetCrtcGammaSize #define XRRGetCrtcInfo _glfw.x11.randr.GetCrtcInfo #define XRRGetOutputInfo _glfw.x11.randr.GetOutputInfo #define XRRGetOutputPrimary _glfw.x11.randr.GetOutputPrimary #define XRRGetScreenResourcesCurrent _glfw.x11.randr.GetScreenResourcesCurrent #define XRRQueryExtension _glfw.x11.randr.QueryExtension #define XRRQueryVersion _glfw.x11.randr.QueryVersion #define XRRSelectInput _glfw.x11.randr.SelectInput #define XRRSetCrtcConfig _glfw.x11.randr.SetCrtcConfig #define XRRSetCrtcGamma _glfw.x11.randr.SetCrtcGamma #define XRRUpdateConfiguration _glfw.x11.randr.UpdateConfiguration typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int); typedef void (* PFN_XcursorImageDestroy)(XcursorImage*); typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*); #define XcursorImageCreate _glfw.x11.xcursor.ImageCreate #define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy #define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor typedef Bool (* PFN_XineramaIsActive)(Display*); typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*); typedef XineramaScreenInfo* (* PFN_XineramaQueryScreens)(Display*,int*); #define XineramaIsActive _glfw.x11.xinerama.IsActive #define XineramaQueryExtension _glfw.x11.xinerama.QueryExtension #define XineramaQueryScreens _glfw.x11.xinerama.QueryScreens typedef XID xcb_window_t; typedef XID xcb_visualid_t; typedef struct xcb_connection_t xcb_connection_t; typedef xcb_connection_t* (* PFN_XGetXCBConnection)(Display*); #define XGetXCBConnection _glfw.x11.x11xcb.GetXCBConnection typedef Bool (* PFN_XF86VidModeQueryExtension)(Display*,int*,int*); typedef Bool (* PFN_XF86VidModeGetGammaRamp)(Display*,int,int,unsigned short*,unsigned short*,unsigned short*); typedef Bool (* PFN_XF86VidModeSetGammaRamp)(Display*,int,int,unsigned short*,unsigned short*,unsigned short*); typedef Bool (* PFN_XF86VidModeGetGammaRampSize)(Display*,int,int*); #define XF86VidModeQueryExtension _glfw.x11.vidmode.QueryExtension #define XF86VidModeGetGammaRamp _glfw.x11.vidmode.GetGammaRamp #define XF86VidModeSetGammaRamp _glfw.x11.vidmode.SetGammaRamp #define XF86VidModeGetGammaRampSize _glfw.x11.vidmode.GetGammaRampSize typedef Status (* PFN_XIQueryVersion)(Display*,int*,int*); typedef int (* PFN_XISelectEvents)(Display*,Window,XIEventMask*,int); #define XIQueryVersion _glfw.x11.xi.QueryVersion #define XISelectEvents _glfw.x11.xi.SelectEvents typedef Bool (* PFN_XRenderQueryExtension)(Display*,int*,int*); typedef Status (* PFN_XRenderQueryVersion)(Display*dpy,int*,int*); typedef XRenderPictFormat* (* PFN_XRenderFindVisualFormat)(Display*,Visual const*); #define XRenderQueryExtension _glfw.x11.xrender.QueryExtension #define XRenderQueryVersion _glfw.x11.xrender.QueryVersion #define XRenderFindVisualFormat _glfw.x11.xrender.FindVisualFormat typedef VkFlags VkXlibSurfaceCreateFlagsKHR; typedef VkFlags VkXcbSurfaceCreateFlagsKHR; typedef struct VkXlibSurfaceCreateInfoKHR { VkStructureType sType; const void* pNext; VkXlibSurfaceCreateFlagsKHR flags; Display* dpy; Window window; } VkXlibSurfaceCreateInfoKHR; typedef struct VkXcbSurfaceCreateInfoKHR { VkStructureType sType; const void* pNext; VkXcbSurfaceCreateFlagsKHR flags; xcb_connection_t* connection; xcb_window_t window; } VkXcbSurfaceCreateInfoKHR; typedef VkResult (APIENTRY *PFN_vkCreateXlibSurfaceKHR)(VkInstance,const VkXlibSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice,uint32_t,Display*,VisualID); typedef VkResult (APIENTRY *PFN_vkCreateXcbSurfaceKHR)(VkInstance,const VkXcbSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice,uint32_t,xcb_connection_t*,xcb_visualid_t); #include "posix_thread.h" #include "posix_time.h" #include "xkb_unicode.h" #include "glx_context.h" #include "egl_context.h" #include "osmesa_context.h" #if defined(__linux__) #include "linux_joystick.h" #else #include "null_joystick.h" #endif #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlsym(handle, name) dlsym(handle, name) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->x11.handle) #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.x11.display) #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 x11 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11 #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorX11 x11 #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorX11 x11 // X11-specific per-window data // typedef struct _GLFWwindowX11 { Colormap colormap; Window handle; Window parent; XIC ic; GLFWbool overrideRedirect; GLFWbool iconified; GLFWbool maximized; // Whether the visual supports framebuffer transparency GLFWbool transparent; // Cached position and size used to filter out duplicate events int width, height; int xpos, ypos; // The last received cursor position, regardless of source int lastCursorPosX, lastCursorPosY; // The last position the cursor was warped to by GLFW int warpCursorPosX, warpCursorPosY; // The time of the last KeyPress event Time lastKeyTime; } _GLFWwindowX11; // X11-specific global data // typedef struct _GLFWlibraryX11 { Display* display; int screen; Window root; // System content scale float contentScaleX, contentScaleY; // Helper window for IPC Window helperWindowHandle; // Invisible cursor for hidden cursor mode Cursor hiddenCursorHandle; // Context for mapping window XIDs to _GLFWwindow pointers XContext context; // XIM input method XIM im; // Most recent error code received by X error handler int errorCode; // Primary selection string (while the primary selection is owned) char* primarySelectionString; // Clipboard string (while the selection is owned) char* clipboardString; // Key name string char keynames[GLFW_KEY_LAST + 1][5]; // X11 keycode to GLFW key LUT short int keycodes[256]; // GLFW key to X11 keycode LUT short int scancodes[GLFW_KEY_LAST + 1]; // Where to place the cursor when re-enabled double restoreCursorPosX, restoreCursorPosY; // The window whose disabled cursor mode is active _GLFWwindow* disabledCursorWindow; // Window manager atoms Atom NET_SUPPORTED; Atom NET_SUPPORTING_WM_CHECK; Atom WM_PROTOCOLS; Atom WM_STATE; Atom WM_DELETE_WINDOW; Atom NET_WM_NAME; Atom NET_WM_ICON_NAME; Atom NET_WM_ICON; Atom NET_WM_PID; Atom NET_WM_PING; Atom NET_WM_WINDOW_TYPE; Atom NET_WM_WINDOW_TYPE_NORMAL; Atom NET_WM_STATE; Atom NET_WM_STATE_ABOVE; Atom NET_WM_STATE_FULLSCREEN; Atom NET_WM_STATE_MAXIMIZED_VERT; Atom NET_WM_STATE_MAXIMIZED_HORZ; Atom NET_WM_STATE_DEMANDS_ATTENTION; Atom NET_WM_BYPASS_COMPOSITOR; Atom NET_WM_FULLSCREEN_MONITORS; Atom NET_WM_WINDOW_OPACITY; Atom NET_WM_CM_Sx; Atom NET_WORKAREA; Atom NET_CURRENT_DESKTOP; Atom NET_ACTIVE_WINDOW; Atom NET_FRAME_EXTENTS; Atom NET_REQUEST_FRAME_EXTENTS; Atom MOTIF_WM_HINTS; // Xdnd (drag and drop) atoms Atom XdndAware; Atom XdndEnter; Atom XdndPosition; Atom XdndStatus; Atom XdndActionCopy; Atom XdndDrop; Atom XdndFinished; Atom XdndSelection; Atom XdndTypeList; Atom text_uri_list; // Selection (clipboard) atoms Atom TARGETS; Atom MULTIPLE; Atom INCR; Atom CLIPBOARD; Atom PRIMARY; Atom CLIPBOARD_MANAGER; Atom SAVE_TARGETS; Atom NULL_; Atom UTF8_STRING; Atom COMPOUND_STRING; Atom ATOM_PAIR; Atom GLFW_SELECTION; struct { GLFWbool available; void* handle; int eventBase; int errorBase; int major; int minor; GLFWbool gammaBroken; GLFWbool monitorBroken; PFN_XRRAllocGamma AllocGamma; PFN_XRRFreeCrtcInfo FreeCrtcInfo; PFN_XRRFreeGamma FreeGamma; PFN_XRRFreeOutputInfo FreeOutputInfo; PFN_XRRFreeScreenResources FreeScreenResources; PFN_XRRGetCrtcGamma GetCrtcGamma; PFN_XRRGetCrtcGammaSize GetCrtcGammaSize; PFN_XRRGetCrtcInfo GetCrtcInfo; PFN_XRRGetOutputInfo GetOutputInfo; PFN_XRRGetOutputPrimary GetOutputPrimary; PFN_XRRGetScreenResourcesCurrent GetScreenResourcesCurrent; PFN_XRRQueryExtension QueryExtension; PFN_XRRQueryVersion QueryVersion; PFN_XRRSelectInput SelectInput; PFN_XRRSetCrtcConfig SetCrtcConfig; PFN_XRRSetCrtcGamma SetCrtcGamma; PFN_XRRUpdateConfiguration UpdateConfiguration; } randr; struct { GLFWbool available; GLFWbool detectable; int majorOpcode; int eventBase; int errorBase; int major; int minor; unsigned int group; } xkb; struct { int count; int timeout; int interval; int blanking; int exposure; } saver; struct { int version; Window source; Atom format; } xdnd; struct { void* handle; PFN_XcursorImageCreate ImageCreate; PFN_XcursorImageDestroy ImageDestroy; PFN_XcursorImageLoadCursor ImageLoadCursor; } xcursor; struct { GLFWbool available; void* handle; int major; int minor; PFN_XineramaIsActive IsActive; PFN_XineramaQueryExtension QueryExtension; PFN_XineramaQueryScreens QueryScreens; } xinerama; struct { void* handle; PFN_XGetXCBConnection GetXCBConnection; } x11xcb; struct { GLFWbool available; void* handle; int eventBase; int errorBase; PFN_XF86VidModeQueryExtension QueryExtension; PFN_XF86VidModeGetGammaRamp GetGammaRamp; PFN_XF86VidModeSetGammaRamp SetGammaRamp; PFN_XF86VidModeGetGammaRampSize GetGammaRampSize; } vidmode; struct { GLFWbool available; void* handle; int majorOpcode; int eventBase; int errorBase; int major; int minor; PFN_XIQueryVersion QueryVersion; PFN_XISelectEvents SelectEvents; } xi; struct { GLFWbool available; void* handle; int major; int minor; int eventBase; int errorBase; PFN_XRenderQueryExtension QueryExtension; PFN_XRenderQueryVersion QueryVersion; PFN_XRenderFindVisualFormat FindVisualFormat; } xrender; } _GLFWlibraryX11; // X11-specific per-monitor data // typedef struct _GLFWmonitorX11 { RROutput output; RRCrtc crtc; RRMode oldMode; // Index of corresponding Xinerama screen, // for EWMH full screen window placement int index; } _GLFWmonitorX11; // X11-specific per-cursor data // typedef struct _GLFWcursorX11 { Cursor handle; } _GLFWcursorX11; void _glfwPollMonitorsX11(void); void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor); Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot); unsigned long _glfwGetWindowPropertyX11(Window window, Atom property, Atom type, unsigned char** value); GLFWbool _glfwIsVisualTransparentX11(Visual* visual); void _glfwGrabErrorHandlerX11(void); void _glfwReleaseErrorHandlerX11(void); void _glfwInputErrorX11(int error, const char* message); void _glfwPushSelectionToManagerX11(void); ================================================ FILE: thirdparty/glfw/src/x11_window.c ================================================ //======================================================================== // GLFW 3.3 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" #include #include #include #include #include #include #include #include #include // Action for EWMH client messages #define _NET_WM_STATE_REMOVE 0 #define _NET_WM_STATE_ADD 1 #define _NET_WM_STATE_TOGGLE 2 // Additional mouse button names for XButtonEvent #define Button6 6 #define Button7 7 // Motif WM hints flags #define MWM_HINTS_DECORATIONS 2 #define MWM_DECOR_ALL 1 #define _GLFW_XDND_VERSION 5 // Wait for data to arrive using select // This avoids blocking other threads via the per-display Xlib lock that also // covers GLX functions // static GLFWbool waitForEvent(double* timeout) { fd_set fds; const int fd = ConnectionNumber(_glfw.x11.display); int count = fd + 1; #if defined(__linux__) if (_glfw.linjs.inotify > fd) count = _glfw.linjs.inotify + 1; #endif for (;;) { FD_ZERO(&fds); FD_SET(fd, &fds); #if defined(__linux__) if (_glfw.linjs.inotify > 0) FD_SET(_glfw.linjs.inotify, &fds); #endif if (timeout) { const long seconds = (long) *timeout; const long microseconds = (long) ((*timeout - seconds) * 1e6); struct timeval tv = { seconds, microseconds }; const uint64_t base = _glfwPlatformGetTimerValue(); const int result = select(count, &fds, NULL, NULL, &tv); const int error = errno; *timeout -= (_glfwPlatformGetTimerValue() - base) / (double) _glfwPlatformGetTimerFrequency(); if (result > 0) return GLFW_TRUE; if ((result == -1 && error == EINTR) || *timeout <= 0.0) return GLFW_FALSE; } else if (select(count, &fds, NULL, NULL, NULL) != -1 || errno != EINTR) return GLFW_TRUE; } } // Waits until a VisibilityNotify event arrives for the specified window or the // timeout period elapses (ICCCM section 4.2.2) // static GLFWbool waitForVisibilityNotify(_GLFWwindow* window) { XEvent dummy; double timeout = 0.1; while (!XCheckTypedWindowEvent(_glfw.x11.display, window->x11.handle, VisibilityNotify, &dummy)) { if (!waitForEvent(&timeout)) return GLFW_FALSE; } return GLFW_TRUE; } // Returns whether the window is iconified // static int getWindowState(_GLFWwindow* window) { int result = WithdrawnState; struct { CARD32 state; Window icon; } *state = NULL; if (_glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.WM_STATE, _glfw.x11.WM_STATE, (unsigned char**) &state) >= 2) { result = state->state; } if (state) XFree(state); return result; } // Returns whether the event is a selection event // static Bool isSelectionEvent(Display* display, XEvent* event, XPointer pointer) { if (event->xany.window != _glfw.x11.helperWindowHandle) return False; return event->type == SelectionRequest || event->type == SelectionNotify || event->type == SelectionClear; } // Returns whether it is a _NET_FRAME_EXTENTS event for the specified window // static Bool isFrameExtentsEvent(Display* display, XEvent* event, XPointer pointer) { _GLFWwindow* window = (_GLFWwindow*) pointer; return event->type == PropertyNotify && event->xproperty.state == PropertyNewValue && event->xproperty.window == window->x11.handle && event->xproperty.atom == _glfw.x11.NET_FRAME_EXTENTS; } // Returns whether it is a property event for the specified selection transfer // static Bool isSelPropNewValueNotify(Display* display, XEvent* event, XPointer pointer) { XEvent* notification = (XEvent*) pointer; return event->type == PropertyNotify && event->xproperty.state == PropertyNewValue && event->xproperty.window == notification->xselection.requestor && event->xproperty.atom == notification->xselection.property; } // Translates an X event modifier state mask // static int translateState(int state) { int mods = 0; if (state & ShiftMask) mods |= GLFW_MOD_SHIFT; if (state & ControlMask) mods |= GLFW_MOD_CONTROL; if (state & Mod1Mask) mods |= GLFW_MOD_ALT; if (state & Mod4Mask) mods |= GLFW_MOD_SUPER; if (state & LockMask) mods |= GLFW_MOD_CAPS_LOCK; if (state & Mod2Mask) mods |= GLFW_MOD_NUM_LOCK; return mods; } // Translates an X11 key code to a GLFW key token // static int translateKey(int scancode) { // Use the pre-filled LUT (see createKeyTables() in x11_init.c) if (scancode < 0 || scancode > 255) return GLFW_KEY_UNKNOWN; return _glfw.x11.keycodes[scancode]; } // Sends an EWMH or ICCCM event to the window manager // static void sendEventToWM(_GLFWwindow* window, Atom type, long a, long b, long c, long d, long e) { XEvent event = { ClientMessage }; event.xclient.window = window->x11.handle; event.xclient.format = 32; // Data is 32-bit longs event.xclient.message_type = type; event.xclient.data.l[0] = a; event.xclient.data.l[1] = b; event.xclient.data.l[2] = c; event.xclient.data.l[3] = d; event.xclient.data.l[4] = e; XSendEvent(_glfw.x11.display, _glfw.x11.root, False, SubstructureNotifyMask | SubstructureRedirectMask, &event); } // Updates the normal hints according to the window settings // static void updateNormalHints(_GLFWwindow* window, int width, int height) { XSizeHints* hints = XAllocSizeHints(); if (!window->monitor) { if (window->resizable) { if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) { hints->flags |= PMinSize; hints->min_width = window->minwidth; hints->min_height = window->minheight; } if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) { hints->flags |= PMaxSize; hints->max_width = window->maxwidth; hints->max_height = window->maxheight; } if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) { hints->flags |= PAspect; hints->min_aspect.x = hints->max_aspect.x = window->numer; hints->min_aspect.y = hints->max_aspect.y = window->denom; } } else { hints->flags |= (PMinSize | PMaxSize); hints->min_width = hints->max_width = width; hints->min_height = hints->max_height = height; } } hints->flags |= PWinGravity; hints->win_gravity = StaticGravity; XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } // Updates the full screen status of the window // static void updateWindowMode(_GLFWwindow* window) { if (window->monitor) { if (_glfw.x11.xinerama.available && _glfw.x11.NET_WM_FULLSCREEN_MONITORS) { sendEventToWM(window, _glfw.x11.NET_WM_FULLSCREEN_MONITORS, window->monitor->x11.index, window->monitor->x11.index, window->monitor->x11.index, window->monitor->x11.index, 0); } if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_ADD, _glfw.x11.NET_WM_STATE_FULLSCREEN, 0, 1, 0); } else { // This is the butcher's way of removing window decorations // Setting the override-redirect attribute on a window makes the // window manager ignore the window completely (ICCCM, section 4) // The good thing is that this makes undecorated full screen windows // easy to do; the bad thing is that we have to do everything // manually and some things (like iconify/restore) won't work at // all, as those are tasks usually performed by the window manager XSetWindowAttributes attributes; attributes.override_redirect = True; XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &attributes); window->x11.overrideRedirect = GLFW_TRUE; } // Enable compositor bypass if (!window->x11.transparent) { const unsigned long value = 1; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &value, 1); } } else { if (_glfw.x11.xinerama.available && _glfw.x11.NET_WM_FULLSCREEN_MONITORS) { XDeleteProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_FULLSCREEN_MONITORS); } if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_REMOVE, _glfw.x11.NET_WM_STATE_FULLSCREEN, 0, 1, 0); } else { XSetWindowAttributes attributes; attributes.override_redirect = False; XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &attributes); window->x11.overrideRedirect = GLFW_FALSE; } // Disable compositor bypass if (!window->x11.transparent) { XDeleteProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_BYPASS_COMPOSITOR); } } } // Splits and translates a text/uri-list into separate file paths // NOTE: This function destroys the provided string // static char** parseUriList(char* text, int* count) { const char* prefix = "file://"; char** paths = NULL; char* line; *count = 0; while ((line = strtok(text, "\r\n"))) { text = NULL; if (line[0] == '#') continue; if (strncmp(line, prefix, strlen(prefix)) == 0) { line += strlen(prefix); // TODO: Validate hostname while (*line != '/') line++; } (*count)++; char* path = calloc(strlen(line) + 1, 1); paths = realloc(paths, *count * sizeof(char*)); paths[*count - 1] = path; while (*line) { if (line[0] == '%' && line[1] && line[2]) { const char digits[3] = { line[1], line[2], '\0' }; *path = strtol(digits, NULL, 16); line += 2; } else *path = *line; path++; line++; } } return paths; } // Encode a Unicode code point to a UTF-8 stream // Based on cutef8 by Jeff Bezanson (Public Domain) // static size_t encodeUTF8(char* s, unsigned int ch) { size_t count = 0; if (ch < 0x80) s[count++] = (char) ch; else if (ch < 0x800) { s[count++] = (ch >> 6) | 0xc0; s[count++] = (ch & 0x3f) | 0x80; } else if (ch < 0x10000) { s[count++] = (ch >> 12) | 0xe0; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } else if (ch < 0x110000) { s[count++] = (ch >> 18) | 0xf0; s[count++] = ((ch >> 12) & 0x3f) | 0x80; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } return count; } // Decode a Unicode code point from a UTF-8 stream // Based on cutef8 by Jeff Bezanson (Public Domain) // #if defined(X_HAVE_UTF8_STRING) static unsigned int decodeUTF8(const char** s) { unsigned int ch = 0, count = 0; static const unsigned int offsets[] = { 0x00000000u, 0x00003080u, 0x000e2080u, 0x03c82080u, 0xfa082080u, 0x82082080u }; do { ch = (ch << 6) + (unsigned char) **s; (*s)++; count++; } while ((**s & 0xc0) == 0x80); assert(count <= 6); return ch - offsets[count - 1]; } #endif /*X_HAVE_UTF8_STRING*/ // Convert the specified Latin-1 string to UTF-8 // static char* convertLatin1toUTF8(const char* source) { size_t size = 1; const char* sp; for (sp = source; *sp; sp++) size += (*sp & 0x80) ? 2 : 1; char* target = calloc(size, 1); char* tp = target; for (sp = source; *sp; sp++) tp += encodeUTF8(tp, *sp); return target; } // Updates the cursor image according to its cursor mode // static void updateCursorImage(_GLFWwindow* window) { if (window->cursorMode == GLFW_CURSOR_NORMAL) { if (window->cursor) { XDefineCursor(_glfw.x11.display, window->x11.handle, window->cursor->x11.handle); } else XUndefineCursor(_glfw.x11.display, window->x11.handle); } else { XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.hiddenCursorHandle); } } // Enable XI2 raw mouse motion events // static void enableRawMouseMotion(_GLFWwindow* window) { XIEventMask em; unsigned char mask[XIMaskLen(XI_RawMotion)] = { 0 }; em.deviceid = XIAllMasterDevices; em.mask_len = sizeof(mask); em.mask = mask; XISetMask(mask, XI_RawMotion); XISelectEvents(_glfw.x11.display, _glfw.x11.root, &em, 1); } // Disable XI2 raw mouse motion events // static void disableRawMouseMotion(_GLFWwindow* window) { XIEventMask em; unsigned char mask[] = { 0 }; em.deviceid = XIAllMasterDevices; em.mask_len = sizeof(mask); em.mask = mask; XISelectEvents(_glfw.x11.display, _glfw.x11.root, &em, 1); } // Apply disabled cursor mode to a focused window // static void disableCursor(_GLFWwindow* window) { if (window->rawMouseMotion) enableRawMouseMotion(window); _glfw.x11.disabledCursorWindow = window; _glfwPlatformGetCursorPos(window, &_glfw.x11.restoreCursorPosX, &_glfw.x11.restoreCursorPosY); updateCursorImage(window); _glfwCenterCursorInContentArea(window); XGrabPointer(_glfw.x11.display, window->x11.handle, True, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, GrabModeAsync, GrabModeAsync, window->x11.handle, _glfw.x11.hiddenCursorHandle, CurrentTime); } // Exit disabled cursor mode for the specified window // static void enableCursor(_GLFWwindow* window) { if (window->rawMouseMotion) disableRawMouseMotion(window); _glfw.x11.disabledCursorWindow = NULL; XUngrabPointer(_glfw.x11.display, CurrentTime); _glfwPlatformSetCursorPos(window, _glfw.x11.restoreCursorPosX, _glfw.x11.restoreCursorPosY); updateCursorImage(window); } // Create the X11 window (and its colormap) // static GLFWbool createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, Visual* visual, int depth) { int width = wndconfig->width; int height = wndconfig->height; if (wndconfig->scaleToMonitor) { width *= _glfw.x11.contentScaleX; height *= _glfw.x11.contentScaleY; } // Create a colormap based on the visual used by the current context window->x11.colormap = XCreateColormap(_glfw.x11.display, _glfw.x11.root, visual, AllocNone); window->x11.transparent = _glfwIsVisualTransparentX11(visual); XSetWindowAttributes wa = { 0 }; wa.colormap = window->x11.colormap; wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; _glfwGrabErrorHandlerX11(); window->x11.parent = _glfw.x11.root; window->x11.handle = XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, // Position width, height, 0, // Border width depth, // Color depth InputOutput, visual, CWBorderPixel | CWColormap | CWEventMask, &wa); _glfwReleaseErrorHandlerX11(); if (!window->x11.handle) { _glfwInputErrorX11(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); return GLFW_FALSE; } XSaveContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context, (XPointer) window); if (!wndconfig->decorated) _glfwPlatformSetWindowDecorated(window, GLFW_FALSE); if (_glfw.x11.NET_WM_STATE && !window->monitor) { Atom states[3]; int count = 0; if (wndconfig->floating) { if (_glfw.x11.NET_WM_STATE_ABOVE) states[count++] = _glfw.x11.NET_WM_STATE_ABOVE; } if (wndconfig->maximized) { if (_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT && _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { states[count++] = _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT; states[count++] = _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ; window->x11.maximized = GLFW_TRUE; } } if (count) { XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char*) states, count); } } // Declare the WM protocols supported by GLFW { Atom protocols[] = { _glfw.x11.WM_DELETE_WINDOW, _glfw.x11.NET_WM_PING }; XSetWMProtocols(_glfw.x11.display, window->x11.handle, protocols, sizeof(protocols) / sizeof(Atom)); } // Declare our PID { const long pid = getpid(); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &pid, 1); } if (_glfw.x11.NET_WM_WINDOW_TYPE && _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL) { Atom type = _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char*) &type, 1); } // Set ICCCM WM_HINTS property { XWMHints* hints = XAllocWMHints(); if (!hints) { _glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate WM hints"); return GLFW_FALSE; } hints->flags = StateHint; hints->initial_state = NormalState; XSetWMHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } updateNormalHints(window, width, height); // Set ICCCM WM_CLASS property { XClassHint* hint = XAllocClassHint(); if (strlen(wndconfig->x11.instanceName) && strlen(wndconfig->x11.className)) { hint->res_name = (char*) wndconfig->x11.instanceName; hint->res_class = (char*) wndconfig->x11.className; } else { const char* resourceName = getenv("RESOURCE_NAME"); if (resourceName && strlen(resourceName)) hint->res_name = (char*) resourceName; else if (strlen(wndconfig->title)) hint->res_name = (char*) wndconfig->title; else hint->res_name = (char*) "glfw-application"; if (strlen(wndconfig->title)) hint->res_class = (char*) wndconfig->title; else hint->res_class = (char*) "GLFW-Application"; } XSetClassHint(_glfw.x11.display, window->x11.handle, hint); XFree(hint); } // Announce support for Xdnd (drag and drop) { const Atom version = _GLFW_XDND_VERSION; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*) &version, 1); } _glfwPlatformSetWindowTitle(window, wndconfig->title); if (_glfw.x11.im) { window->x11.ic = XCreateIC(_glfw.x11.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window->x11.handle, XNFocusWindow, window->x11.handle, NULL); } if (window->x11.ic) { unsigned long filter = 0; if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL) XSelectInput(_glfw.x11.display, window->x11.handle, wa.event_mask | filter); } _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); return GLFW_TRUE; } // Set the specified property to the selection converted to the requested target // static Atom writeTargetToProperty(const XSelectionRequestEvent* request) { int i; char* selectionString = NULL; const Atom formats[] = { _glfw.x11.UTF8_STRING, XA_STRING }; const int formatCount = sizeof(formats) / sizeof(formats[0]); if (request->selection == _glfw.x11.PRIMARY) selectionString = _glfw.x11.primarySelectionString; else selectionString = _glfw.x11.clipboardString; if (request->property == None) { // The requester is a legacy client (ICCCM section 2.2) // We don't support legacy clients, so fail here return None; } if (request->target == _glfw.x11.TARGETS) { // The list of supported targets was requested const Atom targets[] = { _glfw.x11.TARGETS, _glfw.x11.MULTIPLE, _glfw.x11.UTF8_STRING, XA_STRING }; XChangeProperty(_glfw.x11.display, request->requestor, request->property, XA_ATOM, 32, PropModeReplace, (unsigned char*) targets, sizeof(targets) / sizeof(targets[0])); return request->property; } if (request->target == _glfw.x11.MULTIPLE) { // Multiple conversions were requested Atom* targets; unsigned long i, count; count = _glfwGetWindowPropertyX11(request->requestor, request->property, _glfw.x11.ATOM_PAIR, (unsigned char**) &targets); for (i = 0; i < count; i += 2) { int j; for (j = 0; j < formatCount; j++) { if (targets[i] == formats[j]) break; } if (j < formatCount) { XChangeProperty(_glfw.x11.display, request->requestor, targets[i + 1], targets[i], 8, PropModeReplace, (unsigned char *) selectionString, strlen(selectionString)); } else targets[i + 1] = None; } XChangeProperty(_glfw.x11.display, request->requestor, request->property, _glfw.x11.ATOM_PAIR, 32, PropModeReplace, (unsigned char*) targets, count); XFree(targets); return request->property; } if (request->target == _glfw.x11.SAVE_TARGETS) { // The request is a check whether we support SAVE_TARGETS // It should be handled as a no-op side effect target XChangeProperty(_glfw.x11.display, request->requestor, request->property, _glfw.x11.NULL_, 32, PropModeReplace, NULL, 0); return request->property; } // Conversion to a data target was requested for (i = 0; i < formatCount; i++) { if (request->target == formats[i]) { // The requested target is one we support XChangeProperty(_glfw.x11.display, request->requestor, request->property, request->target, 8, PropModeReplace, (unsigned char *) selectionString, strlen(selectionString)); return request->property; } } // The requested target is not supported return None; } static void handleSelectionClear(XEvent* event) { if (event->xselectionclear.selection == _glfw.x11.PRIMARY) { free(_glfw.x11.primarySelectionString); _glfw.x11.primarySelectionString = NULL; } else { free(_glfw.x11.clipboardString); _glfw.x11.clipboardString = NULL; } } static void handleSelectionRequest(XEvent* event) { const XSelectionRequestEvent* request = &event->xselectionrequest; XEvent reply = { SelectionNotify }; reply.xselection.property = writeTargetToProperty(request); reply.xselection.display = request->display; reply.xselection.requestor = request->requestor; reply.xselection.selection = request->selection; reply.xselection.target = request->target; reply.xselection.time = request->time; XSendEvent(_glfw.x11.display, request->requestor, False, 0, &reply); } static const char* getSelectionString(Atom selection) { char** selectionString = NULL; const Atom targets[] = { _glfw.x11.UTF8_STRING, XA_STRING }; const size_t targetCount = sizeof(targets) / sizeof(targets[0]); if (selection == _glfw.x11.PRIMARY) selectionString = &_glfw.x11.primarySelectionString; else selectionString = &_glfw.x11.clipboardString; if (XGetSelectionOwner(_glfw.x11.display, selection) == _glfw.x11.helperWindowHandle) { // Instead of doing a large number of X round-trips just to put this // string into a window property and then read it back, just return it return *selectionString; } free(*selectionString); *selectionString = NULL; for (size_t i = 0; i < targetCount; i++) { char* data; Atom actualType; int actualFormat; unsigned long itemCount, bytesAfter; XEvent notification, dummy; XConvertSelection(_glfw.x11.display, selection, targets[i], _glfw.x11.GLFW_SELECTION, _glfw.x11.helperWindowHandle, CurrentTime); while (!XCheckTypedWindowEvent(_glfw.x11.display, _glfw.x11.helperWindowHandle, SelectionNotify, ¬ification)) { waitForEvent(NULL); } if (notification.xselection.property == None) continue; XCheckIfEvent(_glfw.x11.display, &dummy, isSelPropNewValueNotify, (XPointer) ¬ification); XGetWindowProperty(_glfw.x11.display, notification.xselection.requestor, notification.xselection.property, 0, LONG_MAX, True, AnyPropertyType, &actualType, &actualFormat, &itemCount, &bytesAfter, (unsigned char**) &data); if (actualType == _glfw.x11.INCR) { size_t size = 1; char* string = NULL; for (;;) { while (!XCheckIfEvent(_glfw.x11.display, &dummy, isSelPropNewValueNotify, (XPointer) ¬ification)) { waitForEvent(NULL); } XFree(data); XGetWindowProperty(_glfw.x11.display, notification.xselection.requestor, notification.xselection.property, 0, LONG_MAX, True, AnyPropertyType, &actualType, &actualFormat, &itemCount, &bytesAfter, (unsigned char**) &data); if (itemCount) { size += itemCount; string = realloc(string, size); string[size - itemCount - 1] = '\0'; strcat(string, data); } if (!itemCount) { if (targets[i] == XA_STRING) { *selectionString = convertLatin1toUTF8(string); free(string); } else *selectionString = string; break; } } } else if (actualType == targets[i]) { if (targets[i] == XA_STRING) *selectionString = convertLatin1toUTF8(data); else *selectionString = _glfw_strdup(data); } XFree(data); if (*selectionString) break; } if (!*selectionString) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "X11: Failed to convert selection to string"); } return *selectionString; } // Make the specified window and its video mode active on its monitor // static void acquireMonitor(_GLFWwindow* window) { if (_glfw.x11.saver.count == 0) { // Remember old screen saver settings XGetScreenSaver(_glfw.x11.display, &_glfw.x11.saver.timeout, &_glfw.x11.saver.interval, &_glfw.x11.saver.blanking, &_glfw.x11.saver.exposure); // Disable screen saver XSetScreenSaver(_glfw.x11.display, 0, 0, DontPreferBlanking, DefaultExposures); } if (!window->monitor->window) _glfw.x11.saver.count++; _glfwSetVideoModeX11(window->monitor, &window->videoMode); if (window->x11.overrideRedirect) { int xpos, ypos; GLFWvidmode mode; // Manually position the window over its monitor _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); _glfwPlatformGetVideoMode(window->monitor, &mode); XMoveResizeWindow(_glfw.x11.display, window->x11.handle, xpos, ypos, mode.width, mode.height); } _glfwInputMonitorWindow(window->monitor, window); } // Remove the window and restore the original video mode // static void releaseMonitor(_GLFWwindow* window) { if (window->monitor->window != window) return; _glfwInputMonitorWindow(window->monitor, NULL); _glfwRestoreVideoModeX11(window->monitor); _glfw.x11.saver.count--; if (_glfw.x11.saver.count == 0) { // Restore old screen saver settings XSetScreenSaver(_glfw.x11.display, _glfw.x11.saver.timeout, _glfw.x11.saver.interval, _glfw.x11.saver.blanking, _glfw.x11.saver.exposure); } } // Process the specified X event // static void processEvent(XEvent *event) { int keycode = 0; Bool filtered = False; // HACK: Save scancode as some IMs clear the field in XFilterEvent if (event->type == KeyPress || event->type == KeyRelease) keycode = event->xkey.keycode; if (_glfw.x11.im) filtered = XFilterEvent(event, None); if (_glfw.x11.randr.available) { if (event->type == _glfw.x11.randr.eventBase + RRNotify) { XRRUpdateConfiguration(event); _glfwPollMonitorsX11(); return; } } if (_glfw.x11.xkb.available) { if (event->type == _glfw.x11.xkb.eventBase + XkbEventCode) { if (((XkbEvent*) event)->any.xkb_type == XkbStateNotify && (((XkbEvent*) event)->state.changed & XkbGroupStateMask)) { _glfw.x11.xkb.group = ((XkbEvent*) event)->state.group; } } } if (event->type == GenericEvent) { if (_glfw.x11.xi.available) { _GLFWwindow* window = _glfw.x11.disabledCursorWindow; if (window && window->rawMouseMotion && event->xcookie.extension == _glfw.x11.xi.majorOpcode && XGetEventData(_glfw.x11.display, &event->xcookie) && event->xcookie.evtype == XI_RawMotion) { XIRawEvent* re = event->xcookie.data; if (re->valuators.mask_len) { const double* values = re->raw_values; double xpos = window->virtualCursorPosX; double ypos = window->virtualCursorPosY; if (XIMaskIsSet(re->valuators.mask, 0)) { xpos += *values; values++; } if (XIMaskIsSet(re->valuators.mask, 1)) ypos += *values; _glfwInputCursorPos(window, xpos, ypos); } } XFreeEventData(_glfw.x11.display, &event->xcookie); } return; } if (event->type == SelectionClear) { handleSelectionClear(event); return; } else if (event->type == SelectionRequest) { handleSelectionRequest(event); return; } _GLFWwindow* window = NULL; if (XFindContext(_glfw.x11.display, event->xany.window, _glfw.x11.context, (XPointer*) &window) != 0) { // This is an event for a window that has already been destroyed return; } switch (event->type) { case ReparentNotify: { window->x11.parent = event->xreparent.parent; return; } case KeyPress: { const int key = translateKey(keycode); const int mods = translateState(event->xkey.state); const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); if (window->x11.ic) { // HACK: Ignore duplicate key press events generated by ibus // These have the same timestamp as the original event // Corresponding release events are filtered out // implicitly by the GLFW key repeat logic if (window->x11.lastKeyTime < event->xkey.time) { if (keycode) _glfwInputKey(window, key, keycode, GLFW_PRESS, mods); window->x11.lastKeyTime = event->xkey.time; } if (!filtered) { int count; Status status; #if defined(X_HAVE_UTF8_STRING) char buffer[100]; char* chars = buffer; count = Xutf8LookupString(window->x11.ic, &event->xkey, buffer, sizeof(buffer) - 1, NULL, &status); if (status == XBufferOverflow) { chars = calloc(count + 1, 1); count = Xutf8LookupString(window->x11.ic, &event->xkey, chars, count, NULL, &status); } if (status == XLookupChars || status == XLookupBoth) { const char* c = chars; chars[count] = '\0'; while (c - chars < count) _glfwInputChar(window, decodeUTF8(&c), mods, plain); } #else /*X_HAVE_UTF8_STRING*/ wchar_t buffer[16]; wchar_t* chars = buffer; count = XwcLookupString(window->x11.ic, &event->xkey, buffer, sizeof(buffer) / sizeof(wchar_t), NULL, &status); if (status == XBufferOverflow) { chars = calloc(count, sizeof(wchar_t)); count = XwcLookupString(window->x11.ic, &event->xkey, chars, count, NULL, &status); } if (status == XLookupChars || status == XLookupBoth) { int i; for (i = 0; i < count; i++) _glfwInputChar(window, chars[i], mods, plain); } #endif /*X_HAVE_UTF8_STRING*/ if (chars != buffer) free(chars); } } else { KeySym keysym; XLookupString(&event->xkey, NULL, 0, &keysym, NULL); _glfwInputKey(window, key, keycode, GLFW_PRESS, mods); const long character = _glfwKeySym2Unicode(keysym); if (character != -1) _glfwInputChar(window, character, mods, plain); } return; } case KeyRelease: { const int key = translateKey(keycode); const int mods = translateState(event->xkey.state); if (!_glfw.x11.xkb.detectable) { // HACK: Key repeat events will arrive as KeyRelease/KeyPress // pairs with similar or identical time stamps // The key repeat logic in _glfwInputKey expects only key // presses to repeat, so detect and discard release events if (XEventsQueued(_glfw.x11.display, QueuedAfterReading)) { XEvent next; XPeekEvent(_glfw.x11.display, &next); if (next.type == KeyPress && next.xkey.window == event->xkey.window && next.xkey.keycode == keycode) { // HACK: The time of repeat events sometimes doesn't // match that of the press event, so add an // epsilon // Toshiyuki Takahashi can press a button // 16 times per second so it's fairly safe to // assume that no human is pressing the key 50 // times per second (value is ms) if ((next.xkey.time - event->xkey.time) < 20) { // This is very likely a server-generated key repeat // event, so ignore it return; } } } } _glfwInputKey(window, key, keycode, GLFW_RELEASE, mods); return; } case ButtonPress: { const int mods = translateState(event->xbutton.state); if (event->xbutton.button == Button1) _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods); else if (event->xbutton.button == Button2) _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods); else if (event->xbutton.button == Button3) _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods); // Modern X provides scroll events as mouse button presses else if (event->xbutton.button == Button4) _glfwInputScroll(window, 0.0, 1.0); else if (event->xbutton.button == Button5) _glfwInputScroll(window, 0.0, -1.0); else if (event->xbutton.button == Button6) _glfwInputScroll(window, 1.0, 0.0); else if (event->xbutton.button == Button7) _glfwInputScroll(window, -1.0, 0.0); else { // Additional buttons after 7 are treated as regular buttons // We subtract 4 to fill the gap left by scroll input above _glfwInputMouseClick(window, event->xbutton.button - Button1 - 4, GLFW_PRESS, mods); } return; } case ButtonRelease: { const int mods = translateState(event->xbutton.state); if (event->xbutton.button == Button1) { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, mods); } else if (event->xbutton.button == Button2) { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_RELEASE, mods); } else if (event->xbutton.button == Button3) { _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE, mods); } else if (event->xbutton.button > Button7) { // Additional buttons after 7 are treated as regular buttons // We subtract 4 to fill the gap left by scroll input above _glfwInputMouseClick(window, event->xbutton.button - Button1 - 4, GLFW_RELEASE, mods); } return; } case EnterNotify: { // XEnterWindowEvent is XCrossingEvent const int x = event->xcrossing.x; const int y = event->xcrossing.y; // HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise // ignore the defined cursor for hidden cursor mode if (window->cursorMode == GLFW_CURSOR_HIDDEN) updateCursorImage(window); _glfwInputCursorEnter(window, GLFW_TRUE); _glfwInputCursorPos(window, x, y); window->x11.lastCursorPosX = x; window->x11.lastCursorPosY = y; return; } case LeaveNotify: { _glfwInputCursorEnter(window, GLFW_FALSE); return; } case MotionNotify: { const int x = event->xmotion.x; const int y = event->xmotion.y; if (x != window->x11.warpCursorPosX || y != window->x11.warpCursorPosY) { // The cursor was moved by something other than GLFW if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (_glfw.x11.disabledCursorWindow != window) return; if (window->rawMouseMotion) return; const int dx = x - window->x11.lastCursorPosX; const int dy = y - window->x11.lastCursorPosY; _glfwInputCursorPos(window, window->virtualCursorPosX + dx, window->virtualCursorPosY + dy); } else _glfwInputCursorPos(window, x, y); } window->x11.lastCursorPosX = x; window->x11.lastCursorPosY = y; return; } case ConfigureNotify: { if (event->xconfigure.width != window->x11.width || event->xconfigure.height != window->x11.height) { _glfwInputFramebufferSize(window, event->xconfigure.width, event->xconfigure.height); _glfwInputWindowSize(window, event->xconfigure.width, event->xconfigure.height); window->x11.width = event->xconfigure.width; window->x11.height = event->xconfigure.height; } int xpos = event->xconfigure.x; int ypos = event->xconfigure.y; // NOTE: ConfigureNotify events from the server are in local // coordinates, so if we are reparented we need to translate // the position into root (screen) coordinates if (!event->xany.send_event && window->x11.parent != _glfw.x11.root) { Window dummy; XTranslateCoordinates(_glfw.x11.display, window->x11.parent, _glfw.x11.root, xpos, ypos, &xpos, &ypos, &dummy); } if (xpos != window->x11.xpos || ypos != window->x11.ypos) { _glfwInputWindowPos(window, xpos, ypos); window->x11.xpos = xpos; window->x11.ypos = ypos; } return; } case ClientMessage: { // Custom client message, probably from the window manager if (filtered) return; if (event->xclient.message_type == None) return; if (event->xclient.message_type == _glfw.x11.WM_PROTOCOLS) { const Atom protocol = event->xclient.data.l[0]; if (protocol == None) return; if (protocol == _glfw.x11.WM_DELETE_WINDOW) { // The window manager was asked to close the window, for // example by the user pressing a 'close' window decoration // button _glfwInputWindowCloseRequest(window); } else if (protocol == _glfw.x11.NET_WM_PING) { // The window manager is pinging the application to ensure // it's still responding to events XEvent reply = *event; reply.xclient.window = _glfw.x11.root; XSendEvent(_glfw.x11.display, _glfw.x11.root, False, SubstructureNotifyMask | SubstructureRedirectMask, &reply); } } else if (event->xclient.message_type == _glfw.x11.XdndEnter) { // A drag operation has entered the window unsigned long i, count; Atom* formats = NULL; const GLFWbool list = event->xclient.data.l[1] & 1; _glfw.x11.xdnd.source = event->xclient.data.l[0]; _glfw.x11.xdnd.version = event->xclient.data.l[1] >> 24; _glfw.x11.xdnd.format = None; if (_glfw.x11.xdnd.version > _GLFW_XDND_VERSION) return; if (list) { count = _glfwGetWindowPropertyX11(_glfw.x11.xdnd.source, _glfw.x11.XdndTypeList, XA_ATOM, (unsigned char**) &formats); } else { count = 3; formats = (Atom*) event->xclient.data.l + 2; } for (i = 0; i < count; i++) { if (formats[i] == _glfw.x11.text_uri_list) { _glfw.x11.xdnd.format = _glfw.x11.text_uri_list; break; } } if (list && formats) XFree(formats); } else if (event->xclient.message_type == _glfw.x11.XdndDrop) { // The drag operation has finished by dropping on the window Time time = CurrentTime; if (_glfw.x11.xdnd.version > _GLFW_XDND_VERSION) return; if (_glfw.x11.xdnd.format) { if (_glfw.x11.xdnd.version >= 1) time = event->xclient.data.l[2]; // Request the chosen format from the source window XConvertSelection(_glfw.x11.display, _glfw.x11.XdndSelection, _glfw.x11.xdnd.format, _glfw.x11.XdndSelection, window->x11.handle, time); } else if (_glfw.x11.xdnd.version >= 2) { XEvent reply = { ClientMessage }; reply.xclient.window = _glfw.x11.xdnd.source; reply.xclient.message_type = _glfw.x11.XdndFinished; reply.xclient.format = 32; reply.xclient.data.l[0] = window->x11.handle; reply.xclient.data.l[1] = 0; // The drag was rejected reply.xclient.data.l[2] = None; XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source, False, NoEventMask, &reply); XFlush(_glfw.x11.display); } } else if (event->xclient.message_type == _glfw.x11.XdndPosition) { // The drag operation has moved over the window const int xabs = (event->xclient.data.l[2] >> 16) & 0xffff; const int yabs = (event->xclient.data.l[2]) & 0xffff; Window dummy; int xpos, ypos; if (_glfw.x11.xdnd.version > _GLFW_XDND_VERSION) return; XTranslateCoordinates(_glfw.x11.display, _glfw.x11.root, window->x11.handle, xabs, yabs, &xpos, &ypos, &dummy); _glfwInputCursorPos(window, xpos, ypos); XEvent reply = { ClientMessage }; reply.xclient.window = _glfw.x11.xdnd.source; reply.xclient.message_type = _glfw.x11.XdndStatus; reply.xclient.format = 32; reply.xclient.data.l[0] = window->x11.handle; reply.xclient.data.l[2] = 0; // Specify an empty rectangle reply.xclient.data.l[3] = 0; if (_glfw.x11.xdnd.format) { // Reply that we are ready to copy the dragged data reply.xclient.data.l[1] = 1; // Accept with no rectangle if (_glfw.x11.xdnd.version >= 2) reply.xclient.data.l[4] = _glfw.x11.XdndActionCopy; } XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source, False, NoEventMask, &reply); XFlush(_glfw.x11.display); } return; } case SelectionNotify: { if (event->xselection.property == _glfw.x11.XdndSelection) { // The converted data from the drag operation has arrived char* data; const unsigned long result = _glfwGetWindowPropertyX11(event->xselection.requestor, event->xselection.property, event->xselection.target, (unsigned char**) &data); if (result) { int i, count; char** paths = parseUriList(data, &count); _glfwInputDrop(window, count, (const char**) paths); for (i = 0; i < count; i++) free(paths[i]); free(paths); } if (data) XFree(data); if (_glfw.x11.xdnd.version >= 2) { XEvent reply = { ClientMessage }; reply.xclient.window = _glfw.x11.xdnd.source; reply.xclient.message_type = _glfw.x11.XdndFinished; reply.xclient.format = 32; reply.xclient.data.l[0] = window->x11.handle; reply.xclient.data.l[1] = result; reply.xclient.data.l[2] = _glfw.x11.XdndActionCopy; XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source, False, NoEventMask, &reply); XFlush(_glfw.x11.display); } } return; } case FocusIn: { if (event->xfocus.mode == NotifyGrab || event->xfocus.mode == NotifyUngrab) { // Ignore focus events from popup indicator windows, window menu // key chords and window dragging return; } if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); if (window->x11.ic) XSetICFocus(window->x11.ic); _glfwInputWindowFocus(window, GLFW_TRUE); return; } case FocusOut: { if (event->xfocus.mode == NotifyGrab || event->xfocus.mode == NotifyUngrab) { // Ignore focus events from popup indicator windows, window menu // key chords and window dragging return; } if (window->cursorMode == GLFW_CURSOR_DISABLED) enableCursor(window); if (window->x11.ic) XUnsetICFocus(window->x11.ic); if (window->monitor && window->autoIconify) _glfwPlatformIconifyWindow(window); _glfwInputWindowFocus(window, GLFW_FALSE); return; } case Expose: { _glfwInputWindowDamage(window); return; } case PropertyNotify: { if (event->xproperty.state != PropertyNewValue) return; if (event->xproperty.atom == _glfw.x11.WM_STATE) { const int state = getWindowState(window); if (state != IconicState && state != NormalState) return; const GLFWbool iconified = (state == IconicState); if (window->x11.iconified != iconified) { if (window->monitor) { if (iconified) releaseMonitor(window); else acquireMonitor(window); } window->x11.iconified = iconified; _glfwInputWindowIconify(window, iconified); } } else if (event->xproperty.atom == _glfw.x11.NET_WM_STATE) { const GLFWbool maximized = _glfwPlatformWindowMaximized(window); if (window->x11.maximized != maximized) { window->x11.maximized = maximized; _glfwInputWindowMaximize(window, maximized); } } return; } case DestroyNotify: return; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Retrieve a single window property of the specified type // Inspired by fghGetWindowProperty from freeglut // unsigned long _glfwGetWindowPropertyX11(Window window, Atom property, Atom type, unsigned char** value) { Atom actualType; int actualFormat; unsigned long itemCount, bytesAfter; XGetWindowProperty(_glfw.x11.display, window, property, 0, LONG_MAX, False, type, &actualType, &actualFormat, &itemCount, &bytesAfter, value); return itemCount; } GLFWbool _glfwIsVisualTransparentX11(Visual* visual) { if (!_glfw.x11.xrender.available) return GLFW_FALSE; XRenderPictFormat* pf = XRenderFindVisualFormat(_glfw.x11.display, visual); return pf && pf->direct.alphaMask; } // Push contents of our selection to clipboard manager // void _glfwPushSelectionToManagerX11(void) { XConvertSelection(_glfw.x11.display, _glfw.x11.CLIPBOARD_MANAGER, _glfw.x11.SAVE_TARGETS, None, _glfw.x11.helperWindowHandle, CurrentTime); for (;;) { XEvent event; while (XCheckIfEvent(_glfw.x11.display, &event, isSelectionEvent, NULL)) { switch (event.type) { case SelectionRequest: handleSelectionRequest(&event); break; case SelectionClear: handleSelectionClear(&event); break; case SelectionNotify: { if (event.xselection.target == _glfw.x11.SAVE_TARGETS) { // This means one of two things; either the selection // was not owned, which means there is no clipboard // manager, or the transfer to the clipboard manager has // completed // In either case, it means we are done here return; } break; } } } waitForEvent(NULL); } } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { Visual* visual; int depth; if (ctxconfig->client != GLFW_NO_API) { if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { if (!_glfwInitGLX()) return GLFW_FALSE; if (!_glfwChooseVisualGLX(wndconfig, ctxconfig, fbconfig, &visual, &depth)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) { if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwChooseVisualEGL(wndconfig, ctxconfig, fbconfig, &visual, &depth)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { if (!_glfwInitOSMesa()) return GLFW_FALSE; } } if (ctxconfig->client == GLFW_NO_API || ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { visual = DefaultVisual(_glfw.x11.display, _glfw.x11.screen); depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen); } if (!createNativeWindow(window, wndconfig, visual, depth)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) { if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { if (!_glfwCreateContextGLX(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) { if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) return GLFW_FALSE; } else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) { if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } } if (window->monitor) { _glfwPlatformShowWindow(window); updateWindowMode(window); acquireMonitor(window); } XFlush(_glfw.x11.display); return GLFW_TRUE; } void _glfwPlatformDestroyWindow(_GLFWwindow* window) { if (_glfw.x11.disabledCursorWindow == window) _glfw.x11.disabledCursorWindow = NULL; if (window->monitor) releaseMonitor(window); if (window->x11.ic) { XDestroyIC(window->x11.ic); window->x11.ic = NULL; } if (window->context.destroy) window->context.destroy(window); if (window->x11.handle) { XDeleteContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context); XUnmapWindow(_glfw.x11.display, window->x11.handle); XDestroyWindow(_glfw.x11.display, window->x11.handle); window->x11.handle = (Window) 0; } if (window->x11.colormap) { XFreeColormap(_glfw.x11.display, window->x11.colormap); window->x11.colormap = (Colormap) 0; } XFlush(_glfw.x11.display); } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) { #if defined(X_HAVE_UTF8_STRING) Xutf8SetWMProperties(_glfw.x11.display, window->x11.handle, title, title, NULL, 0, NULL, NULL, NULL); #else // This may be a slightly better fallback than using XStoreName and // XSetIconName, which always store their arguments using STRING XmbSetWMProperties(_glfw.x11.display, window->x11.handle, title, title, NULL, 0, NULL, NULL, NULL); #endif XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_NAME, _glfw.x11.UTF8_STRING, 8, PropModeReplace, (unsigned char*) title, strlen(title)); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_ICON_NAME, _glfw.x11.UTF8_STRING, 8, PropModeReplace, (unsigned char*) title, strlen(title)); XFlush(_glfw.x11.display); } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const GLFWimage* images) { if (count) { int i, j, longCount = 0; for (i = 0; i < count; i++) longCount += 2 + images[i].width * images[i].height; long* icon = calloc(longCount, sizeof(long)); long* target = icon; for (i = 0; i < count; i++) { *target++ = images[i].width; *target++ = images[i].height; for (j = 0; j < images[i].width * images[i].height; j++) { *target++ = (images[i].pixels[j * 4 + 0] << 16) | (images[i].pixels[j * 4 + 1] << 8) | (images[i].pixels[j * 4 + 2] << 0) | (images[i].pixels[j * 4 + 3] << 24); } } XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) icon, longCount); free(icon); } else { XDeleteProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_ICON); } XFlush(_glfw.x11.display); } void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { Window dummy; int x, y; XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root, 0, 0, &x, &y, &dummy); if (xpos) *xpos = x; if (ypos) *ypos = y; } void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) { // HACK: Explicitly setting PPosition to any value causes some WMs, notably // Compiz and Metacity, to honor the position of unmapped windows if (!_glfwPlatformWindowVisible(window)) { long supplied; XSizeHints* hints = XAllocSizeHints(); if (XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied)) { hints->flags |= PPosition; hints->x = hints->y = 0; XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); } XFree(hints); } XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos); XFlush(_glfw.x11.display); } void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { XWindowAttributes attribs; XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &attribs); if (width) *width = attribs.width; if (height) *height = attribs.height; } void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { if (window->monitor) { if (window->monitor->window == window) acquireMonitor(window); } else { if (!window->resizable) updateNormalHints(window, width, height); XResizeWindow(_glfw.x11.display, window->x11.handle, width, height); } XFlush(_glfw.x11.display); } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); updateNormalHints(window, width, height); XFlush(_glfw.x11.display); } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); updateNormalHints(window, width, height); XFlush(_glfw.x11.display); } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { _glfwPlatformGetWindowSize(window, width, height); } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { long* extents = NULL; if (window->monitor || !window->decorated) return; if (_glfw.x11.NET_FRAME_EXTENTS == None) return; if (!_glfwPlatformWindowVisible(window) && _glfw.x11.NET_REQUEST_FRAME_EXTENTS) { XEvent event; double timeout = 0.5; // Ensure _NET_FRAME_EXTENTS is set, allowing glfwGetWindowFrameSize to // function before the window is mapped sendEventToWM(window, _glfw.x11.NET_REQUEST_FRAME_EXTENTS, 0, 0, 0, 0, 0); // HACK: Use a timeout because earlier versions of some window managers // (at least Unity, Fluxbox and Xfwm) failed to send the reply // They have been fixed but broken versions are still in the wild // If you are affected by this and your window manager is NOT // listed above, PLEASE report it to their and our issue trackers while (!XCheckIfEvent(_glfw.x11.display, &event, isFrameExtentsEvent, (XPointer) window)) { if (!waitForEvent(&timeout)) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue"); return; } } } if (_glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.NET_FRAME_EXTENTS, XA_CARDINAL, (unsigned char**) &extents) == 4) { if (left) *left = extents[0]; if (top) *top = extents[2]; if (right) *right = extents[1]; if (bottom) *bottom = extents[3]; } if (extents) XFree(extents); } void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale) { if (xscale) *xscale = _glfw.x11.contentScaleX; if (yscale) *yscale = _glfw.x11.contentScaleY; } void _glfwPlatformIconifyWindow(_GLFWwindow* window) { if (window->x11.overrideRedirect) { // Override-redirect windows cannot be iconified or restored, as those // tasks are performed by the window manager _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Iconification of full screen windows requires a WM that supports EWMH full screen"); return; } XIconifyWindow(_glfw.x11.display, window->x11.handle, _glfw.x11.screen); XFlush(_glfw.x11.display); } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { if (window->x11.overrideRedirect) { // Override-redirect windows cannot be iconified or restored, as those // tasks are performed by the window manager _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Iconification of full screen windows requires a WM that supports EWMH full screen"); return; } if (_glfwPlatformWindowIconified(window)) { XMapWindow(_glfw.x11.display, window->x11.handle); waitForVisibilityNotify(window); } else if (_glfwPlatformWindowVisible(window)) { if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT && _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_REMOVE, _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT, _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ, 1, 0); } } XFlush(_glfw.x11.display); } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT || !_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { return; } if (_glfwPlatformWindowVisible(window)) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_ADD, _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT, _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ, 1, 0); } else { Atom* states = NULL; unsigned long count = _glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, (unsigned char**) &states); // NOTE: We don't check for failure as this property may not exist yet // and that's fine (and we'll create it implicitly with append) Atom missing[2] = { _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT, _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ }; unsigned long missingCount = 2; for (unsigned long i = 0; i < count; i++) { for (unsigned long j = 0; j < missingCount; j++) { if (states[i] == missing[j]) { missing[j] = missing[missingCount - 1]; missingCount--; } } } if (states) XFree(states); if (!missingCount) return; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeAppend, (unsigned char*) missing, missingCount); } XFlush(_glfw.x11.display); } void _glfwPlatformShowWindow(_GLFWwindow* window) { if (_glfwPlatformWindowVisible(window)) return; XMapWindow(_glfw.x11.display, window->x11.handle); waitForVisibilityNotify(window); } void _glfwPlatformHideWindow(_GLFWwindow* window) { XUnmapWindow(_glfw.x11.display, window->x11.handle); XFlush(_glfw.x11.display); } void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION) return; sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_ADD, _glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION, 0, 1, 0); } void _glfwPlatformFocusWindow(_GLFWwindow* window) { if (_glfw.x11.NET_ACTIVE_WINDOW) sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0); else if (_glfwPlatformWindowVisible(window)) { XRaiseWindow(_glfw.x11.display, window->x11.handle); XSetInputFocus(_glfw.x11.display, window->x11.handle, RevertToParent, CurrentTime); } XFlush(_glfw.x11.display); } void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate) { if (window->monitor == monitor) { if (monitor) { if (monitor->window == window) acquireMonitor(window); } else { if (!window->resizable) updateNormalHints(window, width, height); XMoveResizeWindow(_glfw.x11.display, window->x11.handle, xpos, ypos, width, height); } XFlush(_glfw.x11.display); return; } if (window->monitor) releaseMonitor(window); _glfwInputWindowMonitor(window, monitor); updateNormalHints(window, width, height); if (window->monitor) { if (!_glfwPlatformWindowVisible(window)) { XMapRaised(_glfw.x11.display, window->x11.handle); waitForVisibilityNotify(window); } updateWindowMode(window); acquireMonitor(window); } else { updateWindowMode(window); XMoveResizeWindow(_glfw.x11.display, window->x11.handle, xpos, ypos, width, height); } XFlush(_glfw.x11.display); } int _glfwPlatformWindowFocused(_GLFWwindow* window) { Window focused; int state; XGetInputFocus(_glfw.x11.display, &focused, &state); return window->x11.handle == focused; } int _glfwPlatformWindowIconified(_GLFWwindow* window) { return getWindowState(window) == IconicState; } int _glfwPlatformWindowVisible(_GLFWwindow* window) { XWindowAttributes wa; XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &wa); return wa.map_state == IsViewable; } int _glfwPlatformWindowMaximized(_GLFWwindow* window) { Atom* states; unsigned long i; GLFWbool maximized = GLFW_FALSE; if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT || !_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { return maximized; } const unsigned long count = _glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, (unsigned char**) &states); for (i = 0; i < count; i++) { if (states[i] == _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT || states[i] == _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { maximized = GLFW_TRUE; break; } } if (states) XFree(states); return maximized; } int _glfwPlatformWindowHovered(_GLFWwindow* window) { Window w = _glfw.x11.root; while (w) { Window root; int rootX, rootY, childX, childY; unsigned int mask; if (!XQueryPointer(_glfw.x11.display, w, &root, &w, &rootX, &rootY, &childX, &childY, &mask)) { return GLFW_FALSE; } if (w == window->x11.handle) return GLFW_TRUE; } return GLFW_FALSE; } int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { if (!window->x11.transparent) return GLFW_FALSE; return XGetSelectionOwner(_glfw.x11.display, _glfw.x11.NET_WM_CM_Sx) != None; } void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); updateNormalHints(window, width, height); } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { struct { unsigned long flags; unsigned long functions; unsigned long decorations; long input_mode; unsigned long status; } hints = {0}; hints.flags = MWM_HINTS_DECORATIONS; hints.decorations = enabled ? MWM_DECOR_ALL : 0; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.MOTIF_WM_HINTS, _glfw.x11.MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char*) &hints, sizeof(hints) / sizeof(long)); } void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_ABOVE) return; if (_glfwPlatformWindowVisible(window)) { const long action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; sendEventToWM(window, _glfw.x11.NET_WM_STATE, action, _glfw.x11.NET_WM_STATE_ABOVE, 0, 1, 0); } else { Atom* states = NULL; unsigned long i, count; count = _glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, (unsigned char**) &states); // NOTE: We don't check for failure as this property may not exist yet // and that's fine (and we'll create it implicitly with append) if (enabled) { for (i = 0; i < count; i++) { if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE) break; } if (i < count) return; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeAppend, (unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE, 1); } else if (states) { for (i = 0; i < count; i++) { if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE) break; } if (i == count) return; states[i] = states[count - 1]; count--; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char*) states, count); } if (states) XFree(states); } XFlush(_glfw.x11.display); } float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { float opacity = 1.f; if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.NET_WM_CM_Sx)) { CARD32* value = NULL; if (_glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.NET_WM_WINDOW_OPACITY, XA_CARDINAL, (unsigned char**) &value)) { opacity = (float) (*value / (double) 0xffffffffu); } if (value) XFree(value); } return opacity; } void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { const CARD32 value = (CARD32) (0xffffffffu * (double) opacity); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &value, 1); } void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled) { if (!_glfw.x11.xi.available) return; if (_glfw.x11.disabledCursorWindow != window) return; if (enabled) enableRawMouseMotion(window); else disableRawMouseMotion(window); } GLFWbool _glfwPlatformRawMouseMotionSupported(void) { return _glfw.x11.xi.available; } void _glfwPlatformPollEvents(void) { _GLFWwindow* window; #if defined(__linux__) _glfwDetectJoystickConnectionLinux(); #endif XPending(_glfw.x11.display); while (XQLength(_glfw.x11.display)) { XEvent event; XNextEvent(_glfw.x11.display, &event); processEvent(&event); } window = _glfw.x11.disabledCursorWindow; if (window) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); // NOTE: Re-center the cursor only if it has moved since the last call, // to avoid breaking glfwWaitEvents with MotionNotify if (window->x11.lastCursorPosX != width / 2 || window->x11.lastCursorPosY != height / 2) { _glfwPlatformSetCursorPos(window, width / 2, height / 2); } } XFlush(_glfw.x11.display); } void _glfwPlatformWaitEvents(void) { while (!XPending(_glfw.x11.display)) waitForEvent(NULL); _glfwPlatformPollEvents(); } void _glfwPlatformWaitEventsTimeout(double timeout) { while (!XPending(_glfw.x11.display)) { if (!waitForEvent(&timeout)) break; } _glfwPlatformPollEvents(); } void _glfwPlatformPostEmptyEvent(void) { XEvent event = { ClientMessage }; event.xclient.window = _glfw.x11.helperWindowHandle; event.xclient.format = 32; // Data is 32-bit longs event.xclient.message_type = _glfw.x11.NULL_; XSendEvent(_glfw.x11.display, _glfw.x11.helperWindowHandle, False, 0, &event); XFlush(_glfw.x11.display); } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { Window root, child; int rootX, rootY, childX, childY; unsigned int mask; XQueryPointer(_glfw.x11.display, window->x11.handle, &root, &child, &rootX, &rootY, &childX, &childY, &mask); if (xpos) *xpos = childX; if (ypos) *ypos = childY; } void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { // Store the new position so it can be recognized later window->x11.warpCursorPosX = (int) x; window->x11.warpCursorPosY = (int) y; XWarpPointer(_glfw.x11.display, None, window->x11.handle, 0,0,0,0, (int) x, (int) y); XFlush(_glfw.x11.display); } void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { if (mode == GLFW_CURSOR_DISABLED) { if (_glfwPlatformWindowFocused(window)) disableCursor(window); } else if (_glfw.x11.disabledCursorWindow == window) enableCursor(window); else updateCursorImage(window); XFlush(_glfw.x11.display); } const char* _glfwPlatformGetScancodeName(int scancode) { if (!_glfw.x11.xkb.available) return NULL; if (scancode < 0 || scancode > 0xff || _glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); return NULL; } const int key = _glfw.x11.keycodes[scancode]; const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 0); if (keysym == NoSymbol) return NULL; const long ch = _glfwKeySym2Unicode(keysym); if (ch == -1) return NULL; const size_t count = encodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch); if (count == 0) return NULL; _glfw.x11.keynames[key][count] = '\0'; return _glfw.x11.keynames[key]; } int _glfwPlatformGetKeyScancode(int key) { return _glfw.x11.scancodes[key]; } int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) { cursor->x11.handle = _glfwCreateCursorX11(image, xhot, yhot); if (!cursor->x11.handle) return GLFW_FALSE; return GLFW_TRUE; } int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { int native = 0; if (shape == GLFW_ARROW_CURSOR) native = XC_left_ptr; else if (shape == GLFW_IBEAM_CURSOR) native = XC_xterm; else if (shape == GLFW_CROSSHAIR_CURSOR) native = XC_crosshair; else if (shape == GLFW_HAND_CURSOR) native = XC_hand2; else if (shape == GLFW_HRESIZE_CURSOR) native = XC_sb_h_double_arrow; else if (shape == GLFW_VRESIZE_CURSOR) native = XC_sb_v_double_arrow; else return GLFW_FALSE; cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native); if (!cursor->x11.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create standard cursor"); return GLFW_FALSE; } return GLFW_TRUE; } void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) { if (cursor->x11.handle) XFreeCursor(_glfw.x11.display, cursor->x11.handle); } void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { if (window->cursorMode == GLFW_CURSOR_NORMAL) { updateCursorImage(window); XFlush(_glfw.x11.display); } } void _glfwPlatformSetClipboardString(const char* string) { free(_glfw.x11.clipboardString); _glfw.x11.clipboardString = _glfw_strdup(string); XSetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD, _glfw.x11.helperWindowHandle, CurrentTime); if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) != _glfw.x11.helperWindowHandle) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to become owner of clipboard selection"); } } const char* _glfwPlatformGetClipboardString(void) { return getSelectionString(_glfw.x11.CLIPBOARD); } void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) { if (!_glfw.vk.KHR_surface) return; if (!_glfw.vk.KHR_xcb_surface || !_glfw.x11.x11xcb.handle) { if (!_glfw.vk.KHR_xlib_surface) return; } extensions[0] = "VK_KHR_surface"; // NOTE: VK_KHR_xcb_surface is preferred due to some early ICDs exposing but // not correctly implementing VK_KHR_xlib_surface if (_glfw.vk.KHR_xcb_surface && _glfw.x11.x11xcb.handle) extensions[1] = "VK_KHR_xcb_surface"; else extensions[1] = "VK_KHR_xlib_surface"; } int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { VisualID visualID = XVisualIDFromVisual(DefaultVisual(_glfw.x11.display, _glfw.x11.screen)); if (_glfw.vk.KHR_xcb_surface && _glfw.x11.x11xcb.handle) { PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR vkGetPhysicalDeviceXcbPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR) vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); if (!vkGetPhysicalDeviceXcbPresentationSupportKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "X11: Vulkan instance missing VK_KHR_xcb_surface extension"); return GLFW_FALSE; } xcb_connection_t* connection = XGetXCBConnection(_glfw.x11.display); if (!connection) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to retrieve XCB connection"); return GLFW_FALSE; } return vkGetPhysicalDeviceXcbPresentationSupportKHR(device, queuefamily, connection, visualID); } else { PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR vkGetPhysicalDeviceXlibPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR) vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); if (!vkGetPhysicalDeviceXlibPresentationSupportKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "X11: Vulkan instance missing VK_KHR_xlib_surface extension"); return GLFW_FALSE; } return vkGetPhysicalDeviceXlibPresentationSupportKHR(device, queuefamily, _glfw.x11.display, visualID); } } VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { if (_glfw.vk.KHR_xcb_surface && _glfw.x11.x11xcb.handle) { VkResult err; VkXcbSurfaceCreateInfoKHR sci; PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR; xcb_connection_t* connection = XGetXCBConnection(_glfw.x11.display); if (!connection) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to retrieve XCB connection"); return VK_ERROR_EXTENSION_NOT_PRESENT; } vkCreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR) vkGetInstanceProcAddr(instance, "vkCreateXcbSurfaceKHR"); if (!vkCreateXcbSurfaceKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "X11: Vulkan instance missing VK_KHR_xcb_surface extension"); return VK_ERROR_EXTENSION_NOT_PRESENT; } memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; sci.connection = connection; sci.window = window->x11.handle; err = vkCreateXcbSurfaceKHR(instance, &sci, allocator, surface); if (err) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create Vulkan XCB surface: %s", _glfwGetVulkanResultString(err)); } return err; } else { VkResult err; VkXlibSurfaceCreateInfoKHR sci; PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR; vkCreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR) vkGetInstanceProcAddr(instance, "vkCreateXlibSurfaceKHR"); if (!vkCreateXlibSurfaceKHR) { _glfwInputError(GLFW_API_UNAVAILABLE, "X11: Vulkan instance missing VK_KHR_xlib_surface extension"); return VK_ERROR_EXTENSION_NOT_PRESENT; } memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; sci.dpy = _glfw.x11.display; sci.window = window->x11.handle; err = vkCreateXlibSurfaceKHR(instance, &sci, allocator, surface); if (err) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create Vulkan X11 surface: %s", _glfwGetVulkanResultString(err)); } return err; } } ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// ////////////////////////////////////////////////////////////////////////// GLFWAPI Display* glfwGetX11Display(void) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return _glfw.x11.display; } GLFWAPI Window glfwGetX11Window(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(None); return window->x11.handle; } GLFWAPI void glfwSetX11SelectionString(const char* string) { _GLFW_REQUIRE_INIT(); free(_glfw.x11.primarySelectionString); _glfw.x11.primarySelectionString = _glfw_strdup(string); XSetSelectionOwner(_glfw.x11.display, _glfw.x11.PRIMARY, _glfw.x11.helperWindowHandle, CurrentTime); if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.PRIMARY) != _glfw.x11.helperWindowHandle) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to become owner of primary selection"); } } GLFWAPI const char* glfwGetX11SelectionString(void) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); return getSelectionString(_glfw.x11.PRIMARY); } ================================================ FILE: thirdparty/glfw/src/xkb_unicode.c ================================================ //======================================================================== // GLFW 3.3 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2017 Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // It is fine to use C99 in this file because it will not be built with VS //======================================================================== #include "internal.h" /* * Marcus: This code was originally written by Markus G. Kuhn. * I have made some slight changes (trimmed it down a bit from >60 KB to * 20 KB), but the functionality is the same. */ /* * This module converts keysym values into the corresponding ISO 10646 * (UCS, Unicode) values. * * The array keysymtab[] contains pairs of X11 keysym values for graphical * characters and the corresponding Unicode value. The function * _glfwKeySym2Unicode() maps a keysym onto a Unicode value using a binary * search, therefore keysymtab[] must remain SORTED by keysym value. * * We allow to represent any UCS character in the range U-00000000 to * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff. * This admittedly does not cover the entire 31-bit space of UCS, but * it does cover all of the characters up to U-10FFFF, which can be * represented by UTF-16, and more, and it is very unlikely that higher * UCS codes will ever be assigned by ISO. So to get Unicode character * U+ABCD you can directly use keysym 0x0100abcd. * * Original author: Markus G. Kuhn , University of * Cambridge, April 2001 * * Special thanks to Richard Verhoeven for preparing * an initial draft of the mapping table. * */ //************************************************************************ //**** KeySym to Unicode mapping table **** //************************************************************************ static const struct codepair { unsigned short keysym; unsigned short ucs; } keysymtab[] = { { 0x01a1, 0x0104 }, { 0x01a2, 0x02d8 }, { 0x01a3, 0x0141 }, { 0x01a5, 0x013d }, { 0x01a6, 0x015a }, { 0x01a9, 0x0160 }, { 0x01aa, 0x015e }, { 0x01ab, 0x0164 }, { 0x01ac, 0x0179 }, { 0x01ae, 0x017d }, { 0x01af, 0x017b }, { 0x01b1, 0x0105 }, { 0x01b2, 0x02db }, { 0x01b3, 0x0142 }, { 0x01b5, 0x013e }, { 0x01b6, 0x015b }, { 0x01b7, 0x02c7 }, { 0x01b9, 0x0161 }, { 0x01ba, 0x015f }, { 0x01bb, 0x0165 }, { 0x01bc, 0x017a }, { 0x01bd, 0x02dd }, { 0x01be, 0x017e }, { 0x01bf, 0x017c }, { 0x01c0, 0x0154 }, { 0x01c3, 0x0102 }, { 0x01c5, 0x0139 }, { 0x01c6, 0x0106 }, { 0x01c8, 0x010c }, { 0x01ca, 0x0118 }, { 0x01cc, 0x011a }, { 0x01cf, 0x010e }, { 0x01d0, 0x0110 }, { 0x01d1, 0x0143 }, { 0x01d2, 0x0147 }, { 0x01d5, 0x0150 }, { 0x01d8, 0x0158 }, { 0x01d9, 0x016e }, { 0x01db, 0x0170 }, { 0x01de, 0x0162 }, { 0x01e0, 0x0155 }, { 0x01e3, 0x0103 }, { 0x01e5, 0x013a }, { 0x01e6, 0x0107 }, { 0x01e8, 0x010d }, { 0x01ea, 0x0119 }, { 0x01ec, 0x011b }, { 0x01ef, 0x010f }, { 0x01f0, 0x0111 }, { 0x01f1, 0x0144 }, { 0x01f2, 0x0148 }, { 0x01f5, 0x0151 }, { 0x01f8, 0x0159 }, { 0x01f9, 0x016f }, { 0x01fb, 0x0171 }, { 0x01fe, 0x0163 }, { 0x01ff, 0x02d9 }, { 0x02a1, 0x0126 }, { 0x02a6, 0x0124 }, { 0x02a9, 0x0130 }, { 0x02ab, 0x011e }, { 0x02ac, 0x0134 }, { 0x02b1, 0x0127 }, { 0x02b6, 0x0125 }, { 0x02b9, 0x0131 }, { 0x02bb, 0x011f }, { 0x02bc, 0x0135 }, { 0x02c5, 0x010a }, { 0x02c6, 0x0108 }, { 0x02d5, 0x0120 }, { 0x02d8, 0x011c }, { 0x02dd, 0x016c }, { 0x02de, 0x015c }, { 0x02e5, 0x010b }, { 0x02e6, 0x0109 }, { 0x02f5, 0x0121 }, { 0x02f8, 0x011d }, { 0x02fd, 0x016d }, { 0x02fe, 0x015d }, { 0x03a2, 0x0138 }, { 0x03a3, 0x0156 }, { 0x03a5, 0x0128 }, { 0x03a6, 0x013b }, { 0x03aa, 0x0112 }, { 0x03ab, 0x0122 }, { 0x03ac, 0x0166 }, { 0x03b3, 0x0157 }, { 0x03b5, 0x0129 }, { 0x03b6, 0x013c }, { 0x03ba, 0x0113 }, { 0x03bb, 0x0123 }, { 0x03bc, 0x0167 }, { 0x03bd, 0x014a }, { 0x03bf, 0x014b }, { 0x03c0, 0x0100 }, { 0x03c7, 0x012e }, { 0x03cc, 0x0116 }, { 0x03cf, 0x012a }, { 0x03d1, 0x0145 }, { 0x03d2, 0x014c }, { 0x03d3, 0x0136 }, { 0x03d9, 0x0172 }, { 0x03dd, 0x0168 }, { 0x03de, 0x016a }, { 0x03e0, 0x0101 }, { 0x03e7, 0x012f }, { 0x03ec, 0x0117 }, { 0x03ef, 0x012b }, { 0x03f1, 0x0146 }, { 0x03f2, 0x014d }, { 0x03f3, 0x0137 }, { 0x03f9, 0x0173 }, { 0x03fd, 0x0169 }, { 0x03fe, 0x016b }, { 0x047e, 0x203e }, { 0x04a1, 0x3002 }, { 0x04a2, 0x300c }, { 0x04a3, 0x300d }, { 0x04a4, 0x3001 }, { 0x04a5, 0x30fb }, { 0x04a6, 0x30f2 }, { 0x04a7, 0x30a1 }, { 0x04a8, 0x30a3 }, { 0x04a9, 0x30a5 }, { 0x04aa, 0x30a7 }, { 0x04ab, 0x30a9 }, { 0x04ac, 0x30e3 }, { 0x04ad, 0x30e5 }, { 0x04ae, 0x30e7 }, { 0x04af, 0x30c3 }, { 0x04b0, 0x30fc }, { 0x04b1, 0x30a2 }, { 0x04b2, 0x30a4 }, { 0x04b3, 0x30a6 }, { 0x04b4, 0x30a8 }, { 0x04b5, 0x30aa }, { 0x04b6, 0x30ab }, { 0x04b7, 0x30ad }, { 0x04b8, 0x30af }, { 0x04b9, 0x30b1 }, { 0x04ba, 0x30b3 }, { 0x04bb, 0x30b5 }, { 0x04bc, 0x30b7 }, { 0x04bd, 0x30b9 }, { 0x04be, 0x30bb }, { 0x04bf, 0x30bd }, { 0x04c0, 0x30bf }, { 0x04c1, 0x30c1 }, { 0x04c2, 0x30c4 }, { 0x04c3, 0x30c6 }, { 0x04c4, 0x30c8 }, { 0x04c5, 0x30ca }, { 0x04c6, 0x30cb }, { 0x04c7, 0x30cc }, { 0x04c8, 0x30cd }, { 0x04c9, 0x30ce }, { 0x04ca, 0x30cf }, { 0x04cb, 0x30d2 }, { 0x04cc, 0x30d5 }, { 0x04cd, 0x30d8 }, { 0x04ce, 0x30db }, { 0x04cf, 0x30de }, { 0x04d0, 0x30df }, { 0x04d1, 0x30e0 }, { 0x04d2, 0x30e1 }, { 0x04d3, 0x30e2 }, { 0x04d4, 0x30e4 }, { 0x04d5, 0x30e6 }, { 0x04d6, 0x30e8 }, { 0x04d7, 0x30e9 }, { 0x04d8, 0x30ea }, { 0x04d9, 0x30eb }, { 0x04da, 0x30ec }, { 0x04db, 0x30ed }, { 0x04dc, 0x30ef }, { 0x04dd, 0x30f3 }, { 0x04de, 0x309b }, { 0x04df, 0x309c }, { 0x05ac, 0x060c }, { 0x05bb, 0x061b }, { 0x05bf, 0x061f }, { 0x05c1, 0x0621 }, { 0x05c2, 0x0622 }, { 0x05c3, 0x0623 }, { 0x05c4, 0x0624 }, { 0x05c5, 0x0625 }, { 0x05c6, 0x0626 }, { 0x05c7, 0x0627 }, { 0x05c8, 0x0628 }, { 0x05c9, 0x0629 }, { 0x05ca, 0x062a }, { 0x05cb, 0x062b }, { 0x05cc, 0x062c }, { 0x05cd, 0x062d }, { 0x05ce, 0x062e }, { 0x05cf, 0x062f }, { 0x05d0, 0x0630 }, { 0x05d1, 0x0631 }, { 0x05d2, 0x0632 }, { 0x05d3, 0x0633 }, { 0x05d4, 0x0634 }, { 0x05d5, 0x0635 }, { 0x05d6, 0x0636 }, { 0x05d7, 0x0637 }, { 0x05d8, 0x0638 }, { 0x05d9, 0x0639 }, { 0x05da, 0x063a }, { 0x05e0, 0x0640 }, { 0x05e1, 0x0641 }, { 0x05e2, 0x0642 }, { 0x05e3, 0x0643 }, { 0x05e4, 0x0644 }, { 0x05e5, 0x0645 }, { 0x05e6, 0x0646 }, { 0x05e7, 0x0647 }, { 0x05e8, 0x0648 }, { 0x05e9, 0x0649 }, { 0x05ea, 0x064a }, { 0x05eb, 0x064b }, { 0x05ec, 0x064c }, { 0x05ed, 0x064d }, { 0x05ee, 0x064e }, { 0x05ef, 0x064f }, { 0x05f0, 0x0650 }, { 0x05f1, 0x0651 }, { 0x05f2, 0x0652 }, { 0x06a1, 0x0452 }, { 0x06a2, 0x0453 }, { 0x06a3, 0x0451 }, { 0x06a4, 0x0454 }, { 0x06a5, 0x0455 }, { 0x06a6, 0x0456 }, { 0x06a7, 0x0457 }, { 0x06a8, 0x0458 }, { 0x06a9, 0x0459 }, { 0x06aa, 0x045a }, { 0x06ab, 0x045b }, { 0x06ac, 0x045c }, { 0x06ae, 0x045e }, { 0x06af, 0x045f }, { 0x06b0, 0x2116 }, { 0x06b1, 0x0402 }, { 0x06b2, 0x0403 }, { 0x06b3, 0x0401 }, { 0x06b4, 0x0404 }, { 0x06b5, 0x0405 }, { 0x06b6, 0x0406 }, { 0x06b7, 0x0407 }, { 0x06b8, 0x0408 }, { 0x06b9, 0x0409 }, { 0x06ba, 0x040a }, { 0x06bb, 0x040b }, { 0x06bc, 0x040c }, { 0x06be, 0x040e }, { 0x06bf, 0x040f }, { 0x06c0, 0x044e }, { 0x06c1, 0x0430 }, { 0x06c2, 0x0431 }, { 0x06c3, 0x0446 }, { 0x06c4, 0x0434 }, { 0x06c5, 0x0435 }, { 0x06c6, 0x0444 }, { 0x06c7, 0x0433 }, { 0x06c8, 0x0445 }, { 0x06c9, 0x0438 }, { 0x06ca, 0x0439 }, { 0x06cb, 0x043a }, { 0x06cc, 0x043b }, { 0x06cd, 0x043c }, { 0x06ce, 0x043d }, { 0x06cf, 0x043e }, { 0x06d0, 0x043f }, { 0x06d1, 0x044f }, { 0x06d2, 0x0440 }, { 0x06d3, 0x0441 }, { 0x06d4, 0x0442 }, { 0x06d5, 0x0443 }, { 0x06d6, 0x0436 }, { 0x06d7, 0x0432 }, { 0x06d8, 0x044c }, { 0x06d9, 0x044b }, { 0x06da, 0x0437 }, { 0x06db, 0x0448 }, { 0x06dc, 0x044d }, { 0x06dd, 0x0449 }, { 0x06de, 0x0447 }, { 0x06df, 0x044a }, { 0x06e0, 0x042e }, { 0x06e1, 0x0410 }, { 0x06e2, 0x0411 }, { 0x06e3, 0x0426 }, { 0x06e4, 0x0414 }, { 0x06e5, 0x0415 }, { 0x06e6, 0x0424 }, { 0x06e7, 0x0413 }, { 0x06e8, 0x0425 }, { 0x06e9, 0x0418 }, { 0x06ea, 0x0419 }, { 0x06eb, 0x041a }, { 0x06ec, 0x041b }, { 0x06ed, 0x041c }, { 0x06ee, 0x041d }, { 0x06ef, 0x041e }, { 0x06f0, 0x041f }, { 0x06f1, 0x042f }, { 0x06f2, 0x0420 }, { 0x06f3, 0x0421 }, { 0x06f4, 0x0422 }, { 0x06f5, 0x0423 }, { 0x06f6, 0x0416 }, { 0x06f7, 0x0412 }, { 0x06f8, 0x042c }, { 0x06f9, 0x042b }, { 0x06fa, 0x0417 }, { 0x06fb, 0x0428 }, { 0x06fc, 0x042d }, { 0x06fd, 0x0429 }, { 0x06fe, 0x0427 }, { 0x06ff, 0x042a }, { 0x07a1, 0x0386 }, { 0x07a2, 0x0388 }, { 0x07a3, 0x0389 }, { 0x07a4, 0x038a }, { 0x07a5, 0x03aa }, { 0x07a7, 0x038c }, { 0x07a8, 0x038e }, { 0x07a9, 0x03ab }, { 0x07ab, 0x038f }, { 0x07ae, 0x0385 }, { 0x07af, 0x2015 }, { 0x07b1, 0x03ac }, { 0x07b2, 0x03ad }, { 0x07b3, 0x03ae }, { 0x07b4, 0x03af }, { 0x07b5, 0x03ca }, { 0x07b6, 0x0390 }, { 0x07b7, 0x03cc }, { 0x07b8, 0x03cd }, { 0x07b9, 0x03cb }, { 0x07ba, 0x03b0 }, { 0x07bb, 0x03ce }, { 0x07c1, 0x0391 }, { 0x07c2, 0x0392 }, { 0x07c3, 0x0393 }, { 0x07c4, 0x0394 }, { 0x07c5, 0x0395 }, { 0x07c6, 0x0396 }, { 0x07c7, 0x0397 }, { 0x07c8, 0x0398 }, { 0x07c9, 0x0399 }, { 0x07ca, 0x039a }, { 0x07cb, 0x039b }, { 0x07cc, 0x039c }, { 0x07cd, 0x039d }, { 0x07ce, 0x039e }, { 0x07cf, 0x039f }, { 0x07d0, 0x03a0 }, { 0x07d1, 0x03a1 }, { 0x07d2, 0x03a3 }, { 0x07d4, 0x03a4 }, { 0x07d5, 0x03a5 }, { 0x07d6, 0x03a6 }, { 0x07d7, 0x03a7 }, { 0x07d8, 0x03a8 }, { 0x07d9, 0x03a9 }, { 0x07e1, 0x03b1 }, { 0x07e2, 0x03b2 }, { 0x07e3, 0x03b3 }, { 0x07e4, 0x03b4 }, { 0x07e5, 0x03b5 }, { 0x07e6, 0x03b6 }, { 0x07e7, 0x03b7 }, { 0x07e8, 0x03b8 }, { 0x07e9, 0x03b9 }, { 0x07ea, 0x03ba }, { 0x07eb, 0x03bb }, { 0x07ec, 0x03bc }, { 0x07ed, 0x03bd }, { 0x07ee, 0x03be }, { 0x07ef, 0x03bf }, { 0x07f0, 0x03c0 }, { 0x07f1, 0x03c1 }, { 0x07f2, 0x03c3 }, { 0x07f3, 0x03c2 }, { 0x07f4, 0x03c4 }, { 0x07f5, 0x03c5 }, { 0x07f6, 0x03c6 }, { 0x07f7, 0x03c7 }, { 0x07f8, 0x03c8 }, { 0x07f9, 0x03c9 }, { 0x08a1, 0x23b7 }, { 0x08a2, 0x250c }, { 0x08a3, 0x2500 }, { 0x08a4, 0x2320 }, { 0x08a5, 0x2321 }, { 0x08a6, 0x2502 }, { 0x08a7, 0x23a1 }, { 0x08a8, 0x23a3 }, { 0x08a9, 0x23a4 }, { 0x08aa, 0x23a6 }, { 0x08ab, 0x239b }, { 0x08ac, 0x239d }, { 0x08ad, 0x239e }, { 0x08ae, 0x23a0 }, { 0x08af, 0x23a8 }, { 0x08b0, 0x23ac }, { 0x08bc, 0x2264 }, { 0x08bd, 0x2260 }, { 0x08be, 0x2265 }, { 0x08bf, 0x222b }, { 0x08c0, 0x2234 }, { 0x08c1, 0x221d }, { 0x08c2, 0x221e }, { 0x08c5, 0x2207 }, { 0x08c8, 0x223c }, { 0x08c9, 0x2243 }, { 0x08cd, 0x21d4 }, { 0x08ce, 0x21d2 }, { 0x08cf, 0x2261 }, { 0x08d6, 0x221a }, { 0x08da, 0x2282 }, { 0x08db, 0x2283 }, { 0x08dc, 0x2229 }, { 0x08dd, 0x222a }, { 0x08de, 0x2227 }, { 0x08df, 0x2228 }, { 0x08ef, 0x2202 }, { 0x08f6, 0x0192 }, { 0x08fb, 0x2190 }, { 0x08fc, 0x2191 }, { 0x08fd, 0x2192 }, { 0x08fe, 0x2193 }, { 0x09e0, 0x25c6 }, { 0x09e1, 0x2592 }, { 0x09e2, 0x2409 }, { 0x09e3, 0x240c }, { 0x09e4, 0x240d }, { 0x09e5, 0x240a }, { 0x09e8, 0x2424 }, { 0x09e9, 0x240b }, { 0x09ea, 0x2518 }, { 0x09eb, 0x2510 }, { 0x09ec, 0x250c }, { 0x09ed, 0x2514 }, { 0x09ee, 0x253c }, { 0x09ef, 0x23ba }, { 0x09f0, 0x23bb }, { 0x09f1, 0x2500 }, { 0x09f2, 0x23bc }, { 0x09f3, 0x23bd }, { 0x09f4, 0x251c }, { 0x09f5, 0x2524 }, { 0x09f6, 0x2534 }, { 0x09f7, 0x252c }, { 0x09f8, 0x2502 }, { 0x0aa1, 0x2003 }, { 0x0aa2, 0x2002 }, { 0x0aa3, 0x2004 }, { 0x0aa4, 0x2005 }, { 0x0aa5, 0x2007 }, { 0x0aa6, 0x2008 }, { 0x0aa7, 0x2009 }, { 0x0aa8, 0x200a }, { 0x0aa9, 0x2014 }, { 0x0aaa, 0x2013 }, { 0x0aae, 0x2026 }, { 0x0aaf, 0x2025 }, { 0x0ab0, 0x2153 }, { 0x0ab1, 0x2154 }, { 0x0ab2, 0x2155 }, { 0x0ab3, 0x2156 }, { 0x0ab4, 0x2157 }, { 0x0ab5, 0x2158 }, { 0x0ab6, 0x2159 }, { 0x0ab7, 0x215a }, { 0x0ab8, 0x2105 }, { 0x0abb, 0x2012 }, { 0x0abc, 0x2329 }, { 0x0abe, 0x232a }, { 0x0ac3, 0x215b }, { 0x0ac4, 0x215c }, { 0x0ac5, 0x215d }, { 0x0ac6, 0x215e }, { 0x0ac9, 0x2122 }, { 0x0aca, 0x2613 }, { 0x0acc, 0x25c1 }, { 0x0acd, 0x25b7 }, { 0x0ace, 0x25cb }, { 0x0acf, 0x25af }, { 0x0ad0, 0x2018 }, { 0x0ad1, 0x2019 }, { 0x0ad2, 0x201c }, { 0x0ad3, 0x201d }, { 0x0ad4, 0x211e }, { 0x0ad6, 0x2032 }, { 0x0ad7, 0x2033 }, { 0x0ad9, 0x271d }, { 0x0adb, 0x25ac }, { 0x0adc, 0x25c0 }, { 0x0add, 0x25b6 }, { 0x0ade, 0x25cf }, { 0x0adf, 0x25ae }, { 0x0ae0, 0x25e6 }, { 0x0ae1, 0x25ab }, { 0x0ae2, 0x25ad }, { 0x0ae3, 0x25b3 }, { 0x0ae4, 0x25bd }, { 0x0ae5, 0x2606 }, { 0x0ae6, 0x2022 }, { 0x0ae7, 0x25aa }, { 0x0ae8, 0x25b2 }, { 0x0ae9, 0x25bc }, { 0x0aea, 0x261c }, { 0x0aeb, 0x261e }, { 0x0aec, 0x2663 }, { 0x0aed, 0x2666 }, { 0x0aee, 0x2665 }, { 0x0af0, 0x2720 }, { 0x0af1, 0x2020 }, { 0x0af2, 0x2021 }, { 0x0af3, 0x2713 }, { 0x0af4, 0x2717 }, { 0x0af5, 0x266f }, { 0x0af6, 0x266d }, { 0x0af7, 0x2642 }, { 0x0af8, 0x2640 }, { 0x0af9, 0x260e }, { 0x0afa, 0x2315 }, { 0x0afb, 0x2117 }, { 0x0afc, 0x2038 }, { 0x0afd, 0x201a }, { 0x0afe, 0x201e }, { 0x0ba3, 0x003c }, { 0x0ba6, 0x003e }, { 0x0ba8, 0x2228 }, { 0x0ba9, 0x2227 }, { 0x0bc0, 0x00af }, { 0x0bc2, 0x22a5 }, { 0x0bc3, 0x2229 }, { 0x0bc4, 0x230a }, { 0x0bc6, 0x005f }, { 0x0bca, 0x2218 }, { 0x0bcc, 0x2395 }, { 0x0bce, 0x22a4 }, { 0x0bcf, 0x25cb }, { 0x0bd3, 0x2308 }, { 0x0bd6, 0x222a }, { 0x0bd8, 0x2283 }, { 0x0bda, 0x2282 }, { 0x0bdc, 0x22a2 }, { 0x0bfc, 0x22a3 }, { 0x0cdf, 0x2017 }, { 0x0ce0, 0x05d0 }, { 0x0ce1, 0x05d1 }, { 0x0ce2, 0x05d2 }, { 0x0ce3, 0x05d3 }, { 0x0ce4, 0x05d4 }, { 0x0ce5, 0x05d5 }, { 0x0ce6, 0x05d6 }, { 0x0ce7, 0x05d7 }, { 0x0ce8, 0x05d8 }, { 0x0ce9, 0x05d9 }, { 0x0cea, 0x05da }, { 0x0ceb, 0x05db }, { 0x0cec, 0x05dc }, { 0x0ced, 0x05dd }, { 0x0cee, 0x05de }, { 0x0cef, 0x05df }, { 0x0cf0, 0x05e0 }, { 0x0cf1, 0x05e1 }, { 0x0cf2, 0x05e2 }, { 0x0cf3, 0x05e3 }, { 0x0cf4, 0x05e4 }, { 0x0cf5, 0x05e5 }, { 0x0cf6, 0x05e6 }, { 0x0cf7, 0x05e7 }, { 0x0cf8, 0x05e8 }, { 0x0cf9, 0x05e9 }, { 0x0cfa, 0x05ea }, { 0x0da1, 0x0e01 }, { 0x0da2, 0x0e02 }, { 0x0da3, 0x0e03 }, { 0x0da4, 0x0e04 }, { 0x0da5, 0x0e05 }, { 0x0da6, 0x0e06 }, { 0x0da7, 0x0e07 }, { 0x0da8, 0x0e08 }, { 0x0da9, 0x0e09 }, { 0x0daa, 0x0e0a }, { 0x0dab, 0x0e0b }, { 0x0dac, 0x0e0c }, { 0x0dad, 0x0e0d }, { 0x0dae, 0x0e0e }, { 0x0daf, 0x0e0f }, { 0x0db0, 0x0e10 }, { 0x0db1, 0x0e11 }, { 0x0db2, 0x0e12 }, { 0x0db3, 0x0e13 }, { 0x0db4, 0x0e14 }, { 0x0db5, 0x0e15 }, { 0x0db6, 0x0e16 }, { 0x0db7, 0x0e17 }, { 0x0db8, 0x0e18 }, { 0x0db9, 0x0e19 }, { 0x0dba, 0x0e1a }, { 0x0dbb, 0x0e1b }, { 0x0dbc, 0x0e1c }, { 0x0dbd, 0x0e1d }, { 0x0dbe, 0x0e1e }, { 0x0dbf, 0x0e1f }, { 0x0dc0, 0x0e20 }, { 0x0dc1, 0x0e21 }, { 0x0dc2, 0x0e22 }, { 0x0dc3, 0x0e23 }, { 0x0dc4, 0x0e24 }, { 0x0dc5, 0x0e25 }, { 0x0dc6, 0x0e26 }, { 0x0dc7, 0x0e27 }, { 0x0dc8, 0x0e28 }, { 0x0dc9, 0x0e29 }, { 0x0dca, 0x0e2a }, { 0x0dcb, 0x0e2b }, { 0x0dcc, 0x0e2c }, { 0x0dcd, 0x0e2d }, { 0x0dce, 0x0e2e }, { 0x0dcf, 0x0e2f }, { 0x0dd0, 0x0e30 }, { 0x0dd1, 0x0e31 }, { 0x0dd2, 0x0e32 }, { 0x0dd3, 0x0e33 }, { 0x0dd4, 0x0e34 }, { 0x0dd5, 0x0e35 }, { 0x0dd6, 0x0e36 }, { 0x0dd7, 0x0e37 }, { 0x0dd8, 0x0e38 }, { 0x0dd9, 0x0e39 }, { 0x0dda, 0x0e3a }, { 0x0ddf, 0x0e3f }, { 0x0de0, 0x0e40 }, { 0x0de1, 0x0e41 }, { 0x0de2, 0x0e42 }, { 0x0de3, 0x0e43 }, { 0x0de4, 0x0e44 }, { 0x0de5, 0x0e45 }, { 0x0de6, 0x0e46 }, { 0x0de7, 0x0e47 }, { 0x0de8, 0x0e48 }, { 0x0de9, 0x0e49 }, { 0x0dea, 0x0e4a }, { 0x0deb, 0x0e4b }, { 0x0dec, 0x0e4c }, { 0x0ded, 0x0e4d }, { 0x0df0, 0x0e50 }, { 0x0df1, 0x0e51 }, { 0x0df2, 0x0e52 }, { 0x0df3, 0x0e53 }, { 0x0df4, 0x0e54 }, { 0x0df5, 0x0e55 }, { 0x0df6, 0x0e56 }, { 0x0df7, 0x0e57 }, { 0x0df8, 0x0e58 }, { 0x0df9, 0x0e59 }, { 0x0ea1, 0x3131 }, { 0x0ea2, 0x3132 }, { 0x0ea3, 0x3133 }, { 0x0ea4, 0x3134 }, { 0x0ea5, 0x3135 }, { 0x0ea6, 0x3136 }, { 0x0ea7, 0x3137 }, { 0x0ea8, 0x3138 }, { 0x0ea9, 0x3139 }, { 0x0eaa, 0x313a }, { 0x0eab, 0x313b }, { 0x0eac, 0x313c }, { 0x0ead, 0x313d }, { 0x0eae, 0x313e }, { 0x0eaf, 0x313f }, { 0x0eb0, 0x3140 }, { 0x0eb1, 0x3141 }, { 0x0eb2, 0x3142 }, { 0x0eb3, 0x3143 }, { 0x0eb4, 0x3144 }, { 0x0eb5, 0x3145 }, { 0x0eb6, 0x3146 }, { 0x0eb7, 0x3147 }, { 0x0eb8, 0x3148 }, { 0x0eb9, 0x3149 }, { 0x0eba, 0x314a }, { 0x0ebb, 0x314b }, { 0x0ebc, 0x314c }, { 0x0ebd, 0x314d }, { 0x0ebe, 0x314e }, { 0x0ebf, 0x314f }, { 0x0ec0, 0x3150 }, { 0x0ec1, 0x3151 }, { 0x0ec2, 0x3152 }, { 0x0ec3, 0x3153 }, { 0x0ec4, 0x3154 }, { 0x0ec5, 0x3155 }, { 0x0ec6, 0x3156 }, { 0x0ec7, 0x3157 }, { 0x0ec8, 0x3158 }, { 0x0ec9, 0x3159 }, { 0x0eca, 0x315a }, { 0x0ecb, 0x315b }, { 0x0ecc, 0x315c }, { 0x0ecd, 0x315d }, { 0x0ece, 0x315e }, { 0x0ecf, 0x315f }, { 0x0ed0, 0x3160 }, { 0x0ed1, 0x3161 }, { 0x0ed2, 0x3162 }, { 0x0ed3, 0x3163 }, { 0x0ed4, 0x11a8 }, { 0x0ed5, 0x11a9 }, { 0x0ed6, 0x11aa }, { 0x0ed7, 0x11ab }, { 0x0ed8, 0x11ac }, { 0x0ed9, 0x11ad }, { 0x0eda, 0x11ae }, { 0x0edb, 0x11af }, { 0x0edc, 0x11b0 }, { 0x0edd, 0x11b1 }, { 0x0ede, 0x11b2 }, { 0x0edf, 0x11b3 }, { 0x0ee0, 0x11b4 }, { 0x0ee1, 0x11b5 }, { 0x0ee2, 0x11b6 }, { 0x0ee3, 0x11b7 }, { 0x0ee4, 0x11b8 }, { 0x0ee5, 0x11b9 }, { 0x0ee6, 0x11ba }, { 0x0ee7, 0x11bb }, { 0x0ee8, 0x11bc }, { 0x0ee9, 0x11bd }, { 0x0eea, 0x11be }, { 0x0eeb, 0x11bf }, { 0x0eec, 0x11c0 }, { 0x0eed, 0x11c1 }, { 0x0eee, 0x11c2 }, { 0x0eef, 0x316d }, { 0x0ef0, 0x3171 }, { 0x0ef1, 0x3178 }, { 0x0ef2, 0x317f }, { 0x0ef3, 0x3181 }, { 0x0ef4, 0x3184 }, { 0x0ef5, 0x3186 }, { 0x0ef6, 0x318d }, { 0x0ef7, 0x318e }, { 0x0ef8, 0x11eb }, { 0x0ef9, 0x11f0 }, { 0x0efa, 0x11f9 }, { 0x0eff, 0x20a9 }, { 0x13a4, 0x20ac }, { 0x13bc, 0x0152 }, { 0x13bd, 0x0153 }, { 0x13be, 0x0178 }, { 0x20ac, 0x20ac }, { 0xfe50, '`' }, { 0xfe51, 0x00b4 }, { 0xfe52, '^' }, { 0xfe53, '~' }, { 0xfe54, 0x00af }, { 0xfe55, 0x02d8 }, { 0xfe56, 0x02d9 }, { 0xfe57, 0x00a8 }, { 0xfe58, 0x02da }, { 0xfe59, 0x02dd }, { 0xfe5a, 0x02c7 }, { 0xfe5b, 0x00b8 }, { 0xfe5c, 0x02db }, { 0xfe5d, 0x037a }, { 0xfe5e, 0x309b }, { 0xfe5f, 0x309c }, { 0xfe63, '/' }, { 0xfe64, 0x02bc }, { 0xfe65, 0x02bd }, { 0xfe66, 0x02f5 }, { 0xfe67, 0x02f3 }, { 0xfe68, 0x02cd }, { 0xfe69, 0xa788 }, { 0xfe6a, 0x02f7 }, { 0xfe6e, ',' }, { 0xfe6f, 0x00a4 }, { 0xfe80, 'a' }, // XK_dead_a { 0xfe81, 'A' }, // XK_dead_A { 0xfe82, 'e' }, // XK_dead_e { 0xfe83, 'E' }, // XK_dead_E { 0xfe84, 'i' }, // XK_dead_i { 0xfe85, 'I' }, // XK_dead_I { 0xfe86, 'o' }, // XK_dead_o { 0xfe87, 'O' }, // XK_dead_O { 0xfe88, 'u' }, // XK_dead_u { 0xfe89, 'U' }, // XK_dead_U { 0xfe8a, 0x0259 }, { 0xfe8b, 0x018f }, { 0xfe8c, 0x00b5 }, { 0xfe90, '_' }, { 0xfe91, 0x02c8 }, { 0xfe92, 0x02cc }, { 0xff80 /*XKB_KEY_KP_Space*/, ' ' }, { 0xff95 /*XKB_KEY_KP_7*/, 0x0037 }, { 0xff96 /*XKB_KEY_KP_4*/, 0x0034 }, { 0xff97 /*XKB_KEY_KP_8*/, 0x0038 }, { 0xff98 /*XKB_KEY_KP_6*/, 0x0036 }, { 0xff99 /*XKB_KEY_KP_2*/, 0x0032 }, { 0xff9a /*XKB_KEY_KP_9*/, 0x0039 }, { 0xff9b /*XKB_KEY_KP_3*/, 0x0033 }, { 0xff9c /*XKB_KEY_KP_1*/, 0x0031 }, { 0xff9d /*XKB_KEY_KP_5*/, 0x0035 }, { 0xff9e /*XKB_KEY_KP_0*/, 0x0030 }, { 0xffaa /*XKB_KEY_KP_Multiply*/, '*' }, { 0xffab /*XKB_KEY_KP_Add*/, '+' }, { 0xffac /*XKB_KEY_KP_Separator*/, ',' }, { 0xffad /*XKB_KEY_KP_Subtract*/, '-' }, { 0xffae /*XKB_KEY_KP_Decimal*/, '.' }, { 0xffaf /*XKB_KEY_KP_Divide*/, '/' }, { 0xffb0 /*XKB_KEY_KP_0*/, 0x0030 }, { 0xffb1 /*XKB_KEY_KP_1*/, 0x0031 }, { 0xffb2 /*XKB_KEY_KP_2*/, 0x0032 }, { 0xffb3 /*XKB_KEY_KP_3*/, 0x0033 }, { 0xffb4 /*XKB_KEY_KP_4*/, 0x0034 }, { 0xffb5 /*XKB_KEY_KP_5*/, 0x0035 }, { 0xffb6 /*XKB_KEY_KP_6*/, 0x0036 }, { 0xffb7 /*XKB_KEY_KP_7*/, 0x0037 }, { 0xffb8 /*XKB_KEY_KP_8*/, 0x0038 }, { 0xffb9 /*XKB_KEY_KP_9*/, 0x0039 }, { 0xffbd /*XKB_KEY_KP_Equal*/, '=' } }; ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Convert XKB KeySym to Unicode // long _glfwKeySym2Unicode(unsigned int keysym) { int min = 0; int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; int mid; // First check for Latin-1 characters (1:1 mapping) if ((keysym >= 0x0020 && keysym <= 0x007e) || (keysym >= 0x00a0 && keysym <= 0x00ff)) { return keysym; } // Also check for directly encoded 24-bit UCS characters if ((keysym & 0xff000000) == 0x01000000) return keysym & 0x00ffffff; // Binary search in table while (max >= min) { mid = (min + max) / 2; if (keysymtab[mid].keysym < keysym) min = mid + 1; else if (keysymtab[mid].keysym > keysym) max = mid - 1; else return keysymtab[mid].ucs; } // No matching Unicode value found return -1; } ================================================ FILE: thirdparty/glfw/src/xkb_unicode.h ================================================ //======================================================================== // GLFW 3.3 Linux - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== long _glfwKeySym2Unicode(unsigned int keysym); ================================================ FILE: thirdparty/glfw/tests/CMakeLists.txt ================================================ link_libraries(glfw) include_directories("${GLFW_SOURCE_DIR}/deps") if (MATH_LIBRARY) link_libraries("${MATH_LIBRARY}") endif() if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h" "${GLFW_SOURCE_DIR}/deps/glad_gl.c") set(GLAD_VULKAN "${GLFW_SOURCE_DIR}/deps/glad/vulkan.h" "${GLFW_SOURCE_DIR}/deps/glad_vulkan.c") set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" "${GLFW_SOURCE_DIR}/deps/getopt.c") set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" "${GLFW_SOURCE_DIR}/deps/tinycthread.c") if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.1.0") set(CMAKE_C_STANDARD 99) else() # Remove this fallback when removing support for CMake version less than 3.1 add_compile_options("$<$:-std=c99>" "$<$:-std=c99>" "$<$:-std=c99>") endif() add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL}) add_executable(events events.c ${GETOPT} ${GLAD_GL}) add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL}) add_executable(glfwinfo glfwinfo.c ${GETOPT} ${GLAD_GL} ${GLAD_VULKAN}) add_executable(iconify iconify.c ${GETOPT} ${GLAD_GL}) add_executable(monitors monitors.c ${GETOPT} ${GLAD_GL}) add_executable(reopen reopen.c ${GLAD_GL}) add_executable(cursor cursor.c ${GLAD_GL}) add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD} ${GLAD_GL}) add_executable(gamma WIN32 MACOSX_BUNDLE gamma.c ${GLAD_GL}) add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD_GL}) add_executable(inputlag WIN32 MACOSX_BUNDLE inputlag.c ${GETOPT} ${GLAD_GL}) add_executable(joysticks WIN32 MACOSX_BUNDLE joysticks.c ${GLAD_GL}) add_executable(opacity WIN32 MACOSX_BUNDLE opacity.c ${GLAD_GL}) add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GLAD_GL}) add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL}) add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL}) add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL}) add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN}) add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD_GL}) target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}") target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}") if (RT_LIBRARY) target_link_libraries(empty "${RT_LIBRARY}") target_link_libraries(threads "${RT_LIBRARY}") endif() set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks opacity tearing threads timeout title triangle-vulkan windows) set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen cursor) set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES FOLDER "GLFW3/Tests") if (MSVC) # Tell MSVC to use main instead of WinMain for Windows subsystem executables set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") endif() if (APPLE) set_target_properties(empty PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Empty Event") set_target_properties(gamma PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gamma") set_target_properties(inputlag PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Input Lag") set_target_properties(joysticks PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Joysticks") set_target_properties(opacity PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Opacity") set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing") set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads") set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout") set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title") set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows") set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") endif() ================================================ FILE: thirdparty/glfw/tests/clipboard.c ================================================ //======================================================================== // Clipboard test program // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This program is used to test the clipboard functionality. // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include "getopt.h" #if defined(__APPLE__) #define MODIFIER GLFW_MOD_SUPER #else #define MODIFIER GLFW_MOD_CONTROL #endif static void usage(void) { printf("Usage: clipboard [-h]\n"); } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; case GLFW_KEY_V: if (mods == MODIFIER) { const char* string; string = glfwGetClipboardString(NULL); if (string) printf("Clipboard contains \"%s\"\n", string); else printf("Clipboard does not contain a string\n"); } break; case GLFW_KEY_C: if (mods == MODIFIER) { const char* string = "Hello GLFW World!"; glfwSetClipboardString(NULL, string); printf("Setting clipboard to \"%s\"\n", string); } break; } } int main(int argc, char** argv) { int ch; GLFWwindow* window; while ((ch = getopt(argc, argv, "h")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); default: usage(); exit(EXIT_FAILURE); } } glfwSetErrorCallback(error_callback); if (!glfwInit()) { fprintf(stderr, "Failed to initialize GLFW\n"); exit(EXIT_FAILURE); } window = glfwCreateWindow(200, 200, "Clipboard Test", NULL, NULL); if (!window) { glfwTerminate(); fprintf(stderr, "Failed to open GLFW window\n"); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); glfwSetKeyCallback(window, key_callback); glClearColor(0.5f, 0.5f, 0.5f, 0); while (!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwWaitEvents(); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/cursor.c ================================================ //======================================================================== // Cursor & input mode tests // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test provides an interface to the cursor image and cursor mode // parts of the API. // // Custom cursor image generation by urraka. // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include #include #include #include "linmath.h" #define CURSOR_FRAME_COUNT 60 static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec2 vPos;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" "}\n"; static double cursor_x; static double cursor_y; static int swap_interval = 1; static int wait_events = GLFW_TRUE; static int animate_cursor = GLFW_FALSE; static int track_cursor = GLFW_FALSE; static GLFWcursor* standard_cursors[6]; static GLFWcursor* tracking_cursor = NULL; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static float star(int x, int y, float t) { const float c = 64 / 2.f; const float i = (0.25f * (float) sin(2.f * M_PI * t) + 0.75f); const float k = 64 * 0.046875f * i; const float dist = (float) sqrt((x - c) * (x - c) + (y - c) * (y - c)); const float salpha = 1.f - dist / c; const float xalpha = (float) x == c ? c : k / (float) fabs(x - c); const float yalpha = (float) y == c ? c : k / (float) fabs(y - c); return (float) fmax(0.f, fmin(1.f, i * salpha * 0.2f + salpha * xalpha * yalpha)); } static GLFWcursor* create_cursor_frame(float t) { int i = 0, x, y; unsigned char buffer[64 * 64 * 4]; const GLFWimage image = { 64, 64, buffer }; for (y = 0; y < image.width; y++) { for (x = 0; x < image.height; x++) { buffer[i++] = 255; buffer[i++] = 255; buffer[i++] = 255; buffer[i++] = (unsigned char) (255 * star(x, y, t)); } } return glfwCreateCursor(&image, image.width / 2, image.height / 2); } static GLFWcursor* create_tracking_cursor(void) { int i = 0, x, y; unsigned char buffer[32 * 32 * 4]; const GLFWimage image = { 32, 32, buffer }; for (y = 0; y < image.width; y++) { for (x = 0; x < image.height; x++) { if (x == 7 || y == 7) { buffer[i++] = 255; buffer[i++] = 0; buffer[i++] = 0; buffer[i++] = 255; } else { buffer[i++] = 0; buffer[i++] = 0; buffer[i++] = 0; buffer[i++] = 0; } } } return glfwCreateCursor(&image, 7, 7); } static void cursor_position_callback(GLFWwindow* window, double x, double y) { printf("%0.3f: Cursor position: %f %f (%+f %+f)\n", glfwGetTime(), x, y, x - cursor_x, y - cursor_y); cursor_x = x; cursor_y = y; } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_A: { animate_cursor = !animate_cursor; if (!animate_cursor) glfwSetCursor(window, NULL); break; } case GLFW_KEY_ESCAPE: { if (glfwGetInputMode(window, GLFW_CURSOR) != GLFW_CURSOR_DISABLED) { glfwSetWindowShouldClose(window, GLFW_TRUE); break; } /* FALLTHROUGH */ } case GLFW_KEY_N: glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); glfwGetCursorPos(window, &cursor_x, &cursor_y); printf("(( cursor is normal ))\n"); break; case GLFW_KEY_D: glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); printf("(( cursor is disabled ))\n"); break; case GLFW_KEY_H: glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); printf("(( cursor is hidden ))\n"); break; case GLFW_KEY_R: if (!glfwRawMouseMotionSupported()) break; if (glfwGetInputMode(window, GLFW_RAW_MOUSE_MOTION)) { glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE); printf("(( raw input is disabled ))\n"); } else { glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE); printf("(( raw input is enabled ))\n"); } break; case GLFW_KEY_SPACE: swap_interval = 1 - swap_interval; printf("(( swap interval: %i ))\n", swap_interval); glfwSwapInterval(swap_interval); break; case GLFW_KEY_W: wait_events = !wait_events; printf("(( %sing for events ))\n", wait_events ? "wait" : "poll"); break; case GLFW_KEY_T: track_cursor = !track_cursor; if (track_cursor) glfwSetCursor(window, tracking_cursor); else glfwSetCursor(window, NULL); break; case GLFW_KEY_P: { double x, y; glfwGetCursorPos(window, &x, &y); printf("Query before set: %f %f (%+f %+f)\n", x, y, x - cursor_x, y - cursor_y); cursor_x = x; cursor_y = y; glfwSetCursorPos(window, cursor_x, cursor_y); glfwGetCursorPos(window, &x, &y); printf("Query after set: %f %f (%+f %+f)\n", x, y, x - cursor_x, y - cursor_y); cursor_x = x; cursor_y = y; break; } case GLFW_KEY_UP: glfwSetCursorPos(window, 0, 0); glfwGetCursorPos(window, &cursor_x, &cursor_y); break; case GLFW_KEY_DOWN: { int width, height; glfwGetWindowSize(window, &width, &height); glfwSetCursorPos(window, width - 1, height - 1); glfwGetCursorPos(window, &cursor_x, &cursor_y); break; } case GLFW_KEY_0: glfwSetCursor(window, NULL); break; case GLFW_KEY_1: glfwSetCursor(window, standard_cursors[0]); break; case GLFW_KEY_2: glfwSetCursor(window, standard_cursors[1]); break; case GLFW_KEY_3: glfwSetCursor(window, standard_cursors[2]); break; case GLFW_KEY_4: glfwSetCursor(window, standard_cursors[3]); break; case GLFW_KEY_5: glfwSetCursor(window, standard_cursors[4]); break; case GLFW_KEY_6: glfwSetCursor(window, standard_cursors[5]); break; case GLFW_KEY_F11: case GLFW_KEY_ENTER: { static int x, y, width, height; if (mods != GLFW_MOD_ALT) return; if (glfwGetWindowMonitor(window)) glfwSetWindowMonitor(window, NULL, x, y, width, height, 0); else { GLFWmonitor* monitor = glfwGetPrimaryMonitor(); const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwGetWindowPos(window, &x, &y); glfwGetWindowSize(window, &width, &height); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); } glfwGetCursorPos(window, &cursor_x, &cursor_y); break; } } } int main(void) { int i; GLFWwindow* window; GLFWcursor* star_cursors[CURSOR_FRAME_COUNT]; GLFWcursor* current_frame = NULL; GLuint vertex_buffer, vertex_shader, fragment_shader, program; GLint mvp_location, vpos_location; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); tracking_cursor = create_tracking_cursor(); if (!tracking_cursor) { glfwTerminate(); exit(EXIT_FAILURE); } for (i = 0; i < CURSOR_FRAME_COUNT; i++) { star_cursors[i] = create_cursor_frame(i / (float) CURSOR_FRAME_COUNT); if (!star_cursors[i]) { glfwTerminate(); exit(EXIT_FAILURE); } } for (i = 0; i < sizeof(standard_cursors) / sizeof(standard_cursors[0]); i++) { const int shapes[] = { GLFW_ARROW_CURSOR, GLFW_IBEAM_CURSOR, GLFW_CROSSHAIR_CURSOR, GLFW_HAND_CURSOR, GLFW_HRESIZE_CURSOR, GLFW_VRESIZE_CURSOR }; standard_cursors[i] = glfwCreateStandardCursor(shapes[i]); if (!standard_cursors[i]) { glfwTerminate(); exit(EXIT_FAILURE); } } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); window = glfwCreateWindow(640, 480, "Cursor Test", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); vpos_location = glGetAttribLocation(program, "vPos"); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vec2), (void*) 0); glUseProgram(program); glfwGetCursorPos(window, &cursor_x, &cursor_y); printf("Cursor position: %f %f\n", cursor_x, cursor_y); glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetKeyCallback(window, key_callback); while (!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT); if (track_cursor) { int wnd_width, wnd_height, fb_width, fb_height; float scale; vec2 vertices[4]; mat4x4 mvp; glfwGetWindowSize(window, &wnd_width, &wnd_height); glfwGetFramebufferSize(window, &fb_width, &fb_height); glViewport(0, 0, fb_width, fb_height); scale = (float) fb_width / (float) wnd_width; vertices[0][0] = 0.5f; vertices[0][1] = (float) (fb_height - floor(cursor_y * scale) - 1.f + 0.5f); vertices[1][0] = (float) fb_width + 0.5f; vertices[1][1] = (float) (fb_height - floor(cursor_y * scale) - 1.f + 0.5f); vertices[2][0] = (float) floor(cursor_x * scale) + 0.5f; vertices[2][1] = 0.5f; vertices[3][0] = (float) floor(cursor_x * scale) + 0.5f; vertices[3][1] = (float) fb_height + 0.5f; glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); mat4x4_ortho(mvp, 0.f, (float) fb_width, 0.f, (float) fb_height, 0.f, 1.f); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glDrawArrays(GL_LINES, 0, 4); } glfwSwapBuffers(window); if (animate_cursor) { const int i = (int) (glfwGetTime() * 30.0) % CURSOR_FRAME_COUNT; if (current_frame != star_cursors[i]) { glfwSetCursor(window, star_cursors[i]); current_frame = star_cursors[i]; } } else current_frame = NULL; if (wait_events) { if (animate_cursor) glfwWaitEventsTimeout(1.0 / 30.0); else glfwWaitEvents(); } else glfwPollEvents(); // Workaround for an issue with msvcrt and mintty fflush(stdout); } glfwDestroyWindow(window); for (i = 0; i < CURSOR_FRAME_COUNT; i++) glfwDestroyCursor(star_cursors[i]); for (i = 0; i < sizeof(standard_cursors) / sizeof(standard_cursors[0]); i++) glfwDestroyCursor(standard_cursors[i]); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/empty.c ================================================ //======================================================================== // Empty event test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test is intended to verify that posting of empty events works // //======================================================================== #include "tinycthread.h" #include #define GLFW_INCLUDE_NONE #include #include #include #include static volatile int running = GLFW_TRUE; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static int thread_main(void* data) { struct timespec time; while (running) { clock_gettime(CLOCK_REALTIME, &time); time.tv_sec += 1; thrd_sleep(&time, NULL); glfwPostEmptyEvent(); } return 0; } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } static float nrand(void) { return (float) rand() / (float) RAND_MAX; } int main(void) { int result; thrd_t thread; GLFWwindow* window; srand((unsigned int) time(NULL)); glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); window = glfwCreateWindow(640, 480, "Empty Event Test", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSetKeyCallback(window, key_callback); if (thrd_create(&thread, thread_main, NULL) != thrd_success) { fprintf(stderr, "Failed to create secondary thread\n"); glfwTerminate(); exit(EXIT_FAILURE); } while (running) { int width, height; float r = nrand(), g = nrand(), b = nrand(); float l = (float) sqrt(r * r + g * g + b * b); glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); glClearColor(r / l, g / l, b / l, 1.f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwWaitEvents(); if (glfwWindowShouldClose(window)) running = GLFW_FALSE; } glfwHideWindow(window); thrd_join(thread, &result); glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/events.c ================================================ //======================================================================== // Event linter (event spewer) // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test hooks every available callback and outputs their arguments // // Log messages go to stdout, error messages to stderr // // Every event also gets a (sequential) number to aid discussion of logs // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include #include #include #include "getopt.h" // Event index static unsigned int counter = 0; typedef struct { GLFWwindow* window; int number; int closeable; } Slot; static void usage(void) { printf("Usage: events [-f] [-h] [-n WINDOWS]\n"); printf("Options:\n"); printf(" -f use full screen\n"); printf(" -h show this help\n"); printf(" -n the number of windows to create\n"); } static const char* get_key_name(int key) { switch (key) { // Printable keys case GLFW_KEY_A: return "A"; case GLFW_KEY_B: return "B"; case GLFW_KEY_C: return "C"; case GLFW_KEY_D: return "D"; case GLFW_KEY_E: return "E"; case GLFW_KEY_F: return "F"; case GLFW_KEY_G: return "G"; case GLFW_KEY_H: return "H"; case GLFW_KEY_I: return "I"; case GLFW_KEY_J: return "J"; case GLFW_KEY_K: return "K"; case GLFW_KEY_L: return "L"; case GLFW_KEY_M: return "M"; case GLFW_KEY_N: return "N"; case GLFW_KEY_O: return "O"; case GLFW_KEY_P: return "P"; case GLFW_KEY_Q: return "Q"; case GLFW_KEY_R: return "R"; case GLFW_KEY_S: return "S"; case GLFW_KEY_T: return "T"; case GLFW_KEY_U: return "U"; case GLFW_KEY_V: return "V"; case GLFW_KEY_W: return "W"; case GLFW_KEY_X: return "X"; case GLFW_KEY_Y: return "Y"; case GLFW_KEY_Z: return "Z"; case GLFW_KEY_1: return "1"; case GLFW_KEY_2: return "2"; case GLFW_KEY_3: return "3"; case GLFW_KEY_4: return "4"; case GLFW_KEY_5: return "5"; case GLFW_KEY_6: return "6"; case GLFW_KEY_7: return "7"; case GLFW_KEY_8: return "8"; case GLFW_KEY_9: return "9"; case GLFW_KEY_0: return "0"; case GLFW_KEY_SPACE: return "SPACE"; case GLFW_KEY_MINUS: return "MINUS"; case GLFW_KEY_EQUAL: return "EQUAL"; case GLFW_KEY_LEFT_BRACKET: return "LEFT BRACKET"; case GLFW_KEY_RIGHT_BRACKET: return "RIGHT BRACKET"; case GLFW_KEY_BACKSLASH: return "BACKSLASH"; case GLFW_KEY_SEMICOLON: return "SEMICOLON"; case GLFW_KEY_APOSTROPHE: return "APOSTROPHE"; case GLFW_KEY_GRAVE_ACCENT: return "GRAVE ACCENT"; case GLFW_KEY_COMMA: return "COMMA"; case GLFW_KEY_PERIOD: return "PERIOD"; case GLFW_KEY_SLASH: return "SLASH"; case GLFW_KEY_WORLD_1: return "WORLD 1"; case GLFW_KEY_WORLD_2: return "WORLD 2"; // Function keys case GLFW_KEY_ESCAPE: return "ESCAPE"; case GLFW_KEY_F1: return "F1"; case GLFW_KEY_F2: return "F2"; case GLFW_KEY_F3: return "F3"; case GLFW_KEY_F4: return "F4"; case GLFW_KEY_F5: return "F5"; case GLFW_KEY_F6: return "F6"; case GLFW_KEY_F7: return "F7"; case GLFW_KEY_F8: return "F8"; case GLFW_KEY_F9: return "F9"; case GLFW_KEY_F10: return "F10"; case GLFW_KEY_F11: return "F11"; case GLFW_KEY_F12: return "F12"; case GLFW_KEY_F13: return "F13"; case GLFW_KEY_F14: return "F14"; case GLFW_KEY_F15: return "F15"; case GLFW_KEY_F16: return "F16"; case GLFW_KEY_F17: return "F17"; case GLFW_KEY_F18: return "F18"; case GLFW_KEY_F19: return "F19"; case GLFW_KEY_F20: return "F20"; case GLFW_KEY_F21: return "F21"; case GLFW_KEY_F22: return "F22"; case GLFW_KEY_F23: return "F23"; case GLFW_KEY_F24: return "F24"; case GLFW_KEY_F25: return "F25"; case GLFW_KEY_UP: return "UP"; case GLFW_KEY_DOWN: return "DOWN"; case GLFW_KEY_LEFT: return "LEFT"; case GLFW_KEY_RIGHT: return "RIGHT"; case GLFW_KEY_LEFT_SHIFT: return "LEFT SHIFT"; case GLFW_KEY_RIGHT_SHIFT: return "RIGHT SHIFT"; case GLFW_KEY_LEFT_CONTROL: return "LEFT CONTROL"; case GLFW_KEY_RIGHT_CONTROL: return "RIGHT CONTROL"; case GLFW_KEY_LEFT_ALT: return "LEFT ALT"; case GLFW_KEY_RIGHT_ALT: return "RIGHT ALT"; case GLFW_KEY_TAB: return "TAB"; case GLFW_KEY_ENTER: return "ENTER"; case GLFW_KEY_BACKSPACE: return "BACKSPACE"; case GLFW_KEY_INSERT: return "INSERT"; case GLFW_KEY_DELETE: return "DELETE"; case GLFW_KEY_PAGE_UP: return "PAGE UP"; case GLFW_KEY_PAGE_DOWN: return "PAGE DOWN"; case GLFW_KEY_HOME: return "HOME"; case GLFW_KEY_END: return "END"; case GLFW_KEY_KP_0: return "KEYPAD 0"; case GLFW_KEY_KP_1: return "KEYPAD 1"; case GLFW_KEY_KP_2: return "KEYPAD 2"; case GLFW_KEY_KP_3: return "KEYPAD 3"; case GLFW_KEY_KP_4: return "KEYPAD 4"; case GLFW_KEY_KP_5: return "KEYPAD 5"; case GLFW_KEY_KP_6: return "KEYPAD 6"; case GLFW_KEY_KP_7: return "KEYPAD 7"; case GLFW_KEY_KP_8: return "KEYPAD 8"; case GLFW_KEY_KP_9: return "KEYPAD 9"; case GLFW_KEY_KP_DIVIDE: return "KEYPAD DIVIDE"; case GLFW_KEY_KP_MULTIPLY: return "KEYPAD MULTIPLY"; case GLFW_KEY_KP_SUBTRACT: return "KEYPAD SUBTRACT"; case GLFW_KEY_KP_ADD: return "KEYPAD ADD"; case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL"; case GLFW_KEY_KP_EQUAL: return "KEYPAD EQUAL"; case GLFW_KEY_KP_ENTER: return "KEYPAD ENTER"; case GLFW_KEY_PRINT_SCREEN: return "PRINT SCREEN"; case GLFW_KEY_NUM_LOCK: return "NUM LOCK"; case GLFW_KEY_CAPS_LOCK: return "CAPS LOCK"; case GLFW_KEY_SCROLL_LOCK: return "SCROLL LOCK"; case GLFW_KEY_PAUSE: return "PAUSE"; case GLFW_KEY_LEFT_SUPER: return "LEFT SUPER"; case GLFW_KEY_RIGHT_SUPER: return "RIGHT SUPER"; case GLFW_KEY_MENU: return "MENU"; default: return "UNKNOWN"; } } static const char* get_action_name(int action) { switch (action) { case GLFW_PRESS: return "pressed"; case GLFW_RELEASE: return "released"; case GLFW_REPEAT: return "repeated"; } return "caused unknown action"; } static const char* get_button_name(int button) { switch (button) { case GLFW_MOUSE_BUTTON_LEFT: return "left"; case GLFW_MOUSE_BUTTON_RIGHT: return "right"; case GLFW_MOUSE_BUTTON_MIDDLE: return "middle"; default: { static char name[16]; snprintf(name, sizeof(name), "%i", button); return name; } } } static const char* get_mods_name(int mods) { static char name[512]; if (mods == 0) return " no mods"; name[0] = '\0'; if (mods & GLFW_MOD_SHIFT) strcat(name, " shift"); if (mods & GLFW_MOD_CONTROL) strcat(name, " control"); if (mods & GLFW_MOD_ALT) strcat(name, " alt"); if (mods & GLFW_MOD_SUPER) strcat(name, " super"); if (mods & GLFW_MOD_CAPS_LOCK) strcat(name, " capslock-on"); if (mods & GLFW_MOD_NUM_LOCK) strcat(name, " numlock-on"); return name; } static size_t encode_utf8(char* s, unsigned int ch) { size_t count = 0; if (ch < 0x80) s[count++] = (char) ch; else if (ch < 0x800) { s[count++] = (ch >> 6) | 0xc0; s[count++] = (ch & 0x3f) | 0x80; } else if (ch < 0x10000) { s[count++] = (ch >> 12) | 0xe0; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } else if (ch < 0x110000) { s[count++] = (ch >> 18) | 0xf0; s[count++] = ((ch >> 12) & 0x3f) | 0x80; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } return count; } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void window_pos_callback(GLFWwindow* window, int x, int y) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window position: %i %i\n", counter++, slot->number, glfwGetTime(), x, y); } static void window_size_callback(GLFWwindow* window, int width, int height) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window size: %i %i\n", counter++, slot->number, glfwGetTime(), width, height); } static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Framebuffer size: %i %i\n", counter++, slot->number, glfwGetTime(), width, height); } static void window_content_scale_callback(GLFWwindow* window, float xscale, float yscale) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window content scale: %0.3f %0.3f\n", counter++, slot->number, glfwGetTime(), xscale, yscale); } static void window_close_callback(GLFWwindow* window) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window close\n", counter++, slot->number, glfwGetTime()); glfwSetWindowShouldClose(window, slot->closeable); } static void window_refresh_callback(GLFWwindow* window) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window refresh\n", counter++, slot->number, glfwGetTime()); glfwMakeContextCurrent(window); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); } static void window_focus_callback(GLFWwindow* window, int focused) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window %s\n", counter++, slot->number, glfwGetTime(), focused ? "focused" : "defocused"); } static void window_iconify_callback(GLFWwindow* window, int iconified) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window was %s\n", counter++, slot->number, glfwGetTime(), iconified ? "iconified" : "uniconified"); } static void window_maximize_callback(GLFWwindow* window, int maximized) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window was %s\n", counter++, slot->number, glfwGetTime(), maximized ? "maximized" : "unmaximized"); } static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Mouse button %i (%s) (with%s) was %s\n", counter++, slot->number, glfwGetTime(), button, get_button_name(button), get_mods_name(mods), get_action_name(action)); } static void cursor_position_callback(GLFWwindow* window, double x, double y) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Cursor position: %f %f\n", counter++, slot->number, glfwGetTime(), x, y); } static void cursor_enter_callback(GLFWwindow* window, int entered) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Cursor %s window\n", counter++, slot->number, glfwGetTime(), entered ? "entered" : "left"); } static void scroll_callback(GLFWwindow* window, double x, double y) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Scroll: %0.3f %0.3f\n", counter++, slot->number, glfwGetTime(), x, y); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { Slot* slot = glfwGetWindowUserPointer(window); const char* name = glfwGetKeyName(key, scancode); if (name) { printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s\n", counter++, slot->number, glfwGetTime(), key, scancode, get_key_name(key), name, get_mods_name(mods), get_action_name(action)); } else { printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n", counter++, slot->number, glfwGetTime(), key, scancode, get_key_name(key), get_mods_name(mods), get_action_name(action)); } if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_C: { slot->closeable = !slot->closeable; printf("(( closing %s ))\n", slot->closeable ? "enabled" : "disabled"); break; } case GLFW_KEY_L: { const int state = glfwGetInputMode(window, GLFW_LOCK_KEY_MODS); glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, !state); printf("(( lock key mods %s ))\n", !state ? "enabled" : "disabled"); break; } } } static void char_callback(GLFWwindow* window, unsigned int codepoint) { Slot* slot = glfwGetWindowUserPointer(window); char string[5] = ""; encode_utf8(string, codepoint); printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n", counter++, slot->number, glfwGetTime(), codepoint, string); } static void drop_callback(GLFWwindow* window, int count, const char* paths[]) { int i; Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Drop input\n", counter++, slot->number, glfwGetTime()); for (i = 0; i < count; i++) printf(" %i: \"%s\"\n", i, paths[i]); } static void monitor_callback(GLFWmonitor* monitor, int event) { if (event == GLFW_CONNECTED) { int x, y, widthMM, heightMM; const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwGetMonitorPos(monitor, &x, &y); glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM); printf("%08x at %0.3f: Monitor %s (%ix%i at %ix%i, %ix%i mm) was connected\n", counter++, glfwGetTime(), glfwGetMonitorName(monitor), mode->width, mode->height, x, y, widthMM, heightMM); } else if (event == GLFW_DISCONNECTED) { printf("%08x at %0.3f: Monitor %s was disconnected\n", counter++, glfwGetTime(), glfwGetMonitorName(monitor)); } } static void joystick_callback(int jid, int event) { if (event == GLFW_CONNECTED) { int axisCount, buttonCount, hatCount; glfwGetJoystickAxes(jid, &axisCount); glfwGetJoystickButtons(jid, &buttonCount); glfwGetJoystickHats(jid, &hatCount); printf("%08x at %0.3f: Joystick %i (%s) was connected with %i axes, %i buttons, and %i hats\n", counter++, glfwGetTime(), jid, glfwGetJoystickName(jid), axisCount, buttonCount, hatCount); } else { printf("%08x at %0.3f: Joystick %i was disconnected\n", counter++, glfwGetTime(), jid); } } int main(int argc, char** argv) { Slot* slots; GLFWmonitor* monitor = NULL; int ch, i, width, height, count = 1; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); printf("Library initialized\n"); glfwSetMonitorCallback(monitor_callback); glfwSetJoystickCallback(joystick_callback); while ((ch = getopt(argc, argv, "hfn:")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); case 'f': monitor = glfwGetPrimaryMonitor(); break; case 'n': count = (int) strtoul(optarg, NULL, 10); break; default: usage(); exit(EXIT_FAILURE); } } if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); width = mode->width; height = mode->height; } else { width = 640; height = 480; } slots = calloc(count, sizeof(Slot)); for (i = 0; i < count; i++) { char title[128]; slots[i].closeable = GLFW_TRUE; slots[i].number = i + 1; snprintf(title, sizeof(title), "Event Linter (Window %i)", slots[i].number); if (monitor) { printf("Creating full screen window %i (%ix%i on %s)\n", slots[i].number, width, height, glfwGetMonitorName(monitor)); } else { printf("Creating windowed mode window %i (%ix%i)\n", slots[i].number, width, height); } slots[i].window = glfwCreateWindow(width, height, title, monitor, NULL); if (!slots[i].window) { free(slots); glfwTerminate(); exit(EXIT_FAILURE); } glfwSetWindowUserPointer(slots[i].window, slots + i); glfwSetWindowPosCallback(slots[i].window, window_pos_callback); glfwSetWindowSizeCallback(slots[i].window, window_size_callback); glfwSetFramebufferSizeCallback(slots[i].window, framebuffer_size_callback); glfwSetWindowContentScaleCallback(slots[i].window, window_content_scale_callback); glfwSetWindowCloseCallback(slots[i].window, window_close_callback); glfwSetWindowRefreshCallback(slots[i].window, window_refresh_callback); glfwSetWindowFocusCallback(slots[i].window, window_focus_callback); glfwSetWindowIconifyCallback(slots[i].window, window_iconify_callback); glfwSetWindowMaximizeCallback(slots[i].window, window_maximize_callback); glfwSetMouseButtonCallback(slots[i].window, mouse_button_callback); glfwSetCursorPosCallback(slots[i].window, cursor_position_callback); glfwSetCursorEnterCallback(slots[i].window, cursor_enter_callback); glfwSetScrollCallback(slots[i].window, scroll_callback); glfwSetKeyCallback(slots[i].window, key_callback); glfwSetCharCallback(slots[i].window, char_callback); glfwSetDropCallback(slots[i].window, drop_callback); glfwMakeContextCurrent(slots[i].window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); } printf("Main loop starting\n"); for (;;) { for (i = 0; i < count; i++) { if (glfwWindowShouldClose(slots[i].window)) break; } if (i < count) break; glfwWaitEvents(); // Workaround for an issue with msvcrt and mintty fflush(stdout); } free(slots); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/gamma.c ================================================ //======================================================================== // Gamma correction test program // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This program is used to test the gamma correction functionality for // both full screen and windowed mode windows // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #define NK_IMPLEMENTATION #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT #define NK_INCLUDE_DEFAULT_ALLOCATOR #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_STANDARD_VARARGS #define NK_BUTTON_TRIGGER_ON_RELEASE #include #define NK_GLFW_GL2_IMPLEMENTATION #include #include #include #include static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE) glfwSetWindowShouldClose(window, GLFW_TRUE); } static void chart_ramp_array(struct nk_context* nk, struct nk_color color, int count, unsigned short int* values) { if (nk_chart_begin_colored(nk, NK_CHART_LINES, color, nk_rgb(255, 255, 255), count, 0, 65535)) { int i; for (i = 0; i < count; i++) { char buffer[1024]; if (nk_chart_push(nk, values[i])) { snprintf(buffer, sizeof(buffer), "#%u: %u (%0.5f) ", i, values[i], values[i] / 65535.f); nk_tooltip(nk, buffer); } } nk_chart_end(nk); } } int main(int argc, char** argv) { GLFWmonitor* monitor = NULL; GLFWwindow* window; GLFWgammaramp orig_ramp; struct nk_context* nk; struct nk_font_atlas* atlas; float gamma_value = 1.f; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); monitor = glfwGetPrimaryMonitor(); glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); window = glfwCreateWindow(800, 400, "Gamma Test", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } { const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor); const size_t array_size = ramp->size * sizeof(short); orig_ramp.size = ramp->size; orig_ramp.red = malloc(array_size); orig_ramp.green = malloc(array_size); orig_ramp.blue = malloc(array_size); memcpy(orig_ramp.red, ramp->red, array_size); memcpy(orig_ramp.green, ramp->green, array_size); memcpy(orig_ramp.blue, ramp->blue, array_size); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); nk_glfw3_font_stash_begin(&atlas); nk_glfw3_font_stash_end(); glfwSetKeyCallback(window, key_callback); while (!glfwWindowShouldClose(window)) { int width, height; struct nk_rect area; glfwGetWindowSize(window, &width, &height); area = nk_rect(0.f, 0.f, (float) width, (float) height); nk_window_set_bounds(nk, "", area); glClear(GL_COLOR_BUFFER_BIT); nk_glfw3_new_frame(); if (nk_begin(nk, "", area, 0)) { const GLFWgammaramp* ramp; nk_layout_row_dynamic(nk, 30, 3); if (nk_slider_float(nk, 0.1f, &gamma_value, 5.f, 0.1f)) glfwSetGamma(monitor, gamma_value); nk_labelf(nk, NK_TEXT_LEFT, "%0.1f", gamma_value); if (nk_button_label(nk, "Revert")) glfwSetGammaRamp(monitor, &orig_ramp); ramp = glfwGetGammaRamp(monitor); nk_layout_row_dynamic(nk, height - 60.f, 3); chart_ramp_array(nk, nk_rgb(255, 0, 0), ramp->size, ramp->red); chart_ramp_array(nk, nk_rgb(0, 255, 0), ramp->size, ramp->green); chart_ramp_array(nk, nk_rgb(0, 0, 255), ramp->size, ramp->blue); } nk_end(nk); nk_glfw3_render(NK_ANTI_ALIASING_ON); glfwSwapBuffers(window); glfwWaitEventsTimeout(1.0); } free(orig_ramp.red); free(orig_ramp.green); free(orig_ramp.blue); nk_glfw3_shutdown(); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/glfwinfo.c ================================================ //======================================================================== // Context creation and information tool // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define GLFW_INCLUDE_NONE #include #include #include #include #include "getopt.h" #ifdef _MSC_VER #define strcasecmp(x, y) _stricmp(x, y) #endif #define API_NAME_OPENGL "gl" #define API_NAME_OPENGL_ES "es" #define API_NAME_NATIVE "native" #define API_NAME_EGL "egl" #define API_NAME_OSMESA "osmesa" #define PROFILE_NAME_CORE "core" #define PROFILE_NAME_COMPAT "compat" #define STRATEGY_NAME_NONE "none" #define STRATEGY_NAME_LOSE "lose" #define BEHAVIOR_NAME_NONE "none" #define BEHAVIOR_NAME_FLUSH "flush" static void usage(void) { printf("Usage: glfwinfo [OPTION]...\n"); printf("Options:\n"); printf(" -a, --client-api=API the client API to use (" API_NAME_OPENGL " or " API_NAME_OPENGL_ES ")\n"); printf(" -b, --behavior=BEHAVIOR the release behavior to use (" BEHAVIOR_NAME_NONE " or " BEHAVIOR_NAME_FLUSH ")\n"); printf(" -c, --context-api=API the context creation API to use (" API_NAME_NATIVE " or " API_NAME_EGL " or " API_NAME_OSMESA ")\n"); printf(" -d, --debug request a debug context\n"); printf(" -f, --forward require a forward-compatible context\n"); printf(" -h, --help show this help\n"); printf(" -l, --list-extensions list all Vulkan and client API extensions\n"); printf(" --list-layers list all Vulkan layers\n"); printf(" -m, --major=MAJOR the major number of the required " "client API version\n"); printf(" -n, --minor=MINOR the minor number of the required " "client API version\n"); printf(" -p, --profile=PROFILE the OpenGL profile to use (" PROFILE_NAME_CORE " or " PROFILE_NAME_COMPAT ")\n"); printf(" -s, --robustness=STRATEGY the robustness strategy to use (" STRATEGY_NAME_NONE " or " STRATEGY_NAME_LOSE ")\n"); printf(" -v, --version print version information\n"); printf(" --red-bits=N the number of red bits to request\n"); printf(" --green-bits=N the number of green bits to request\n"); printf(" --blue-bits=N the number of blue bits to request\n"); printf(" --alpha-bits=N the number of alpha bits to request\n"); printf(" --depth-bits=N the number of depth bits to request\n"); printf(" --stencil-bits=N the number of stencil bits to request\n"); printf(" --accum-red-bits=N the number of red bits to request\n"); printf(" --accum-green-bits=N the number of green bits to request\n"); printf(" --accum-blue-bits=N the number of blue bits to request\n"); printf(" --accum-alpha-bits=N the number of alpha bits to request\n"); printf(" --aux-buffers=N the number of aux buffers to request\n"); printf(" --samples=N the number of MSAA samples to request\n"); printf(" --stereo request stereo rendering\n"); printf(" --srgb request an sRGB capable framebuffer\n"); printf(" --singlebuffer request single-buffering\n"); printf(" --no-error request a context that does not emit errors\n"); printf(" --graphics-switching request macOS graphics switching\n"); } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static const char* get_device_type_name(VkPhysicalDeviceType type) { if (type == VK_PHYSICAL_DEVICE_TYPE_OTHER) return "other"; else if (type == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) return "integrated GPU"; else if (type == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) return "discrete GPU"; else if (type == VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU) return "virtual GPU"; else if (type == VK_PHYSICAL_DEVICE_TYPE_CPU) return "CPU"; return "unknown"; } static const char* get_api_name(int api) { if (api == GLFW_OPENGL_API) return "OpenGL"; else if (api == GLFW_OPENGL_ES_API) return "OpenGL ES"; return "Unknown API"; } static const char* get_profile_name_gl(GLint mask) { if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) return PROFILE_NAME_COMPAT; if (mask & GL_CONTEXT_CORE_PROFILE_BIT) return PROFILE_NAME_CORE; return "unknown"; } static const char* get_profile_name_glfw(int profile) { if (profile == GLFW_OPENGL_COMPAT_PROFILE) return PROFILE_NAME_COMPAT; if (profile == GLFW_OPENGL_CORE_PROFILE) return PROFILE_NAME_CORE; return "unknown"; } static const char* get_strategy_name_gl(GLint strategy) { if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB) return STRATEGY_NAME_LOSE; if (strategy == GL_NO_RESET_NOTIFICATION_ARB) return STRATEGY_NAME_NONE; return "unknown"; } static const char* get_strategy_name_glfw(int strategy) { if (strategy == GLFW_LOSE_CONTEXT_ON_RESET) return STRATEGY_NAME_LOSE; if (strategy == GLFW_NO_RESET_NOTIFICATION) return STRATEGY_NAME_NONE; return "unknown"; } static void list_context_extensions(int client, int major, int minor) { int i; GLint count; const GLubyte* extensions; printf("%s context extensions:\n", get_api_name(client)); if (client == GLFW_OPENGL_API && major > 2) { glGetIntegerv(GL_NUM_EXTENSIONS, &count); for (i = 0; i < count; i++) printf(" %s\n", (const char*) glGetStringi(GL_EXTENSIONS, i)); } else { extensions = glGetString(GL_EXTENSIONS); while (*extensions != '\0') { putchar(' '); while (*extensions != '\0' && *extensions != ' ') { putchar(*extensions); extensions++; } while (*extensions == ' ') extensions++; putchar('\n'); } } } static void list_vulkan_instance_extensions(void) { uint32_t i, ep_count = 0; VkExtensionProperties* ep; printf("Vulkan instance extensions:\n"); if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL) != VK_SUCCESS) return; ep = calloc(ep_count, sizeof(VkExtensionProperties)); if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep) != VK_SUCCESS) { free(ep); return; } for (i = 0; i < ep_count; i++) printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion); free(ep); } static void list_vulkan_instance_layers(void) { uint32_t i, lp_count = 0; VkLayerProperties* lp; printf("Vulkan instance layers:\n"); if (vkEnumerateInstanceLayerProperties(&lp_count, NULL) != VK_SUCCESS) return; lp = calloc(lp_count, sizeof(VkLayerProperties)); if (vkEnumerateInstanceLayerProperties(&lp_count, lp) != VK_SUCCESS) { free(lp); return; } for (i = 0; i < lp_count; i++) { printf(" %s (v%u) \"%s\"\n", lp[i].layerName, lp[i].specVersion >> 22, lp[i].description); } free(lp); } static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice device) { uint32_t i, ep_count; VkExtensionProperties* ep; printf("Vulkan device extensions:\n"); if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, NULL) != VK_SUCCESS) return; ep = calloc(ep_count, sizeof(VkExtensionProperties)); if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, ep) != VK_SUCCESS) { free(ep); return; } for (i = 0; i < ep_count; i++) printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion); free(ep); } static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device) { uint32_t i, lp_count; VkLayerProperties* lp; printf("Vulkan device layers:\n"); if (vkEnumerateDeviceLayerProperties(device, &lp_count, NULL) != VK_SUCCESS) return; lp = calloc(lp_count, sizeof(VkLayerProperties)); if (vkEnumerateDeviceLayerProperties(device, &lp_count, lp) != VK_SUCCESS) { free(lp); return; } for (i = 0; i < lp_count; i++) { printf(" %s (v%u) \"%s\"\n", lp[i].layerName, lp[i].specVersion >> 22, lp[i].description); } free(lp); } static int valid_version(void) { int major, minor, revision; glfwGetVersion(&major, &minor, &revision); if (major != GLFW_VERSION_MAJOR) { printf("*** ERROR: GLFW major version mismatch! ***\n"); return GLFW_FALSE; } if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION) printf("*** WARNING: GLFW version mismatch! ***\n"); return GLFW_TRUE; } static void print_version(void) { int major, minor, revision; glfwGetVersion(&major, &minor, &revision); printf("GLFW header version: %u.%u.%u\n", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION); printf("GLFW library version: %u.%u.%u\n", major, minor, revision); printf("GLFW library version string: \"%s\"\n", glfwGetVersionString()); } static GLADapiproc glad_vulkan_callback(const char* name, void* user) { return glfwGetInstanceProcAddress((VkInstance) user, name); } int main(int argc, char** argv) { int ch, client, major, minor, revision, profile; GLint redbits, greenbits, bluebits, alphabits, depthbits, stencilbits; int list_extensions = GLFW_FALSE, list_layers = GLFW_FALSE; GLenum error; GLFWwindow* window; enum { CLIENT, CONTEXT, BEHAVIOR, DEBUG_CONTEXT, FORWARD, HELP, EXTENSIONS, LAYERS, MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION, REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS, ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS, AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY, GRAPHICS_SWITCHING }; const struct option options[] = { { "behavior", 1, NULL, BEHAVIOR }, { "client-api", 1, NULL, CLIENT }, { "context-api", 1, NULL, CONTEXT }, { "debug", 0, NULL, DEBUG_CONTEXT }, { "forward", 0, NULL, FORWARD }, { "help", 0, NULL, HELP }, { "list-extensions", 0, NULL, EXTENSIONS }, { "list-layers", 0, NULL, LAYERS }, { "major", 1, NULL, MAJOR }, { "minor", 1, NULL, MINOR }, { "profile", 1, NULL, PROFILE }, { "robustness", 1, NULL, ROBUSTNESS }, { "version", 0, NULL, VERSION }, { "red-bits", 1, NULL, REDBITS }, { "green-bits", 1, NULL, GREENBITS }, { "blue-bits", 1, NULL, BLUEBITS }, { "alpha-bits", 1, NULL, ALPHABITS }, { "depth-bits", 1, NULL, DEPTHBITS }, { "stencil-bits", 1, NULL, STENCILBITS }, { "accum-red-bits", 1, NULL, ACCUMREDBITS }, { "accum-green-bits", 1, NULL, ACCUMGREENBITS }, { "accum-blue-bits", 1, NULL, ACCUMBLUEBITS }, { "accum-alpha-bits", 1, NULL, ACCUMALPHABITS }, { "aux-buffers", 1, NULL, AUXBUFFERS }, { "samples", 1, NULL, SAMPLES }, { "stereo", 0, NULL, STEREO }, { "srgb", 0, NULL, SRGB }, { "singlebuffer", 0, NULL, SINGLEBUFFER }, { "no-error", 0, NULL, NOERROR_SRSLY }, { "graphics-switching", 0, NULL, GRAPHICS_SWITCHING }, { NULL, 0, NULL, 0 } }; // Initialize GLFW and create window if (!valid_version()) exit(EXIT_FAILURE); glfwSetErrorCallback(error_callback); glfwInitHint(GLFW_COCOA_MENUBAR, GLFW_FALSE); if (!glfwInit()) exit(EXIT_FAILURE); while ((ch = getopt_long(argc, argv, "a:b:c:dfhlm:n:p:s:v", options, NULL)) != -1) { switch (ch) { case 'a': case CLIENT: if (strcasecmp(optarg, API_NAME_OPENGL) == 0) glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); else if (strcasecmp(optarg, API_NAME_OPENGL_ES) == 0) glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); else { usage(); exit(EXIT_FAILURE); } break; case 'b': case BEHAVIOR: if (strcasecmp(optarg, BEHAVIOR_NAME_NONE) == 0) { glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_NONE); } else if (strcasecmp(optarg, BEHAVIOR_NAME_FLUSH) == 0) { glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_FLUSH); } else { usage(); exit(EXIT_FAILURE); } break; case 'c': case CONTEXT: if (strcasecmp(optarg, API_NAME_NATIVE) == 0) glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API); else if (strcasecmp(optarg, API_NAME_EGL) == 0) glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); else if (strcasecmp(optarg, API_NAME_OSMESA) == 0) glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_OSMESA_CONTEXT_API); else { usage(); exit(EXIT_FAILURE); } break; case 'd': case DEBUG_CONTEXT: glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); break; case 'f': case FORWARD: glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); break; case 'h': case HELP: usage(); exit(EXIT_SUCCESS); case 'l': case EXTENSIONS: list_extensions = GLFW_TRUE; break; case LAYERS: list_layers = GLFW_TRUE; break; case 'm': case MAJOR: glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, atoi(optarg)); break; case 'n': case MINOR: glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, atoi(optarg)); break; case 'p': case PROFILE: if (strcasecmp(optarg, PROFILE_NAME_CORE) == 0) { glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); } else if (strcasecmp(optarg, PROFILE_NAME_COMPAT) == 0) { glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE); } else { usage(); exit(EXIT_FAILURE); } break; case 's': case ROBUSTNESS: if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0) { glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, GLFW_NO_RESET_NOTIFICATION); } else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0) { glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, GLFW_LOSE_CONTEXT_ON_RESET); } else { usage(); exit(EXIT_FAILURE); } break; case 'v': case VERSION: print_version(); exit(EXIT_SUCCESS); case REDBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_RED_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_RED_BITS, atoi(optarg)); break; case GREENBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_GREEN_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_GREEN_BITS, atoi(optarg)); break; case BLUEBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_BLUE_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_BLUE_BITS, atoi(optarg)); break; case ALPHABITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_ALPHA_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_ALPHA_BITS, atoi(optarg)); break; case DEPTHBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_DEPTH_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_DEPTH_BITS, atoi(optarg)); break; case STENCILBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_STENCIL_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_STENCIL_BITS, atoi(optarg)); break; case ACCUMREDBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_ACCUM_RED_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_ACCUM_RED_BITS, atoi(optarg)); break; case ACCUMGREENBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_ACCUM_GREEN_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_ACCUM_GREEN_BITS, atoi(optarg)); break; case ACCUMBLUEBITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_ACCUM_BLUE_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_ACCUM_BLUE_BITS, atoi(optarg)); break; case ACCUMALPHABITS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, atoi(optarg)); break; case AUXBUFFERS: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_AUX_BUFFERS, GLFW_DONT_CARE); else glfwWindowHint(GLFW_AUX_BUFFERS, atoi(optarg)); break; case SAMPLES: if (strcmp(optarg, "-") == 0) glfwWindowHint(GLFW_SAMPLES, GLFW_DONT_CARE); else glfwWindowHint(GLFW_SAMPLES, atoi(optarg)); break; case STEREO: glfwWindowHint(GLFW_STEREO, GLFW_TRUE); break; case SRGB: glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE); break; case SINGLEBUFFER: glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_FALSE); break; case NOERROR_SRSLY: glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE); break; case GRAPHICS_SWITCHING: glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_TRUE); break; default: usage(); exit(EXIT_FAILURE); } } print_version(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); window = glfwCreateWindow(200, 200, "Version", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); error = glGetError(); if (error != GL_NO_ERROR) printf("*** OpenGL error after make current: 0x%08x ***\n", error); // Report client API version client = glfwGetWindowAttrib(window, GLFW_CLIENT_API); major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR); minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR); revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION); profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE); printf("%s context version string: \"%s\"\n", get_api_name(client), glGetString(GL_VERSION)); printf("%s context version parsed by GLFW: %u.%u.%u\n", get_api_name(client), major, minor, revision); // Report client API context properties if (client == GLFW_OPENGL_API) { if (major >= 3) { GLint flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags); printf("%s context flags (0x%08x):", get_api_name(client), flags); if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) printf(" forward-compatible"); if (flags & 2/*GL_CONTEXT_FLAG_DEBUG_BIT*/) printf(" debug"); if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB) printf(" robustness"); if (flags & 8/*GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR*/) printf(" no-error"); putchar('\n'); printf("%s context flags parsed by GLFW:", get_api_name(client)); if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT)) printf(" forward-compatible"); if (glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT)) printf(" debug"); if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) == GLFW_LOSE_CONTEXT_ON_RESET) printf(" robustness"); if (glfwGetWindowAttrib(window, GLFW_CONTEXT_NO_ERROR)) printf(" no-error"); putchar('\n'); } if (major >= 4 || (major == 3 && minor >= 2)) { GLint mask; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); printf("%s profile mask (0x%08x): %s\n", get_api_name(client), mask, get_profile_name_gl(mask)); printf("%s profile mask parsed by GLFW: %s\n", get_api_name(client), get_profile_name_glfw(profile)); } if (GLAD_GL_ARB_robustness) { const int robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS); GLint strategy; glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy); printf("%s robustness strategy (0x%08x): %s\n", get_api_name(client), strategy, get_strategy_name_gl(strategy)); printf("%s robustness strategy parsed by GLFW: %s\n", get_api_name(client), get_strategy_name_glfw(robustness)); } } printf("%s context renderer string: \"%s\"\n", get_api_name(client), glGetString(GL_RENDERER)); printf("%s context vendor string: \"%s\"\n", get_api_name(client), glGetString(GL_VENDOR)); if (major >= 2) { printf("%s context shading language version: \"%s\"\n", get_api_name(client), glGetString(GL_SHADING_LANGUAGE_VERSION)); } printf("%s framebuffer:\n", get_api_name(client)); if (client == GLFW_OPENGL_API && profile == GLFW_OPENGL_CORE_PROFILE) { glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &redbits); glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, &greenbits); glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, &bluebits); glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alphabits); glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, &depthbits); glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &stencilbits); } else { glGetIntegerv(GL_RED_BITS, &redbits); glGetIntegerv(GL_GREEN_BITS, &greenbits); glGetIntegerv(GL_BLUE_BITS, &bluebits); glGetIntegerv(GL_ALPHA_BITS, &alphabits); glGetIntegerv(GL_DEPTH_BITS, &depthbits); glGetIntegerv(GL_STENCIL_BITS, &stencilbits); } printf(" red: %u green: %u blue: %u alpha: %u depth: %u stencil: %u\n", redbits, greenbits, bluebits, alphabits, depthbits, stencilbits); if (client == GLFW_OPENGL_ES_API || GLAD_GL_ARB_multisample || major > 1 || minor >= 3) { GLint samples, samplebuffers; glGetIntegerv(GL_SAMPLES, &samples); glGetIntegerv(GL_SAMPLE_BUFFERS, &samplebuffers); printf(" samples: %u sample buffers: %u\n", samples, samplebuffers); } if (client == GLFW_OPENGL_API && profile != GLFW_OPENGL_CORE_PROFILE) { GLint accumredbits, accumgreenbits, accumbluebits, accumalphabits; GLint auxbuffers; glGetIntegerv(GL_ACCUM_RED_BITS, &accumredbits); glGetIntegerv(GL_ACCUM_GREEN_BITS, &accumgreenbits); glGetIntegerv(GL_ACCUM_BLUE_BITS, &accumbluebits); glGetIntegerv(GL_ACCUM_ALPHA_BITS, &accumalphabits); glGetIntegerv(GL_AUX_BUFFERS, &auxbuffers); printf(" accum red: %u accum green: %u accum blue: %u accum alpha: %u aux buffers: %u\n", accumredbits, accumgreenbits, accumbluebits, accumalphabits, auxbuffers); } if (list_extensions) list_context_extensions(client, major, minor); printf("Vulkan loader: %s\n", glfwVulkanSupported() ? "available" : "missing"); if (glfwVulkanSupported()) { uint32_t loader_version = VK_API_VERSION_1_0; uint32_t i, re_count, pd_count; const char** re; VkApplicationInfo ai = {0}; VkInstanceCreateInfo ici = {0}; VkInstance instance; VkPhysicalDevice* pd; gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL); if (vkEnumerateInstanceVersion) { uint32_t version; if (vkEnumerateInstanceVersion(&version) == VK_SUCCESS) loader_version = version; } printf("Vulkan loader API version: %i.%i\n", VK_VERSION_MAJOR(loader_version), VK_VERSION_MINOR(loader_version)); re = glfwGetRequiredInstanceExtensions(&re_count); printf("Vulkan required instance extensions:"); if (re) { for (i = 0; i < re_count; i++) printf(" %s", re[i]); putchar('\n'); } else printf(" missing\n"); if (list_extensions) list_vulkan_instance_extensions(); if (list_layers) list_vulkan_instance_layers(); ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; ai.pApplicationName = "glfwinfo"; ai.applicationVersion = VK_MAKE_VERSION(GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION); if (loader_version >= VK_API_VERSION_1_1) ai.apiVersion = VK_API_VERSION_1_1; else ai.apiVersion = VK_API_VERSION_1_0; ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; ici.pApplicationInfo = &ai; ici.enabledExtensionCount = re_count; ici.ppEnabledExtensionNames = re; if (vkCreateInstance(&ici, NULL, &instance) != VK_SUCCESS) { glfwTerminate(); exit(EXIT_FAILURE); } gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance); if (vkEnumeratePhysicalDevices(instance, &pd_count, NULL) != VK_SUCCESS) { vkDestroyInstance(instance, NULL); glfwTerminate(); exit(EXIT_FAILURE); } pd = calloc(pd_count, sizeof(VkPhysicalDevice)); if (vkEnumeratePhysicalDevices(instance, &pd_count, pd) != VK_SUCCESS) { free(pd); vkDestroyInstance(instance, NULL); glfwTerminate(); exit(EXIT_FAILURE); } for (i = 0; i < pd_count; i++) { VkPhysicalDeviceProperties pdp; vkGetPhysicalDeviceProperties(pd[i], &pdp); printf("Vulkan %s device: \"%s\" API version %i.%i\n", get_device_type_name(pdp.deviceType), pdp.deviceName, VK_VERSION_MAJOR(pdp.apiVersion), VK_VERSION_MINOR(pdp.apiVersion)); if (list_extensions) list_vulkan_device_extensions(instance, pd[i]); if (list_layers) list_vulkan_device_layers(instance, pd[i]); } free(pd); vkDestroyInstance(instance, NULL); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/icon.c ================================================ //======================================================================== // Window icon test program // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This program is used to test the icon feature. // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include // a simple glfw logo const char* const logo[] = { "................", "................", "...0000..0......", "...0.....0......", "...0.00..0......", "...0..0..0......", "...0000..0000...", "................", "................", "...000..0...0...", "...0....0...0...", "...000..0.0.0...", "...0....0.0.0...", "...0....00000...", "................", "................" }; const unsigned char icon_colors[5][4] = { { 0, 0, 0, 255 }, // black { 255, 0, 0, 255 }, // red { 0, 255, 0, 255 }, // green { 0, 0, 255, 255 }, // blue { 255, 255, 255, 255 } // white }; static int cur_icon_color = 0; static void set_icon(GLFWwindow* window, int icon_color) { int x, y; unsigned char pixels[16 * 16 * 4]; unsigned char* target = pixels; GLFWimage img = { 16, 16, pixels }; for (y = 0; y < img.width; y++) { for (x = 0; x < img.height; x++) { if (logo[y][x] == '0') memcpy(target, icon_colors[icon_color], 4); else memset(target, 0, 4); target += 4; } } glfwSetWindowIcon(window, 1, &img); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; case GLFW_KEY_SPACE: cur_icon_color = (cur_icon_color + 1) % 5; set_icon(window, cur_icon_color); break; case GLFW_KEY_X: glfwSetWindowIcon(window, 0, NULL); break; } } int main(int argc, char** argv) { GLFWwindow* window; if (!glfwInit()) { fprintf(stderr, "Failed to initialize GLFW\n"); exit(EXIT_FAILURE); } window = glfwCreateWindow(200, 200, "Window Icon", NULL, NULL); if (!window) { glfwTerminate(); fprintf(stderr, "Failed to open GLFW window\n"); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSetKeyCallback(window, key_callback); set_icon(window, cur_icon_color); while (!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwWaitEvents(); } glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/iconify.c ================================================ //======================================================================== // Iconify/restore test program // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This program is used to test the iconify/restore functionality for // both full screen and windowed mode windows // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include "getopt.h" static int windowed_xpos, windowed_ypos, windowed_width, windowed_height; static void usage(void) { printf("Usage: iconify [-h] [-f [-a] [-n]]\n"); printf("Options:\n"); printf(" -a create windows for all monitors\n"); printf(" -f create full screen window(s)\n"); printf(" -h show this help\n"); } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { printf("%0.2f Key %s\n", glfwGetTime(), action == GLFW_PRESS ? "pressed" : "released"); if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_I: glfwIconifyWindow(window); break; case GLFW_KEY_M: glfwMaximizeWindow(window); break; case GLFW_KEY_R: glfwRestoreWindow(window); break; case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; case GLFW_KEY_A: glfwSetWindowAttrib(window, GLFW_AUTO_ICONIFY, !glfwGetWindowAttrib(window, GLFW_AUTO_ICONIFY)); break; case GLFW_KEY_B: glfwSetWindowAttrib(window, GLFW_RESIZABLE, !glfwGetWindowAttrib(window, GLFW_RESIZABLE)); break; case GLFW_KEY_D: glfwSetWindowAttrib(window, GLFW_DECORATED, !glfwGetWindowAttrib(window, GLFW_DECORATED)); break; case GLFW_KEY_F: glfwSetWindowAttrib(window, GLFW_FLOATING, !glfwGetWindowAttrib(window, GLFW_FLOATING)); break; case GLFW_KEY_F11: case GLFW_KEY_ENTER: { if (mods != GLFW_MOD_ALT) return; if (glfwGetWindowMonitor(window)) { glfwSetWindowMonitor(window, NULL, windowed_xpos, windowed_ypos, windowed_width, windowed_height, 0); } else { GLFWmonitor* monitor = glfwGetPrimaryMonitor(); if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwGetWindowPos(window, &windowed_xpos, &windowed_ypos); glfwGetWindowSize(window, &windowed_width, &windowed_height); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); } } break; } } } static void window_size_callback(GLFWwindow* window, int width, int height) { printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height); } static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { printf("%0.2f Framebuffer resized to %ix%i\n", glfwGetTime(), width, height); } static void window_focus_callback(GLFWwindow* window, int focused) { printf("%0.2f Window %s\n", glfwGetTime(), focused ? "focused" : "defocused"); } static void window_iconify_callback(GLFWwindow* window, int iconified) { printf("%0.2f Window %s\n", glfwGetTime(), iconified ? "iconified" : "uniconified"); } static void window_maximize_callback(GLFWwindow* window, int maximized) { printf("%0.2f Window %s\n", glfwGetTime(), maximized ? "maximized" : "unmaximized"); } static void window_refresh_callback(GLFWwindow* window) { printf("%0.2f Window refresh\n", glfwGetTime()); glfwMakeContextCurrent(window); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); } static GLFWwindow* create_window(GLFWmonitor* monitor) { int width, height; GLFWwindow* window; if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); width = mode->width; height = mode->height; } else { width = 640; height = 480; } window = glfwCreateWindow(width, height, "Iconify", monitor, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); return window; } int main(int argc, char** argv) { int ch, i, window_count; int fullscreen = GLFW_FALSE, all_monitors = GLFW_FALSE; GLFWwindow** windows; while ((ch = getopt(argc, argv, "afhn")) != -1) { switch (ch) { case 'a': all_monitors = GLFW_TRUE; break; case 'h': usage(); exit(EXIT_SUCCESS); case 'f': fullscreen = GLFW_TRUE; break; default: usage(); exit(EXIT_FAILURE); } } glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); if (fullscreen && all_monitors) { int monitor_count; GLFWmonitor** monitors = glfwGetMonitors(&monitor_count); window_count = monitor_count; windows = calloc(window_count, sizeof(GLFWwindow*)); for (i = 0; i < monitor_count; i++) { windows[i] = create_window(monitors[i]); if (!windows[i]) break; } } else { GLFWmonitor* monitor = NULL; if (fullscreen) monitor = glfwGetPrimaryMonitor(); window_count = 1; windows = calloc(window_count, sizeof(GLFWwindow*)); windows[0] = create_window(monitor); } for (i = 0; i < window_count; i++) { glfwSetKeyCallback(windows[i], key_callback); glfwSetFramebufferSizeCallback(windows[i], framebuffer_size_callback); glfwSetWindowSizeCallback(windows[i], window_size_callback); glfwSetWindowFocusCallback(windows[i], window_focus_callback); glfwSetWindowIconifyCallback(windows[i], window_iconify_callback); glfwSetWindowMaximizeCallback(windows[i], window_maximize_callback); glfwSetWindowRefreshCallback(windows[i], window_refresh_callback); window_refresh_callback(windows[i]); printf("Window is %s and %s\n", glfwGetWindowAttrib(windows[i], GLFW_ICONIFIED) ? "iconified" : "restored", glfwGetWindowAttrib(windows[i], GLFW_FOCUSED) ? "focused" : "defocused"); } for (;;) { glfwWaitEvents(); for (i = 0; i < window_count; i++) { if (glfwWindowShouldClose(windows[i])) break; } if (i < window_count) break; // Workaround for an issue with msvcrt and mintty fflush(stdout); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/inputlag.c ================================================ //======================================================================== // Input lag test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test renders a marker at the cursor position reported by GLFW to // check how much it lags behind the hardware mouse cursor // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #define NK_IMPLEMENTATION #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT #define NK_INCLUDE_DEFAULT_ALLOCATOR #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_STANDARD_VARARGS #include #define NK_GLFW_GL2_IMPLEMENTATION #include #include #include #include #include "getopt.h" void usage(void) { printf("Usage: inputlag [-h] [-f]\n"); printf("Options:\n"); printf(" -f create full screen window\n"); printf(" -h show this help\n"); } struct nk_vec2 cursor_new, cursor_pos, cursor_vel; enum { cursor_sync_query, cursor_input_message } cursor_method = cursor_sync_query; void sample_input(GLFWwindow* window) { float a = .25; // exponential smoothing factor if (cursor_method == cursor_sync_query) { double x, y; glfwGetCursorPos(window, &x, &y); cursor_new.x = (float) x; cursor_new.y = (float) y; } cursor_vel.x = (cursor_new.x - cursor_pos.x) * a + cursor_vel.x * (1 - a); cursor_vel.y = (cursor_new.y - cursor_pos.y) * a + cursor_vel.y * (1 - a); cursor_pos = cursor_new; } void cursor_pos_callback(GLFWwindow* window, double xpos, double ypos) { cursor_new.x = (float) xpos; cursor_new.y = (float) ypos; } int enable_vsync = nk_true; void update_vsync() { glfwSwapInterval(enable_vsync == nk_true ? 1 : 0); } int swap_clear = nk_false; int swap_finish = nk_true; int swap_occlusion_query = nk_false; int swap_read_pixels = nk_false; GLuint occlusion_query; void swap_buffers(GLFWwindow* window) { glfwSwapBuffers(window); if (swap_clear) glClear(GL_COLOR_BUFFER_BIT); if (swap_finish) glFinish(); if (swap_occlusion_query) { GLint occlusion_result; if (!occlusion_query) glGenQueries(1, &occlusion_query); glBeginQuery(GL_SAMPLES_PASSED, occlusion_query); glBegin(GL_POINTS); glVertex2f(0, 0); glEnd(); glEndQuery(GL_SAMPLES_PASSED); glGetQueryObjectiv(occlusion_query, GL_QUERY_RESULT, &occlusion_result); } if (swap_read_pixels) { unsigned char rgba[4]; glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, rgba); } } void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, 1); break; } } void draw_marker(struct nk_command_buffer* canvas, int lead, struct nk_vec2 pos) { struct nk_color colors[4] = { nk_rgb(255,0,0), nk_rgb(255,255,0), nk_rgb(0,255,0), nk_rgb(0,96,255) }; struct nk_rect rect = { -5 + pos.x, -5 + pos.y, 10, 10 }; nk_fill_circle(canvas, rect, colors[lead]); } int main(int argc, char** argv) { int ch, width, height; unsigned long frame_count = 0; double last_time, current_time; double frame_rate = 0; int fullscreen = GLFW_FALSE; GLFWmonitor* monitor = NULL; GLFWwindow* window; struct nk_context* nk; struct nk_font_atlas* atlas; int show_forecasts = nk_true; while ((ch = getopt(argc, argv, "fh")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); case 'f': fullscreen = GLFW_TRUE; break; } } glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); if (fullscreen) { const GLFWvidmode* mode; monitor = glfwGetPrimaryMonitor(); mode = glfwGetVideoMode(monitor); width = mode->width; height = mode->height; } else { width = 640; height = 480; } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); window = glfwCreateWindow(width, height, "Input lag test", monitor, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); update_vsync(); last_time = glfwGetTime(); nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); nk_glfw3_font_stash_begin(&atlas); nk_glfw3_font_stash_end(); glfwSetKeyCallback(window, key_callback); glfwSetCursorPosCallback(window, cursor_pos_callback); while (!glfwWindowShouldClose(window)) { int width, height; struct nk_rect area; glfwPollEvents(); sample_input(window); glfwGetWindowSize(window, &width, &height); area = nk_rect(0.f, 0.f, (float) width, (float) height); glClear(GL_COLOR_BUFFER_BIT); nk_glfw3_new_frame(); if (nk_begin(nk, "", area, 0)) { nk_flags align_left = NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE; struct nk_command_buffer *canvas = nk_window_get_canvas(nk); int lead; for (lead = show_forecasts ? 3 : 0; lead >= 0; lead--) draw_marker(canvas, lead, nk_vec2(cursor_pos.x + cursor_vel.x * lead, cursor_pos.y + cursor_vel.y * lead)); // print instructions nk_layout_row_dynamic(nk, 20, 1); nk_label(nk, "Move mouse uniformly and check marker under cursor:", align_left); for (lead = 0; lead <= 3; lead++) { nk_layout_row_begin(nk, NK_STATIC, 12, 2); nk_layout_row_push(nk, 25); draw_marker(canvas, lead, nk_layout_space_to_screen(nk, nk_vec2(20, 5))); nk_label(nk, "", 0); nk_layout_row_push(nk, 500); if (lead == 0) nk_label(nk, "- current cursor position (no input lag)", align_left); else nk_labelf(nk, align_left, "- %d-frame forecast (input lag is %d frame)", lead, lead); nk_layout_row_end(nk); } nk_layout_row_dynamic(nk, 20, 1); nk_checkbox_label(nk, "Show forecasts", &show_forecasts); nk_label(nk, "Input method:", align_left); if (nk_option_label(nk, "glfwGetCursorPos (sync query)", cursor_method == cursor_sync_query)) cursor_method = cursor_sync_query; if (nk_option_label(nk, "glfwSetCursorPosCallback (latest input message)", cursor_method == cursor_input_message)) cursor_method = cursor_input_message; nk_label(nk, "", 0); // separator nk_value_float(nk, "FPS", (float) frame_rate); if (nk_checkbox_label(nk, "Enable vsync", &enable_vsync)) update_vsync(); nk_label(nk, "", 0); // separator nk_label(nk, "After swap:", align_left); nk_checkbox_label(nk, "glClear", &swap_clear); nk_checkbox_label(nk, "glFinish", &swap_finish); nk_checkbox_label(nk, "draw with occlusion query", &swap_occlusion_query); nk_checkbox_label(nk, "glReadPixels", &swap_read_pixels); } nk_end(nk); nk_glfw3_render(NK_ANTI_ALIASING_ON); swap_buffers(window); frame_count++; current_time = glfwGetTime(); if (current_time - last_time > 1.0) { frame_rate = frame_count / (current_time - last_time); frame_count = 0; last_time = current_time; } } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/joysticks.c ================================================ //======================================================================== // Joystick input test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test displays the state of every button and axis of every connected // joystick and/or gamepad // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #define NK_IMPLEMENTATION #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT #define NK_INCLUDE_DEFAULT_ALLOCATOR #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_STANDARD_VARARGS #define NK_BUTTON_TRIGGER_ON_RELEASE #include #define NK_GLFW_GL2_IMPLEMENTATION #include #include #include #include #ifdef _MSC_VER #define strdup(x) _strdup(x) #endif static GLFWwindow* window; static int joysticks[GLFW_JOYSTICK_LAST + 1]; static int joystick_count = 0; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void joystick_callback(int jid, int event) { if (event == GLFW_CONNECTED) joysticks[joystick_count++] = jid; else if (event == GLFW_DISCONNECTED) { int i; for (i = 0; i < joystick_count; i++) { if (joysticks[i] == jid) break; } for (i = i + 1; i < joystick_count; i++) joysticks[i - 1] = joysticks[i]; joystick_count--; } if (!glfwGetWindowAttrib(window, GLFW_FOCUSED)) glfwRequestWindowAttention(window); } static void drop_callback(GLFWwindow* window, int count, const char* paths[]) { int i; for (i = 0; i < count; i++) { long size; char* text; FILE* stream = fopen(paths[i], "rb"); if (!stream) continue; fseek(stream, 0, SEEK_END); size = ftell(stream); fseek(stream, 0, SEEK_SET); text = malloc(size + 1); text[size] = '\0'; if (fread(text, 1, size, stream) == size) glfwUpdateGamepadMappings(text); free(text); fclose(stream); } } static const char* joystick_label(int jid) { static char label[1024]; snprintf(label, sizeof(label), "%i: %s", jid + 1, glfwGetJoystickName(jid)); return label; } static void hat_widget(struct nk_context* nk, unsigned char state) { float radius; struct nk_rect area; struct nk_vec2 center; if (nk_widget(&area, nk) == NK_WIDGET_INVALID) return; center = nk_vec2(area.x + area.w / 2.f, area.y + area.h / 2.f); radius = NK_MIN(area.w, area.h) / 2.f; nk_stroke_circle(nk_window_get_canvas(nk), nk_rect(center.x - radius, center.y - radius, radius * 2.f, radius * 2.f), 1.f, nk_rgb(175, 175, 175)); if (state) { const float angles[] = { 0.f, 0.f, NK_PI * 1.5f, NK_PI * 1.75f, NK_PI, 0.f, NK_PI * 1.25f, 0.f, NK_PI * 0.5f, NK_PI * 0.25f, 0.f, 0.f, NK_PI * 0.75f, 0.f, }; const float cosa = nk_cos(angles[state]); const float sina = nk_sin(angles[state]); const struct nk_vec2 p0 = nk_vec2(0.f, -radius); const struct nk_vec2 p1 = nk_vec2( radius / 2.f, -radius / 3.f); const struct nk_vec2 p2 = nk_vec2(-radius / 2.f, -radius / 3.f); nk_fill_triangle(nk_window_get_canvas(nk), center.x + cosa * p0.x + sina * p0.y, center.y + cosa * p0.y - sina * p0.x, center.x + cosa * p1.x + sina * p1.y, center.y + cosa * p1.y - sina * p1.x, center.x + cosa * p2.x + sina * p2.y, center.y + cosa * p2.y - sina * p2.x, nk_rgb(175, 175, 175)); } } int main(void) { int jid, hat_buttons = GLFW_FALSE; struct nk_context* nk; struct nk_font_atlas* atlas; memset(joysticks, 0, sizeof(joysticks)); glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); nk_glfw3_font_stash_begin(&atlas); nk_glfw3_font_stash_end(); for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++) { if (glfwJoystickPresent(jid)) joysticks[joystick_count++] = jid; } glfwSetJoystickCallback(joystick_callback); glfwSetDropCallback(window, drop_callback); while (!glfwWindowShouldClose(window)) { int i, width, height; glfwGetWindowSize(window, &width, &height); glClear(GL_COLOR_BUFFER_BIT); nk_glfw3_new_frame(); if (nk_begin(nk, "Joysticks", nk_rect(width - 200.f, 0.f, 200.f, (float) height), NK_WINDOW_MINIMIZABLE | NK_WINDOW_TITLE)) { nk_layout_row_dynamic(nk, 30, 1); nk_checkbox_label(nk, "Hat buttons", &hat_buttons); if (joystick_count) { for (i = 0; i < joystick_count; i++) { if (nk_button_label(nk, joystick_label(joysticks[i]))) nk_window_set_focus(nk, joystick_label(joysticks[i])); } } else nk_label(nk, "No joysticks connected", NK_TEXT_LEFT); } nk_end(nk); for (i = 0; i < joystick_count; i++) { if (nk_begin(nk, joystick_label(joysticks[i]), nk_rect(i * 20.f, i * 20.f, 550.f, 570.f), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_SCALABLE | NK_WINDOW_MINIMIZABLE | NK_WINDOW_TITLE)) { int j, axis_count, button_count, hat_count; const float* axes; const unsigned char* buttons; const unsigned char* hats; GLFWgamepadstate state; nk_layout_row_dynamic(nk, 30, 1); nk_labelf(nk, NK_TEXT_LEFT, "Hardware GUID %s", glfwGetJoystickGUID(joysticks[i])); nk_label(nk, "Joystick state", NK_TEXT_LEFT); axes = glfwGetJoystickAxes(joysticks[i], &axis_count); buttons = glfwGetJoystickButtons(joysticks[i], &button_count); hats = glfwGetJoystickHats(joysticks[i], &hat_count); if (!hat_buttons) button_count -= hat_count * 4; for (j = 0; j < axis_count; j++) nk_slide_float(nk, -1.f, axes[j], 1.f, 0.1f); nk_layout_row_dynamic(nk, 30, 12); for (j = 0; j < button_count; j++) { char name[16]; snprintf(name, sizeof(name), "%i", j + 1); nk_select_label(nk, name, NK_TEXT_CENTERED, buttons[j]); } nk_layout_row_dynamic(nk, 30, 8); for (j = 0; j < hat_count; j++) hat_widget(nk, hats[j]); nk_layout_row_dynamic(nk, 30, 1); if (glfwGetGamepadState(joysticks[i], &state)) { int hat = 0; const char* names[GLFW_GAMEPAD_BUTTON_LAST + 1 - 4] = { "A", "B", "X", "Y", "LB", "RB", "Back", "Start", "Guide", "LT", "RT", }; nk_labelf(nk, NK_TEXT_LEFT, "Gamepad state: %s", glfwGetGamepadName(joysticks[i])); nk_layout_row_dynamic(nk, 30, 2); for (j = 0; j <= GLFW_GAMEPAD_AXIS_LAST; j++) nk_slide_float(nk, -1.f, state.axes[j], 1.f, 0.1f); nk_layout_row_dynamic(nk, 30, GLFW_GAMEPAD_BUTTON_LAST + 1 - 4); for (j = 0; j <= GLFW_GAMEPAD_BUTTON_LAST - 4; j++) nk_select_label(nk, names[j], NK_TEXT_CENTERED, state.buttons[j]); if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_UP]) hat |= GLFW_HAT_UP; if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_RIGHT]) hat |= GLFW_HAT_RIGHT; if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_DOWN]) hat |= GLFW_HAT_DOWN; if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_LEFT]) hat |= GLFW_HAT_LEFT; nk_layout_row_dynamic(nk, 30, 8); hat_widget(nk, hat); } else nk_label(nk, "Joystick has no gamepad mapping", NK_TEXT_LEFT); } nk_end(nk); } nk_glfw3_render(NK_ANTI_ALIASING_ON); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/monitors.c ================================================ //======================================================================== // Monitor information tool // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test prints monitor and video mode information or verifies video // modes // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include #include "getopt.h" enum Mode { LIST_MODE, TEST_MODE }; static void usage(void) { printf("Usage: monitors [-t]\n"); printf(" monitors -h\n"); } static int euclid(int a, int b) { return b ? euclid(b, a % b) : a; } static const char* format_mode(const GLFWvidmode* mode) { static char buffer[512]; const int gcd = euclid(mode->width, mode->height); snprintf(buffer, sizeof(buffer), "%i x %i x %i (%i:%i) (%i %i %i) %i Hz", mode->width, mode->height, mode->redBits + mode->greenBits + mode->blueBits, mode->width / gcd, mode->height / gcd, mode->redBits, mode->greenBits, mode->blueBits, mode->refreshRate); buffer[sizeof(buffer) - 1] = '\0'; return buffer; } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { printf("Framebuffer resized to %ix%i\n", width, height); glViewport(0, 0, width, height); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE) glfwSetWindowShouldClose(window, GLFW_TRUE); } static void list_modes(GLFWmonitor* monitor) { int count, x, y, width_mm, height_mm, i; int workarea_x, workarea_y, workarea_width, workarea_height; float xscale, yscale; const GLFWvidmode* mode = glfwGetVideoMode(monitor); const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); glfwGetMonitorPos(monitor, &x, &y); glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm); glfwGetMonitorContentScale(monitor, &xscale, &yscale); glfwGetMonitorWorkarea(monitor, &workarea_x, &workarea_y, &workarea_width, &workarea_height); printf("Name: %s (%s)\n", glfwGetMonitorName(monitor), glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary"); printf("Current mode: %s\n", format_mode(mode)); printf("Virtual position: %i, %i\n", x, y); printf("Content scale: %f x %f\n", xscale, yscale); printf("Physical size: %i x %i mm (%0.2f dpi at %i x %i)\n", width_mm, height_mm, mode->width * 25.4f / width_mm, mode->width, mode->height); printf("Monitor work area: %i x %i starting at %i, %i\n", workarea_width, workarea_height, workarea_x, workarea_y); printf("Modes:\n"); for (i = 0; i < count; i++) { printf("%3u: %s", (unsigned int) i, format_mode(modes + i)); if (memcmp(mode, modes + i, sizeof(GLFWvidmode)) == 0) printf(" (current mode)"); putchar('\n'); } } static void test_modes(GLFWmonitor* monitor) { int i, count; GLFWwindow* window; const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); for (i = 0; i < count; i++) { const GLFWvidmode* mode = modes + i; GLFWvidmode current; glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); printf("Testing mode %u on monitor %s: %s\n", (unsigned int) i, glfwGetMonitorName(monitor), format_mode(mode)); window = glfwCreateWindow(mode->width, mode->height, "Video Mode Test", glfwGetPrimaryMonitor(), NULL); if (!window) { printf("Failed to enter mode %u: %s\n", (unsigned int) i, format_mode(mode)); continue; } glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); glfwSetTime(0.0); while (glfwGetTime() < 5.0) { glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwPollEvents(); if (glfwWindowShouldClose(window)) { printf("User terminated program\n"); glfwTerminate(); exit(EXIT_SUCCESS); } } glGetIntegerv(GL_RED_BITS, ¤t.redBits); glGetIntegerv(GL_GREEN_BITS, ¤t.greenBits); glGetIntegerv(GL_BLUE_BITS, ¤t.blueBits); glfwGetWindowSize(window, ¤t.width, ¤t.height); if (current.redBits != mode->redBits || current.greenBits != mode->greenBits || current.blueBits != mode->blueBits) { printf("*** Color bit mismatch: (%i %i %i) instead of (%i %i %i)\n", current.redBits, current.greenBits, current.blueBits, mode->redBits, mode->greenBits, mode->blueBits); } if (current.width != mode->width || current.height != mode->height) { printf("*** Size mismatch: %ix%i instead of %ix%i\n", current.width, current.height, mode->width, mode->height); } printf("Closing window\n"); glfwDestroyWindow(window); window = NULL; glfwPollEvents(); } } int main(int argc, char** argv) { int ch, i, count, mode = LIST_MODE; GLFWmonitor** monitors; while ((ch = getopt(argc, argv, "th")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); case 't': mode = TEST_MODE; break; default: usage(); exit(EXIT_FAILURE); } } glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); monitors = glfwGetMonitors(&count); for (i = 0; i < count; i++) { if (mode == LIST_MODE) list_modes(monitors[i]); else if (mode == TEST_MODE) test_modes(monitors[i]); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/msaa.c ================================================ //======================================================================== // Multisample anti-aliasing test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test renders two high contrast, slowly rotating quads, one aliased // and one (hopefully) anti-aliased, thus allowing for visual verification // of whether MSAA is indeed enabled // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #if defined(_MSC_VER) // Make MS math.h define M_PI #define _USE_MATH_DEFINES #endif #include "linmath.h" #include #include #include "getopt.h" static const vec2 vertices[4] = { { -0.6f, -0.6f }, { 0.6f, -0.6f }, { 0.6f, 0.6f }, { -0.6f, 0.6f } }; static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec2 vPos;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" "}\n"; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_SPACE: glfwSetTime(0.0); break; case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; } } static void usage(void) { printf("Usage: msaa [-h] [-s SAMPLES]\n"); } int main(int argc, char** argv) { int ch, samples = 4; GLFWwindow* window; GLuint vertex_buffer, vertex_shader, fragment_shader, program; GLint mvp_location, vpos_location; while ((ch = getopt(argc, argv, "hs:")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); case 's': samples = atoi(optarg); break; default: usage(); exit(EXIT_FAILURE); } } glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); if (samples) printf("Requesting MSAA with %i samples\n", samples); else printf("Requesting that MSAA not be available\n"); glfwWindowHint(GLFW_SAMPLES, samples); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); glGetIntegerv(GL_SAMPLES, &samples); if (samples) printf("Context reports MSAA is available with %i samples\n", samples); else printf("Context reports MSAA is unavailable\n"); glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); vpos_location = glGetAttribLocation(program, "vPos"); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); while (!glfwWindowShouldClose(window)) { float ratio; int width, height; mat4x4 m, p, mvp; const double angle = glfwGetTime() * M_PI / 180.0; glfwGetFramebufferSize(window, &width, &height); ratio = width / (float) height; glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); glUseProgram(program); mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 0.f, 1.f); mat4x4_translate(m, -1.f, 0.f, 0.f); mat4x4_rotate_Z(m, m, (float) angle); mat4x4_mul(mvp, p, m); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glDisable(GL_MULTISAMPLE); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); mat4x4_translate(m, 1.f, 0.f, 0.f); mat4x4_rotate_Z(m, m, (float) angle); mat4x4_mul(mvp, p, m); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glEnable(GL_MULTISAMPLE); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glfwSwapBuffers(window); glfwPollEvents(); } glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/opacity.c ================================================ //======================================================================== // Window opacity test program // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as 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 #define GLFW_INCLUDE_NONE #include #define NK_IMPLEMENTATION #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT #define NK_INCLUDE_DEFAULT_ALLOCATOR #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_STANDARD_VARARGS #include #define NK_GLFW_GL2_IMPLEMENTATION #include #include #include static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } int main(int argc, char** argv) { GLFWwindow* window; struct nk_context* nk; struct nk_font_atlas* atlas; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); nk_glfw3_font_stash_begin(&atlas); nk_glfw3_font_stash_end(); while (!glfwWindowShouldClose(window)) { int width, height; struct nk_rect area; glfwGetWindowSize(window, &width, &height); area = nk_rect(0.f, 0.f, (float) width, (float) height); glClear(GL_COLOR_BUFFER_BIT); nk_glfw3_new_frame(); if (nk_begin(nk, "", area, 0)) { float opacity = glfwGetWindowOpacity(window); nk_layout_row_dynamic(nk, 30, 2); if (nk_slider_float(nk, 0.f, &opacity, 1.f, 0.001f)) glfwSetWindowOpacity(window, opacity); nk_labelf(nk, NK_TEXT_LEFT, "%0.3f", opacity); } nk_end(nk); nk_glfw3_render(NK_ANTI_ALIASING_ON); glfwSwapBuffers(window); glfwWaitEventsTimeout(1.0); } nk_glfw3_shutdown(); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/reopen.c ================================================ //======================================================================== // Window re-opener (open/close stress test) // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test came about as the result of bug #1262773 // // It closes and re-opens the GLFW window every five seconds, alternating // between windowed and full screen mode // // It also times and logs opening and closing actions and attempts to separate // user initiated window closing from its own // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include #include "linmath.h" static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec2 vPos;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" "}\n"; static const vec2 vertices[4] = { { -0.5f, -0.5f }, { 0.5f, -0.5f }, { 0.5f, 0.5f }, { -0.5f, 0.5f } }; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void window_close_callback(GLFWwindow* window) { printf("Close callback triggered\n"); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_Q: case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; } } static void close_window(GLFWwindow* window) { double base = glfwGetTime(); glfwDestroyWindow(window); printf("Closing window took %0.3f seconds\n", glfwGetTime() - base); } int main(int argc, char** argv) { int count = 0; double base; GLFWwindow* window; srand((unsigned int) time(NULL)); glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); for (;;) { int width, height; GLFWmonitor* monitor = NULL; GLuint vertex_shader, fragment_shader, program, vertex_buffer; GLint mvp_location, vpos_location; if (count & 1) { int monitorCount; GLFWmonitor** monitors = glfwGetMonitors(&monitorCount); monitor = monitors[rand() % monitorCount]; } if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); width = mode->width; height = mode->height; } else { width = 640; height = 480; } base = glfwGetTime(); window = glfwCreateWindow(width, height, "Window Re-opener", monitor, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } if (monitor) { printf("Opening full screen window on monitor %s took %0.3f seconds\n", glfwGetMonitorName(monitor), glfwGetTime() - base); } else { printf("Opening regular window took %0.3f seconds\n", glfwGetTime() - base); } glfwSetWindowCloseCallback(window, window_close_callback); glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); vpos_location = glGetAttribLocation(program, "vPos"); glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); glfwSetTime(0.0); while (glfwGetTime() < 5.0) { float ratio; int width, height; mat4x4 m, p, mvp; glfwGetFramebufferSize(window, &width, &height); ratio = width / (float) height; glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 0.f, 1.f); mat4x4_identity(m); mat4x4_rotate_Z(m, m, (float) glfwGetTime()); mat4x4_mul(mvp, p, m); glUseProgram(program); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glfwSwapBuffers(window); glfwPollEvents(); if (glfwWindowShouldClose(window)) { close_window(window); printf("User closed window\n"); glfwTerminate(); exit(EXIT_SUCCESS); } } printf("Closing window\n"); close_window(window); count++; } glfwTerminate(); } ================================================ FILE: thirdparty/glfw/tests/tearing.c ================================================ //======================================================================== // Vsync enabling test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test renders a high contrast, horizontally moving bar, allowing for // visual verification of whether the set swap interval is indeed obeyed // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include #include "linmath.h" static const struct { float x, y; } vertices[4] = { { -0.25f, -1.f }, { 0.25f, -1.f }, { 0.25f, 1.f }, { -0.25f, 1.f } }; static const char* vertex_shader_text = "#version 110\n" "uniform mat4 MVP;\n" "attribute vec2 vPos;\n" "void main()\n" "{\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" "}\n"; static const char* fragment_shader_text = "#version 110\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" "}\n"; static int swap_tear; static int swap_interval; static double frame_rate; static void update_window_title(GLFWwindow* window) { char title[256]; snprintf(title, sizeof(title), "Tearing detector (interval %i%s, %0.1f Hz)", swap_interval, (swap_tear && swap_interval < 0) ? " (swap tear)" : "", frame_rate); glfwSetWindowTitle(window, title); } static void set_swap_interval(GLFWwindow* window, int interval) { swap_interval = interval; glfwSwapInterval(swap_interval); update_window_title(window); } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_UP: { if (swap_interval + 1 > swap_interval) set_swap_interval(window, swap_interval + 1); break; } case GLFW_KEY_DOWN: { if (swap_tear) { if (swap_interval - 1 < swap_interval) set_swap_interval(window, swap_interval - 1); } else { if (swap_interval - 1 >= 0) set_swap_interval(window, swap_interval - 1); } break; } case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, 1); break; case GLFW_KEY_F11: case GLFW_KEY_ENTER: { static int x, y, width, height; if (mods != GLFW_MOD_ALT) return; if (glfwGetWindowMonitor(window)) glfwSetWindowMonitor(window, NULL, x, y, width, height, 0); else { GLFWmonitor* monitor = glfwGetPrimaryMonitor(); const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwGetWindowPos(window, &x, &y); glfwGetWindowSize(window, &width, &height); glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); } break; } } } int main(int argc, char** argv) { unsigned long frame_count = 0; double last_time, current_time; GLFWwindow* window; GLuint vertex_buffer, vertex_shader, fragment_shader, program; GLint mvp_location, vpos_location; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); window = glfwCreateWindow(640, 480, "Tearing detector", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); set_swap_interval(window, 0); last_time = glfwGetTime(); frame_rate = 0.0; swap_tear = (glfwExtensionSupported("WGL_EXT_swap_control_tear") || glfwExtensionSupported("GLX_EXT_swap_control_tear")); glfwSetKeyCallback(window, key_callback); glGenBuffers(1, &vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); vertex_shader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glCompileShader(vertex_shader); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glCompileShader(fragment_shader); program = glCreateProgram(); glAttachShader(program, vertex_shader); glAttachShader(program, fragment_shader); glLinkProgram(program); mvp_location = glGetUniformLocation(program, "MVP"); vpos_location = glGetAttribLocation(program, "vPos"); glEnableVertexAttribArray(vpos_location); glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, sizeof(vertices[0]), (void*) 0); while (!glfwWindowShouldClose(window)) { int width, height; mat4x4 m, p, mvp; float position = cosf((float) glfwGetTime() * 4.f) * 0.75f; glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); mat4x4_ortho(p, -1.f, 1.f, -1.f, 1.f, 0.f, 1.f); mat4x4_translate(m, position, 0.f, 0.f); mat4x4_mul(mvp, p, m); glUseProgram(program); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glfwSwapBuffers(window); glfwPollEvents(); frame_count++; current_time = glfwGetTime(); if (current_time - last_time > 1.0) { frame_rate = frame_count / (current_time - last_time); frame_count = 0; last_time = current_time; update_window_title(window); } } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/threads.c ================================================ //======================================================================== // Multi-threading test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test is intended to verify whether the OpenGL context part of // the GLFW API is able to be used from multiple threads // //======================================================================== #include "tinycthread.h" #include #define GLFW_INCLUDE_NONE #include #include #include #include typedef struct { GLFWwindow* window; const char* title; float r, g, b; thrd_t id; } Thread; static volatile int running = GLFW_TRUE; static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } static int thread_main(void* data) { const Thread* thread = data; glfwMakeContextCurrent(thread->window); glfwSwapInterval(1); while (running) { const float v = (float) fabs(sin(glfwGetTime() * 2.f)); glClearColor(thread->r * v, thread->g * v, thread->b * v, 0.f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(thread->window); } glfwMakeContextCurrent(NULL); return 0; } int main(void) { int i, result; Thread threads[] = { { NULL, "Red", 1.f, 0.f, 0.f, 0 }, { NULL, "Green", 0.f, 1.f, 0.f, 0 }, { NULL, "Blue", 0.f, 0.f, 1.f, 0 } }; const int count = sizeof(threads) / sizeof(Thread); glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); for (i = 0; i < count; i++) { threads[i].window = glfwCreateWindow(200, 200, threads[i].title, NULL, NULL); if (!threads[i].window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(threads[i].window, key_callback); glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200); glfwShowWindow(threads[i].window); } glfwMakeContextCurrent(threads[0].window); gladLoadGL(glfwGetProcAddress); glfwMakeContextCurrent(NULL); for (i = 0; i < count; i++) { if (thrd_create(&threads[i].id, thread_main, threads + i) != thrd_success) { fprintf(stderr, "Failed to create secondary thread\n"); glfwTerminate(); exit(EXIT_FAILURE); } } while (running) { glfwWaitEvents(); for (i = 0; i < count; i++) { if (glfwWindowShouldClose(threads[i].window)) running = GLFW_FALSE; } } for (i = 0; i < count; i++) glfwHideWindow(threads[i].window); for (i = 0; i < count; i++) thrd_join(threads[i].id, &result); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/timeout.c ================================================ //======================================================================== // Event wait timeout test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test is intended to verify that waiting for events with timeout works // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include #include static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } static float nrand(void) { return (float) rand() / (float) RAND_MAX; } int main(void) { GLFWwindow* window; srand((unsigned int) time(NULL)); glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); window = glfwCreateWindow(640, 480, "Event Wait Timeout Test", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSetKeyCallback(window, key_callback); while (!glfwWindowShouldClose(window)) { int width, height; float r = nrand(), g = nrand(), b = nrand(); float l = (float) sqrt(r * r + g * g + b * b); glfwGetFramebufferSize(window, &width, &height); glViewport(0, 0, width, height); glClearColor(r / l, g / l, b / l, 1.f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwWaitEventsTimeout(1.0); } glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/title.c ================================================ //======================================================================== // UTF-8 window title test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test sets a UTF-8 window title // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } int main(void) { GLFWwindow* window; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL); if (!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); while (!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwWaitEvents(); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/glfw/tests/triangle-vulkan.c ================================================ /* * Copyright (c) 2015-2016 The Khronos Group Inc. * Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: Chia-I Wu * Author: Cody Northrop * Author: Courtney Goeltzenleuchter * Author: Ian Elliott * Author: Jon Ashburn * Author: Piers Daniell * Author: Gwan-gyeong Mun * Porter: Camilla Löwy */ /* * Draw a textured triangle with depth testing. This is written against Intel * ICD. It does not do state transition nor object memory binding like it * should. It also does no error checking. */ #include #include #include #include #include #include #ifdef _WIN32 #include #endif #include #define GLFW_INCLUDE_NONE #include #define DEMO_TEXTURE_COUNT 1 #define VERTEX_BUFFER_BIND_ID 0 #define APP_SHORT_NAME "tri" #define APP_LONG_NAME "The Vulkan Triangle Demo Program" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #if defined(NDEBUG) && defined(__GNUC__) #define U_ASSERT_ONLY __attribute__((unused)) #else #define U_ASSERT_ONLY #endif #define ERR_EXIT(err_msg, err_class) \ do { \ printf(err_msg); \ fflush(stdout); \ exit(1); \ } while (0) static GLADapiproc glad_vulkan_callback(const char* name, void* user) { return glfwGetInstanceProcAddress((VkInstance) user, name); } static const char fragShaderCode[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x5f, 0x34, 0x32, 0x30, 0x70, 0x61, 0x63, 0x6b, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, 0x05, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 }; static const char vertShaderCode[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x5f, 0x34, 0x32, 0x30, 0x70, 0x61, 0x63, 0x6b, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x11, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x65, 0x72, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x07, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x43, 0x6c, 0x69, 0x70, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x05, 0x00, 0x03, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x17, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x00, 0x05, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, 0x05, 0x00, 0x06, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 }; struct texture_object { VkSampler sampler; VkImage image; VkImageLayout imageLayout; VkDeviceMemory mem; VkImageView view; int32_t tex_width, tex_height; }; static int validation_error = 0; VKAPI_ATTR VkBool32 VKAPI_CALL BreakCallback(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg, void *pUserData) { #ifdef _WIN32 DebugBreak(); #else raise(SIGTRAP); #endif return false; } typedef struct { VkImage image; VkCommandBuffer cmd; VkImageView view; } SwapchainBuffers; struct demo { GLFWwindow* window; VkSurfaceKHR surface; bool use_staging_buffer; VkInstance inst; VkPhysicalDevice gpu; VkDevice device; VkQueue queue; VkPhysicalDeviceProperties gpu_props; VkPhysicalDeviceFeatures gpu_features; VkQueueFamilyProperties *queue_props; uint32_t graphics_queue_node_index; uint32_t enabled_extension_count; uint32_t enabled_layer_count; const char *extension_names[64]; const char *enabled_layers[64]; int width, height; VkFormat format; VkColorSpaceKHR color_space; uint32_t swapchainImageCount; VkSwapchainKHR swapchain; SwapchainBuffers *buffers; VkCommandPool cmd_pool; struct { VkFormat format; VkImage image; VkDeviceMemory mem; VkImageView view; } depth; struct texture_object textures[DEMO_TEXTURE_COUNT]; struct { VkBuffer buf; VkDeviceMemory mem; VkPipelineVertexInputStateCreateInfo vi; VkVertexInputBindingDescription vi_bindings[1]; VkVertexInputAttributeDescription vi_attrs[2]; } vertices; VkCommandBuffer setup_cmd; // Command Buffer for initialization commands VkCommandBuffer draw_cmd; // Command Buffer for drawing commands VkPipelineLayout pipeline_layout; VkDescriptorSetLayout desc_layout; VkPipelineCache pipelineCache; VkRenderPass render_pass; VkPipeline pipeline; VkShaderModule vert_shader_module; VkShaderModule frag_shader_module; VkDescriptorPool desc_pool; VkDescriptorSet desc_set; VkFramebuffer *framebuffers; VkPhysicalDeviceMemoryProperties memory_properties; int32_t curFrame; int32_t frameCount; bool validate; bool use_break; VkDebugReportCallbackEXT msg_callback; float depthStencil; float depthIncrement; uint32_t current_buffer; uint32_t queue_count; }; VKAPI_ATTR VkBool32 VKAPI_CALL dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg, void *pUserData) { char *message = (char *)malloc(strlen(pMsg) + 100); assert(message); validation_error = 1; if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) { sprintf(message, "ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); } else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { sprintf(message, "WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); } else { return false; } printf("%s\n", message); fflush(stdout); free(message); /* * false indicates that layer should not bail-out of an * API call that had validation failures. This may mean that the * app dies inside the driver due to invalid parameter(s). * That's what would happen without validation layers, so we'll * keep that behavior here. */ return false; } // Forward declaration: static void demo_resize(struct demo *demo); static bool memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) { uint32_t i; // Search memtypes to find first index with those properties for (i = 0; i < VK_MAX_MEMORY_TYPES; i++) { if ((typeBits & 1) == 1) { // Type is available, does it match user properties? if ((demo->memory_properties.memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; return true; } } typeBits >>= 1; } // No memory types matched, return failure return false; } static void demo_flush_init_cmd(struct demo *demo) { VkResult U_ASSERT_ONLY err; if (demo->setup_cmd == VK_NULL_HANDLE) return; err = vkEndCommandBuffer(demo->setup_cmd); assert(!err); const VkCommandBuffer cmd_bufs[] = {demo->setup_cmd}; VkFence nullFence = {VK_NULL_HANDLE}; VkSubmitInfo submit_info = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .pNext = NULL, .waitSemaphoreCount = 0, .pWaitSemaphores = NULL, .pWaitDstStageMask = NULL, .commandBufferCount = 1, .pCommandBuffers = cmd_bufs, .signalSemaphoreCount = 0, .pSignalSemaphores = NULL}; err = vkQueueSubmit(demo->queue, 1, &submit_info, nullFence); assert(!err); err = vkQueueWaitIdle(demo->queue); assert(!err); vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, cmd_bufs); demo->setup_cmd = VK_NULL_HANDLE; } static void demo_set_image_layout(struct demo *demo, VkImage image, VkImageAspectFlags aspectMask, VkImageLayout old_image_layout, VkImageLayout new_image_layout, VkAccessFlagBits srcAccessMask) { VkResult U_ASSERT_ONLY err; if (demo->setup_cmd == VK_NULL_HANDLE) { const VkCommandBufferAllocateInfo cmd = { .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, .pNext = NULL, .commandPool = demo->cmd_pool, .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY, .commandBufferCount = 1, }; err = vkAllocateCommandBuffers(demo->device, &cmd, &demo->setup_cmd); assert(!err); VkCommandBufferBeginInfo cmd_buf_info = { .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, .pNext = NULL, .flags = 0, .pInheritanceInfo = NULL, }; err = vkBeginCommandBuffer(demo->setup_cmd, &cmd_buf_info); assert(!err); } VkImageMemoryBarrier image_memory_barrier = { .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .pNext = NULL, .srcAccessMask = srcAccessMask, .dstAccessMask = 0, .oldLayout = old_image_layout, .newLayout = new_image_layout, .image = image, .subresourceRange = {aspectMask, 0, 1, 0, 1}}; if (new_image_layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { /* Make sure anything that was copying from this image has completed */ image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; } if (new_image_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { image_memory_barrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; } if (new_image_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL) { image_memory_barrier.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; } if (new_image_layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { /* Make sure any Copy or CPU writes to image are flushed */ image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; } VkImageMemoryBarrier *pmemory_barrier = &image_memory_barrier; VkPipelineStageFlags src_stages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; VkPipelineStageFlags dest_stages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; vkCmdPipelineBarrier(demo->setup_cmd, src_stages, dest_stages, 0, 0, NULL, 0, NULL, 1, pmemory_barrier); } static void demo_draw_build_cmd(struct demo *demo) { const VkCommandBufferBeginInfo cmd_buf_info = { .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, .pNext = NULL, .flags = 0, .pInheritanceInfo = NULL, }; const VkClearValue clear_values[2] = { [0] = {.color.float32 = {0.2f, 0.2f, 0.2f, 0.2f}}, [1] = {.depthStencil = {demo->depthStencil, 0}}, }; const VkRenderPassBeginInfo rp_begin = { .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .pNext = NULL, .renderPass = demo->render_pass, .framebuffer = demo->framebuffers[demo->current_buffer], .renderArea.offset.x = 0, .renderArea.offset.y = 0, .renderArea.extent.width = demo->width, .renderArea.extent.height = demo->height, .clearValueCount = 2, .pClearValues = clear_values, }; VkResult U_ASSERT_ONLY err; err = vkBeginCommandBuffer(demo->draw_cmd, &cmd_buf_info); assert(!err); // We can use LAYOUT_UNDEFINED as a wildcard here because we don't care what // happens to the previous contents of the image VkImageMemoryBarrier image_memory_barrier = { .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .pNext = NULL, .srcAccessMask = 0, .dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED, .newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = demo->buffers[demo->current_buffer].image, .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; vkCmdPipelineBarrier(demo->draw_cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier); vkCmdBeginRenderPass(demo->draw_cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE); vkCmdBindPipeline(demo->draw_cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, demo->pipeline); vkCmdBindDescriptorSets(demo->draw_cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, demo->pipeline_layout, 0, 1, &demo->desc_set, 0, NULL); VkViewport viewport; memset(&viewport, 0, sizeof(viewport)); viewport.height = (float)demo->height; viewport.width = (float)demo->width; viewport.minDepth = (float)0.0f; viewport.maxDepth = (float)1.0f; vkCmdSetViewport(demo->draw_cmd, 0, 1, &viewport); VkRect2D scissor; memset(&scissor, 0, sizeof(scissor)); scissor.extent.width = demo->width; scissor.extent.height = demo->height; scissor.offset.x = 0; scissor.offset.y = 0; vkCmdSetScissor(demo->draw_cmd, 0, 1, &scissor); VkDeviceSize offsets[1] = {0}; vkCmdBindVertexBuffers(demo->draw_cmd, VERTEX_BUFFER_BIND_ID, 1, &demo->vertices.buf, offsets); vkCmdDraw(demo->draw_cmd, 3, 1, 0, 0); vkCmdEndRenderPass(demo->draw_cmd); VkImageMemoryBarrier prePresentBarrier = { .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .pNext = NULL, .srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT, .oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, .newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; prePresentBarrier.image = demo->buffers[demo->current_buffer].image; VkImageMemoryBarrier *pmemory_barrier = &prePresentBarrier; vkCmdPipelineBarrier(demo->draw_cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, pmemory_barrier); err = vkEndCommandBuffer(demo->draw_cmd); assert(!err); } static void demo_draw(struct demo *demo) { VkResult U_ASSERT_ONLY err; VkSemaphore imageAcquiredSemaphore, drawCompleteSemaphore; VkSemaphoreCreateInfo semaphoreCreateInfo = { .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, .pNext = NULL, .flags = 0, }; err = vkCreateSemaphore(demo->device, &semaphoreCreateInfo, NULL, &imageAcquiredSemaphore); assert(!err); err = vkCreateSemaphore(demo->device, &semaphoreCreateInfo, NULL, &drawCompleteSemaphore); assert(!err); // Get the index of the next available swapchain image: err = vkAcquireNextImageKHR(demo->device, demo->swapchain, UINT64_MAX, imageAcquiredSemaphore, (VkFence)0, // TODO: Show use of fence &demo->current_buffer); if (err == VK_ERROR_OUT_OF_DATE_KHR) { // demo->swapchain is out of date (e.g. the window was resized) and // must be recreated: demo_resize(demo); demo_draw(demo); vkDestroySemaphore(demo->device, imageAcquiredSemaphore, NULL); vkDestroySemaphore(demo->device, drawCompleteSemaphore, NULL); return; } else if (err == VK_SUBOPTIMAL_KHR) { // demo->swapchain is not as optimal as it could be, but the platform's // presentation engine will still present the image correctly. } else { assert(!err); } demo_flush_init_cmd(demo); // Wait for the present complete semaphore to be signaled to ensure // that the image won't be rendered to until the presentation // engine has fully released ownership to the application, and it is // okay to render to the image. demo_draw_build_cmd(demo); VkFence nullFence = VK_NULL_HANDLE; VkPipelineStageFlags pipe_stage_flags = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; VkSubmitInfo submit_info = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .pNext = NULL, .waitSemaphoreCount = 1, .pWaitSemaphores = &imageAcquiredSemaphore, .pWaitDstStageMask = &pipe_stage_flags, .commandBufferCount = 1, .pCommandBuffers = &demo->draw_cmd, .signalSemaphoreCount = 1, .pSignalSemaphores = &drawCompleteSemaphore}; err = vkQueueSubmit(demo->queue, 1, &submit_info, nullFence); assert(!err); VkPresentInfoKHR present = { .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, .pNext = NULL, .waitSemaphoreCount = 1, .pWaitSemaphores = &drawCompleteSemaphore, .swapchainCount = 1, .pSwapchains = &demo->swapchain, .pImageIndices = &demo->current_buffer, }; err = vkQueuePresentKHR(demo->queue, &present); if (err == VK_ERROR_OUT_OF_DATE_KHR) { // demo->swapchain is out of date (e.g. the window was resized) and // must be recreated: demo_resize(demo); } else if (err == VK_SUBOPTIMAL_KHR) { // demo->swapchain is not as optimal as it could be, but the platform's // presentation engine will still present the image correctly. } else { assert(!err); } err = vkQueueWaitIdle(demo->queue); assert(err == VK_SUCCESS); vkDestroySemaphore(demo->device, imageAcquiredSemaphore, NULL); vkDestroySemaphore(demo->device, drawCompleteSemaphore, NULL); } static void demo_prepare_buffers(struct demo *demo) { VkResult U_ASSERT_ONLY err; VkSwapchainKHR oldSwapchain = demo->swapchain; // Check the surface capabilities and formats VkSurfaceCapabilitiesKHR surfCapabilities; err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR( demo->gpu, demo->surface, &surfCapabilities); assert(!err); uint32_t presentModeCount; err = vkGetPhysicalDeviceSurfacePresentModesKHR( demo->gpu, demo->surface, &presentModeCount, NULL); assert(!err); VkPresentModeKHR *presentModes = (VkPresentModeKHR *)malloc(presentModeCount * sizeof(VkPresentModeKHR)); assert(presentModes); err = vkGetPhysicalDeviceSurfacePresentModesKHR( demo->gpu, demo->surface, &presentModeCount, presentModes); assert(!err); VkExtent2D swapchainExtent; // width and height are either both 0xFFFFFFFF, or both not 0xFFFFFFFF. if (surfCapabilities.currentExtent.width == 0xFFFFFFFF) { // If the surface size is undefined, the size is set to the size // of the images requested, which must fit within the minimum and // maximum values. swapchainExtent.width = demo->width; swapchainExtent.height = demo->height; if (swapchainExtent.width < surfCapabilities.minImageExtent.width) { swapchainExtent.width = surfCapabilities.minImageExtent.width; } else if (swapchainExtent.width > surfCapabilities.maxImageExtent.width) { swapchainExtent.width = surfCapabilities.maxImageExtent.width; } if (swapchainExtent.height < surfCapabilities.minImageExtent.height) { swapchainExtent.height = surfCapabilities.minImageExtent.height; } else if (swapchainExtent.height > surfCapabilities.maxImageExtent.height) { swapchainExtent.height = surfCapabilities.maxImageExtent.height; } } else { // If the surface size is defined, the swap chain size must match swapchainExtent = surfCapabilities.currentExtent; demo->width = surfCapabilities.currentExtent.width; demo->height = surfCapabilities.currentExtent.height; } VkPresentModeKHR swapchainPresentMode = VK_PRESENT_MODE_FIFO_KHR; // Determine the number of VkImage's to use in the swap chain. // Application desires to only acquire 1 image at a time (which is // "surfCapabilities.minImageCount"). uint32_t desiredNumOfSwapchainImages = surfCapabilities.minImageCount; // If maxImageCount is 0, we can ask for as many images as we want; // otherwise we're limited to maxImageCount if ((surfCapabilities.maxImageCount > 0) && (desiredNumOfSwapchainImages > surfCapabilities.maxImageCount)) { // Application must settle for fewer images than desired: desiredNumOfSwapchainImages = surfCapabilities.maxImageCount; } VkSurfaceTransformFlagsKHR preTransform; if (surfCapabilities.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) { preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; } else { preTransform = surfCapabilities.currentTransform; } const VkSwapchainCreateInfoKHR swapchain = { .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, .pNext = NULL, .surface = demo->surface, .minImageCount = desiredNumOfSwapchainImages, .imageFormat = demo->format, .imageColorSpace = demo->color_space, .imageExtent = { .width = swapchainExtent.width, .height = swapchainExtent.height, }, .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, .preTransform = preTransform, .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, .imageArrayLayers = 1, .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, .queueFamilyIndexCount = 0, .pQueueFamilyIndices = NULL, .presentMode = swapchainPresentMode, .oldSwapchain = oldSwapchain, .clipped = true, }; uint32_t i; err = vkCreateSwapchainKHR(demo->device, &swapchain, NULL, &demo->swapchain); assert(!err); // If we just re-created an existing swapchain, we should destroy the old // swapchain at this point. // Note: destroying the swapchain also cleans up all its associated // presentable images once the platform is done with them. if (oldSwapchain != VK_NULL_HANDLE) { vkDestroySwapchainKHR(demo->device, oldSwapchain, NULL); } err = vkGetSwapchainImagesKHR(demo->device, demo->swapchain, &demo->swapchainImageCount, NULL); assert(!err); VkImage *swapchainImages = (VkImage *)malloc(demo->swapchainImageCount * sizeof(VkImage)); assert(swapchainImages); err = vkGetSwapchainImagesKHR(demo->device, demo->swapchain, &demo->swapchainImageCount, swapchainImages); assert(!err); demo->buffers = (SwapchainBuffers *)malloc(sizeof(SwapchainBuffers) * demo->swapchainImageCount); assert(demo->buffers); for (i = 0; i < demo->swapchainImageCount; i++) { VkImageViewCreateInfo color_attachment_view = { .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .pNext = NULL, .format = demo->format, .components = { .r = VK_COMPONENT_SWIZZLE_R, .g = VK_COMPONENT_SWIZZLE_G, .b = VK_COMPONENT_SWIZZLE_B, .a = VK_COMPONENT_SWIZZLE_A, }, .subresourceRange = {.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .baseMipLevel = 0, .levelCount = 1, .baseArrayLayer = 0, .layerCount = 1}, .viewType = VK_IMAGE_VIEW_TYPE_2D, .flags = 0, }; demo->buffers[i].image = swapchainImages[i]; color_attachment_view.image = demo->buffers[i].image; err = vkCreateImageView(demo->device, &color_attachment_view, NULL, &demo->buffers[i].view); assert(!err); } demo->current_buffer = 0; if (NULL != presentModes) { free(presentModes); } } static void demo_prepare_depth(struct demo *demo) { const VkFormat depth_format = VK_FORMAT_D16_UNORM; const VkImageCreateInfo image = { .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .pNext = NULL, .imageType = VK_IMAGE_TYPE_2D, .format = depth_format, .extent = {demo->width, demo->height, 1}, .mipLevels = 1, .arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, .flags = 0, }; VkMemoryAllocateInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = NULL, .allocationSize = 0, .memoryTypeIndex = 0, }; VkImageViewCreateInfo view = { .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .pNext = NULL, .image = VK_NULL_HANDLE, .format = depth_format, .subresourceRange = {.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT, .baseMipLevel = 0, .levelCount = 1, .baseArrayLayer = 0, .layerCount = 1}, .flags = 0, .viewType = VK_IMAGE_VIEW_TYPE_2D, }; VkMemoryRequirements mem_reqs; VkResult U_ASSERT_ONLY err; bool U_ASSERT_ONLY pass; demo->depth.format = depth_format; /* create image */ err = vkCreateImage(demo->device, &image, NULL, &demo->depth.image); assert(!err); /* get memory requirements for this object */ vkGetImageMemoryRequirements(demo->device, demo->depth.image, &mem_reqs); /* select memory size and type */ mem_alloc.allocationSize = mem_reqs.size; pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, 0, /* No requirements */ &mem_alloc.memoryTypeIndex); assert(pass); /* allocate memory */ err = vkAllocateMemory(demo->device, &mem_alloc, NULL, &demo->depth.mem); assert(!err); /* bind memory */ err = vkBindImageMemory(demo->device, demo->depth.image, demo->depth.mem, 0); assert(!err); demo_set_image_layout(demo, demo->depth.image, VK_IMAGE_ASPECT_DEPTH_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, 0); /* create image view */ view.image = demo->depth.image; err = vkCreateImageView(demo->device, &view, NULL, &demo->depth.view); assert(!err); } static void demo_prepare_texture_image(struct demo *demo, const uint32_t *tex_colors, struct texture_object *tex_obj, VkImageTiling tiling, VkImageUsageFlags usage, VkFlags required_props) { const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM; const int32_t tex_width = 2; const int32_t tex_height = 2; VkResult U_ASSERT_ONLY err; bool U_ASSERT_ONLY pass; tex_obj->tex_width = tex_width; tex_obj->tex_height = tex_height; const VkImageCreateInfo image_create_info = { .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .pNext = NULL, .imageType = VK_IMAGE_TYPE_2D, .format = tex_format, .extent = {tex_width, tex_height, 1}, .mipLevels = 1, .arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = tiling, .usage = usage, .flags = 0, .initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED }; VkMemoryAllocateInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = NULL, .allocationSize = 0, .memoryTypeIndex = 0, }; VkMemoryRequirements mem_reqs; err = vkCreateImage(demo->device, &image_create_info, NULL, &tex_obj->image); assert(!err); vkGetImageMemoryRequirements(demo->device, tex_obj->image, &mem_reqs); mem_alloc.allocationSize = mem_reqs.size; pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, required_props, &mem_alloc.memoryTypeIndex); assert(pass); /* allocate memory */ err = vkAllocateMemory(demo->device, &mem_alloc, NULL, &tex_obj->mem); assert(!err); /* bind memory */ err = vkBindImageMemory(demo->device, tex_obj->image, tex_obj->mem, 0); assert(!err); if (required_props & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { const VkImageSubresource subres = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .mipLevel = 0, .arrayLayer = 0, }; VkSubresourceLayout layout; void *data; int32_t x, y; vkGetImageSubresourceLayout(demo->device, tex_obj->image, &subres, &layout); err = vkMapMemory(demo->device, tex_obj->mem, 0, mem_alloc.allocationSize, 0, &data); assert(!err); for (y = 0; y < tex_height; y++) { uint32_t *row = (uint32_t *)((char *)data + layout.rowPitch * y); for (x = 0; x < tex_width; x++) row[x] = tex_colors[(x & 1) ^ (y & 1)]; } vkUnmapMemory(demo->device, tex_obj->mem); } tex_obj->imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; demo_set_image_layout(demo, tex_obj->image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_PREINITIALIZED, tex_obj->imageLayout, VK_ACCESS_HOST_WRITE_BIT); /* setting the image layout does not reference the actual memory so no need * to add a mem ref */ } static void demo_destroy_texture_image(struct demo *demo, struct texture_object *tex_obj) { /* clean up staging resources */ vkDestroyImage(demo->device, tex_obj->image, NULL); vkFreeMemory(demo->device, tex_obj->mem, NULL); } static void demo_prepare_textures(struct demo *demo) { const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM; VkFormatProperties props; const uint32_t tex_colors[DEMO_TEXTURE_COUNT][2] = { {0xffff0000, 0xff00ff00}, }; uint32_t i; VkResult U_ASSERT_ONLY err; vkGetPhysicalDeviceFormatProperties(demo->gpu, tex_format, &props); for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { if ((props.linearTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) && !demo->use_staging_buffer) { /* Device can texture using linear textures */ demo_prepare_texture_image( demo, tex_colors[i], &demo->textures[i], VK_IMAGE_TILING_LINEAR, VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } else if (props.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) { /* Must use staging buffer to copy linear texture to optimized */ struct texture_object staging_texture; memset(&staging_texture, 0, sizeof(staging_texture)); demo_prepare_texture_image( demo, tex_colors[i], &staging_texture, VK_IMAGE_TILING_LINEAR, VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); demo_prepare_texture_image( demo, tex_colors[i], &demo->textures[i], VK_IMAGE_TILING_OPTIMAL, (VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT), VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); demo_set_image_layout(demo, staging_texture.image, VK_IMAGE_ASPECT_COLOR_BIT, staging_texture.imageLayout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 0); demo_set_image_layout(demo, demo->textures[i].image, VK_IMAGE_ASPECT_COLOR_BIT, demo->textures[i].imageLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 0); VkImageCopy copy_region = { .srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .srcOffset = {0, 0, 0}, .dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .dstOffset = {0, 0, 0}, .extent = {staging_texture.tex_width, staging_texture.tex_height, 1}, }; vkCmdCopyImage( demo->setup_cmd, staging_texture.image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, demo->textures[i].image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ©_region); demo_set_image_layout(demo, demo->textures[i].image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, demo->textures[i].imageLayout, 0); demo_flush_init_cmd(demo); demo_destroy_texture_image(demo, &staging_texture); } else { /* Can't support VK_FORMAT_B8G8R8A8_UNORM !? */ assert(!"No support for B8G8R8A8_UNORM as texture image format"); } const VkSamplerCreateInfo sampler = { .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, .pNext = NULL, .magFilter = VK_FILTER_NEAREST, .minFilter = VK_FILTER_NEAREST, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST, .addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT, .addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT, .addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT, .mipLodBias = 0.0f, .anisotropyEnable = VK_FALSE, .maxAnisotropy = 1, .compareOp = VK_COMPARE_OP_NEVER, .minLod = 0.0f, .maxLod = 0.0f, .borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE, .unnormalizedCoordinates = VK_FALSE, }; VkImageViewCreateInfo view = { .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .pNext = NULL, .image = VK_NULL_HANDLE, .viewType = VK_IMAGE_VIEW_TYPE_2D, .format = tex_format, .components = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A, }, .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, .flags = 0, }; /* create sampler */ err = vkCreateSampler(demo->device, &sampler, NULL, &demo->textures[i].sampler); assert(!err); /* create image view */ view.image = demo->textures[i].image; err = vkCreateImageView(demo->device, &view, NULL, &demo->textures[i].view); assert(!err); } } static void demo_prepare_vertices(struct demo *demo) { // clang-format off const float vb[3][5] = { /* position texcoord */ { -1.0f, -1.0f, 0.25f, 0.0f, 0.0f }, { 1.0f, -1.0f, 0.25f, 1.0f, 0.0f }, { 0.0f, 1.0f, 1.0f, 0.5f, 1.0f }, }; // clang-format on const VkBufferCreateInfo buf_info = { .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .pNext = NULL, .size = sizeof(vb), .usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, .flags = 0, }; VkMemoryAllocateInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = NULL, .allocationSize = 0, .memoryTypeIndex = 0, }; VkMemoryRequirements mem_reqs; VkResult U_ASSERT_ONLY err; bool U_ASSERT_ONLY pass; void *data; memset(&demo->vertices, 0, sizeof(demo->vertices)); err = vkCreateBuffer(demo->device, &buf_info, NULL, &demo->vertices.buf); assert(!err); vkGetBufferMemoryRequirements(demo->device, demo->vertices.buf, &mem_reqs); assert(!err); mem_alloc.allocationSize = mem_reqs.size; pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, &mem_alloc.memoryTypeIndex); assert(pass); err = vkAllocateMemory(demo->device, &mem_alloc, NULL, &demo->vertices.mem); assert(!err); err = vkMapMemory(demo->device, demo->vertices.mem, 0, mem_alloc.allocationSize, 0, &data); assert(!err); memcpy(data, vb, sizeof(vb)); vkUnmapMemory(demo->device, demo->vertices.mem); err = vkBindBufferMemory(demo->device, demo->vertices.buf, demo->vertices.mem, 0); assert(!err); demo->vertices.vi.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; demo->vertices.vi.pNext = NULL; demo->vertices.vi.vertexBindingDescriptionCount = 1; demo->vertices.vi.pVertexBindingDescriptions = demo->vertices.vi_bindings; demo->vertices.vi.vertexAttributeDescriptionCount = 2; demo->vertices.vi.pVertexAttributeDescriptions = demo->vertices.vi_attrs; demo->vertices.vi_bindings[0].binding = VERTEX_BUFFER_BIND_ID; demo->vertices.vi_bindings[0].stride = sizeof(vb[0]); demo->vertices.vi_bindings[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; demo->vertices.vi_attrs[0].binding = VERTEX_BUFFER_BIND_ID; demo->vertices.vi_attrs[0].location = 0; demo->vertices.vi_attrs[0].format = VK_FORMAT_R32G32B32_SFLOAT; demo->vertices.vi_attrs[0].offset = 0; demo->vertices.vi_attrs[1].binding = VERTEX_BUFFER_BIND_ID; demo->vertices.vi_attrs[1].location = 1; demo->vertices.vi_attrs[1].format = VK_FORMAT_R32G32_SFLOAT; demo->vertices.vi_attrs[1].offset = sizeof(float) * 3; } static void demo_prepare_descriptor_layout(struct demo *demo) { const VkDescriptorSetLayoutBinding layout_binding = { .binding = 0, .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .descriptorCount = DEMO_TEXTURE_COUNT, .stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT, .pImmutableSamplers = NULL, }; const VkDescriptorSetLayoutCreateInfo descriptor_layout = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, .pNext = NULL, .bindingCount = 1, .pBindings = &layout_binding, }; VkResult U_ASSERT_ONLY err; err = vkCreateDescriptorSetLayout(demo->device, &descriptor_layout, NULL, &demo->desc_layout); assert(!err); const VkPipelineLayoutCreateInfo pPipelineLayoutCreateInfo = { .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .pNext = NULL, .setLayoutCount = 1, .pSetLayouts = &demo->desc_layout, }; err = vkCreatePipelineLayout(demo->device, &pPipelineLayoutCreateInfo, NULL, &demo->pipeline_layout); assert(!err); } static void demo_prepare_render_pass(struct demo *demo) { const VkAttachmentDescription attachments[2] = { [0] = { .format = demo->format, .samples = VK_SAMPLE_COUNT_1_BIT, .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, .storeOp = VK_ATTACHMENT_STORE_OP_STORE, .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE, .stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE, .initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, .finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }, [1] = { .format = demo->depth.format, .samples = VK_SAMPLE_COUNT_1_BIT, .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, .storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE, .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE, .stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE, .initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, .finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, }, }; const VkAttachmentReference color_reference = { .attachment = 0, .layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }; const VkAttachmentReference depth_reference = { .attachment = 1, .layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, }; const VkSubpassDescription subpass = { .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, .flags = 0, .inputAttachmentCount = 0, .pInputAttachments = NULL, .colorAttachmentCount = 1, .pColorAttachments = &color_reference, .pResolveAttachments = NULL, .pDepthStencilAttachment = &depth_reference, .preserveAttachmentCount = 0, .pPreserveAttachments = NULL, }; const VkRenderPassCreateInfo rp_info = { .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, .pNext = NULL, .attachmentCount = 2, .pAttachments = attachments, .subpassCount = 1, .pSubpasses = &subpass, .dependencyCount = 0, .pDependencies = NULL, }; VkResult U_ASSERT_ONLY err; err = vkCreateRenderPass(demo->device, &rp_info, NULL, &demo->render_pass); assert(!err); } static VkShaderModule demo_prepare_shader_module(struct demo *demo, const void *code, size_t size) { VkShaderModuleCreateInfo moduleCreateInfo; VkShaderModule module; VkResult U_ASSERT_ONLY err; moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; moduleCreateInfo.pNext = NULL; moduleCreateInfo.codeSize = size; moduleCreateInfo.pCode = code; moduleCreateInfo.flags = 0; err = vkCreateShaderModule(demo->device, &moduleCreateInfo, NULL, &module); assert(!err); return module; } static VkShaderModule demo_prepare_vs(struct demo *demo) { size_t size = sizeof(vertShaderCode); demo->vert_shader_module = demo_prepare_shader_module(demo, vertShaderCode, size); return demo->vert_shader_module; } static VkShaderModule demo_prepare_fs(struct demo *demo) { size_t size = sizeof(fragShaderCode); demo->frag_shader_module = demo_prepare_shader_module(demo, fragShaderCode, size); return demo->frag_shader_module; } static void demo_prepare_pipeline(struct demo *demo) { VkGraphicsPipelineCreateInfo pipeline; VkPipelineCacheCreateInfo pipelineCache; VkPipelineVertexInputStateCreateInfo vi; VkPipelineInputAssemblyStateCreateInfo ia; VkPipelineRasterizationStateCreateInfo rs; VkPipelineColorBlendStateCreateInfo cb; VkPipelineDepthStencilStateCreateInfo ds; VkPipelineViewportStateCreateInfo vp; VkPipelineMultisampleStateCreateInfo ms; VkDynamicState dynamicStateEnables[VK_DYNAMIC_STATE_RANGE_SIZE]; VkPipelineDynamicStateCreateInfo dynamicState; VkResult U_ASSERT_ONLY err; memset(dynamicStateEnables, 0, sizeof dynamicStateEnables); memset(&dynamicState, 0, sizeof dynamicState); dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; dynamicState.pDynamicStates = dynamicStateEnables; memset(&pipeline, 0, sizeof(pipeline)); pipeline.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipeline.layout = demo->pipeline_layout; vi = demo->vertices.vi; memset(&ia, 0, sizeof(ia)); ia.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; ia.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; memset(&rs, 0, sizeof(rs)); rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rs.polygonMode = VK_POLYGON_MODE_FILL; rs.cullMode = VK_CULL_MODE_BACK_BIT; rs.frontFace = VK_FRONT_FACE_CLOCKWISE; rs.depthClampEnable = VK_FALSE; rs.rasterizerDiscardEnable = VK_FALSE; rs.depthBiasEnable = VK_FALSE; rs.lineWidth = 1.0f; memset(&cb, 0, sizeof(cb)); cb.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; VkPipelineColorBlendAttachmentState att_state[1]; memset(att_state, 0, sizeof(att_state)); att_state[0].colorWriteMask = 0xf; att_state[0].blendEnable = VK_FALSE; cb.attachmentCount = 1; cb.pAttachments = att_state; memset(&vp, 0, sizeof(vp)); vp.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; vp.viewportCount = 1; dynamicStateEnables[dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT; vp.scissorCount = 1; dynamicStateEnables[dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR; memset(&ds, 0, sizeof(ds)); ds.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; ds.depthTestEnable = VK_TRUE; ds.depthWriteEnable = VK_TRUE; ds.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL; ds.depthBoundsTestEnable = VK_FALSE; ds.back.failOp = VK_STENCIL_OP_KEEP; ds.back.passOp = VK_STENCIL_OP_KEEP; ds.back.compareOp = VK_COMPARE_OP_ALWAYS; ds.stencilTestEnable = VK_FALSE; ds.front = ds.back; memset(&ms, 0, sizeof(ms)); ms.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; ms.pSampleMask = NULL; ms.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; // Two stages: vs and fs pipeline.stageCount = 2; VkPipelineShaderStageCreateInfo shaderStages[2]; memset(&shaderStages, 0, 2 * sizeof(VkPipelineShaderStageCreateInfo)); shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT; shaderStages[0].module = demo_prepare_vs(demo); shaderStages[0].pName = "main"; shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; shaderStages[1].module = demo_prepare_fs(demo); shaderStages[1].pName = "main"; pipeline.pVertexInputState = &vi; pipeline.pInputAssemblyState = &ia; pipeline.pRasterizationState = &rs; pipeline.pColorBlendState = &cb; pipeline.pMultisampleState = &ms; pipeline.pViewportState = &vp; pipeline.pDepthStencilState = &ds; pipeline.pStages = shaderStages; pipeline.renderPass = demo->render_pass; pipeline.pDynamicState = &dynamicState; memset(&pipelineCache, 0, sizeof(pipelineCache)); pipelineCache.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; err = vkCreatePipelineCache(demo->device, &pipelineCache, NULL, &demo->pipelineCache); assert(!err); err = vkCreateGraphicsPipelines(demo->device, demo->pipelineCache, 1, &pipeline, NULL, &demo->pipeline); assert(!err); vkDestroyPipelineCache(demo->device, demo->pipelineCache, NULL); vkDestroyShaderModule(demo->device, demo->frag_shader_module, NULL); vkDestroyShaderModule(demo->device, demo->vert_shader_module, NULL); } static void demo_prepare_descriptor_pool(struct demo *demo) { const VkDescriptorPoolSize type_count = { .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .descriptorCount = DEMO_TEXTURE_COUNT, }; const VkDescriptorPoolCreateInfo descriptor_pool = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, .pNext = NULL, .maxSets = 1, .poolSizeCount = 1, .pPoolSizes = &type_count, }; VkResult U_ASSERT_ONLY err; err = vkCreateDescriptorPool(demo->device, &descriptor_pool, NULL, &demo->desc_pool); assert(!err); } static void demo_prepare_descriptor_set(struct demo *demo) { VkDescriptorImageInfo tex_descs[DEMO_TEXTURE_COUNT]; VkWriteDescriptorSet write; VkResult U_ASSERT_ONLY err; uint32_t i; VkDescriptorSetAllocateInfo alloc_info = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, .pNext = NULL, .descriptorPool = demo->desc_pool, .descriptorSetCount = 1, .pSetLayouts = &demo->desc_layout}; err = vkAllocateDescriptorSets(demo->device, &alloc_info, &demo->desc_set); assert(!err); memset(&tex_descs, 0, sizeof(tex_descs)); for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { tex_descs[i].sampler = demo->textures[i].sampler; tex_descs[i].imageView = demo->textures[i].view; tex_descs[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL; } memset(&write, 0, sizeof(write)); write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; write.dstSet = demo->desc_set; write.descriptorCount = DEMO_TEXTURE_COUNT; write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; write.pImageInfo = tex_descs; vkUpdateDescriptorSets(demo->device, 1, &write, 0, NULL); } static void demo_prepare_framebuffers(struct demo *demo) { VkImageView attachments[2]; attachments[1] = demo->depth.view; const VkFramebufferCreateInfo fb_info = { .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .pNext = NULL, .renderPass = demo->render_pass, .attachmentCount = 2, .pAttachments = attachments, .width = demo->width, .height = demo->height, .layers = 1, }; VkResult U_ASSERT_ONLY err; uint32_t i; demo->framebuffers = (VkFramebuffer *)malloc(demo->swapchainImageCount * sizeof(VkFramebuffer)); assert(demo->framebuffers); for (i = 0; i < demo->swapchainImageCount; i++) { attachments[0] = demo->buffers[i].view; err = vkCreateFramebuffer(demo->device, &fb_info, NULL, &demo->framebuffers[i]); assert(!err); } } static void demo_prepare(struct demo *demo) { VkResult U_ASSERT_ONLY err; const VkCommandPoolCreateInfo cmd_pool_info = { .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, .pNext = NULL, .queueFamilyIndex = demo->graphics_queue_node_index, .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, }; err = vkCreateCommandPool(demo->device, &cmd_pool_info, NULL, &demo->cmd_pool); assert(!err); const VkCommandBufferAllocateInfo cmd = { .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, .pNext = NULL, .commandPool = demo->cmd_pool, .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY, .commandBufferCount = 1, }; err = vkAllocateCommandBuffers(demo->device, &cmd, &demo->draw_cmd); assert(!err); demo_prepare_buffers(demo); demo_prepare_depth(demo); demo_prepare_textures(demo); demo_prepare_vertices(demo); demo_prepare_descriptor_layout(demo); demo_prepare_render_pass(demo); demo_prepare_pipeline(demo); demo_prepare_descriptor_pool(demo); demo_prepare_descriptor_set(demo); demo_prepare_framebuffers(demo); } static void demo_error_callback(int error, const char* description) { printf("GLFW error: %s\n", description); fflush(stdout); } static void demo_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE) glfwSetWindowShouldClose(window, GLFW_TRUE); } static void demo_refresh_callback(GLFWwindow* window) { struct demo* demo = glfwGetWindowUserPointer(window); demo_draw(demo); } static void demo_resize_callback(GLFWwindow* window, int width, int height) { struct demo* demo = glfwGetWindowUserPointer(window); demo->width = width; demo->height = height; demo_resize(demo); } static void demo_run(struct demo *demo) { while (!glfwWindowShouldClose(demo->window)) { glfwPollEvents(); demo_draw(demo); if (demo->depthStencil > 0.99f) demo->depthIncrement = -0.001f; if (demo->depthStencil < 0.8f) demo->depthIncrement = 0.001f; demo->depthStencil += demo->depthIncrement; // Wait for work to finish before updating MVP. vkDeviceWaitIdle(demo->device); demo->curFrame++; if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) glfwSetWindowShouldClose(demo->window, GLFW_TRUE); } } static void demo_create_window(struct demo *demo) { glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); demo->window = glfwCreateWindow(demo->width, demo->height, APP_LONG_NAME, NULL, NULL); if (!demo->window) { // It didn't work, so try to give a useful error: printf("Cannot create a window in which to draw!\n"); fflush(stdout); exit(1); } glfwSetWindowUserPointer(demo->window, demo); glfwSetWindowRefreshCallback(demo->window, demo_refresh_callback); glfwSetFramebufferSizeCallback(demo->window, demo_resize_callback); glfwSetKeyCallback(demo->window, demo_key_callback); } /* * Return 1 (true) if all layer names specified in check_names * can be found in given layer properties. */ static VkBool32 demo_check_layers(uint32_t check_count, const char **check_names, uint32_t layer_count, VkLayerProperties *layers) { uint32_t i, j; for (i = 0; i < check_count; i++) { VkBool32 found = 0; for (j = 0; j < layer_count; j++) { if (!strcmp(check_names[i], layers[j].layerName)) { found = 1; break; } } if (!found) { fprintf(stderr, "Cannot find layer: %s\n", check_names[i]); return 0; } } return 1; } static void demo_init_vk(struct demo *demo) { VkResult err; uint32_t i = 0; uint32_t required_extension_count = 0; uint32_t instance_extension_count = 0; uint32_t instance_layer_count = 0; uint32_t validation_layer_count = 0; const char **required_extensions = NULL; const char **instance_validation_layers = NULL; demo->enabled_extension_count = 0; demo->enabled_layer_count = 0; char *instance_validation_layers_alt1[] = { "VK_LAYER_LUNARG_standard_validation" }; char *instance_validation_layers_alt2[] = { "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain", "VK_LAYER_GOOGLE_unique_objects" }; /* Look for validation layers */ VkBool32 validation_found = 0; if (demo->validate) { err = vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL); assert(!err); instance_validation_layers = (const char**) instance_validation_layers_alt1; if (instance_layer_count > 0) { VkLayerProperties *instance_layers = malloc(sizeof (VkLayerProperties) * instance_layer_count); err = vkEnumerateInstanceLayerProperties(&instance_layer_count, instance_layers); assert(!err); validation_found = demo_check_layers( ARRAY_SIZE(instance_validation_layers_alt1), instance_validation_layers, instance_layer_count, instance_layers); if (validation_found) { demo->enabled_layer_count = ARRAY_SIZE(instance_validation_layers_alt1); demo->enabled_layers[0] = "VK_LAYER_LUNARG_standard_validation"; validation_layer_count = 1; } else { // use alternative set of validation layers instance_validation_layers = (const char**) instance_validation_layers_alt2; demo->enabled_layer_count = ARRAY_SIZE(instance_validation_layers_alt2); validation_found = demo_check_layers( ARRAY_SIZE(instance_validation_layers_alt2), instance_validation_layers, instance_layer_count, instance_layers); validation_layer_count = ARRAY_SIZE(instance_validation_layers_alt2); for (i = 0; i < validation_layer_count; i++) { demo->enabled_layers[i] = instance_validation_layers[i]; } } free(instance_layers); } if (!validation_found) { ERR_EXIT("vkEnumerateInstanceLayerProperties failed to find " "required validation layer.\n\n" "Please look at the Getting Started guide for additional " "information.\n", "vkCreateInstance Failure"); } } /* Look for instance extensions */ required_extensions = glfwGetRequiredInstanceExtensions(&required_extension_count); if (!required_extensions) { ERR_EXIT("glfwGetRequiredInstanceExtensions failed to find the " "platform surface extensions.\n\nDo you have a compatible " "Vulkan installable client driver (ICD) installed?\nPlease " "look at the Getting Started guide for additional " "information.\n", "vkCreateInstance Failure"); } for (i = 0; i < required_extension_count; i++) { demo->extension_names[demo->enabled_extension_count++] = required_extensions[i]; assert(demo->enabled_extension_count < 64); } err = vkEnumerateInstanceExtensionProperties( NULL, &instance_extension_count, NULL); assert(!err); if (instance_extension_count > 0) { VkExtensionProperties *instance_extensions = malloc(sizeof(VkExtensionProperties) * instance_extension_count); err = vkEnumerateInstanceExtensionProperties( NULL, &instance_extension_count, instance_extensions); assert(!err); for (i = 0; i < instance_extension_count; i++) { if (!strcmp(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, instance_extensions[i].extensionName)) { if (demo->validate) { demo->extension_names[demo->enabled_extension_count++] = VK_EXT_DEBUG_REPORT_EXTENSION_NAME; } } assert(demo->enabled_extension_count < 64); } free(instance_extensions); } const VkApplicationInfo app = { .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pNext = NULL, .pApplicationName = APP_SHORT_NAME, .applicationVersion = 0, .pEngineName = APP_SHORT_NAME, .engineVersion = 0, .apiVersion = VK_API_VERSION_1_0, }; VkInstanceCreateInfo inst_info = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = NULL, .pApplicationInfo = &app, .enabledLayerCount = demo->enabled_layer_count, .ppEnabledLayerNames = (const char *const *)instance_validation_layers, .enabledExtensionCount = demo->enabled_extension_count, .ppEnabledExtensionNames = (const char *const *)demo->extension_names, }; uint32_t gpu_count; err = vkCreateInstance(&inst_info, NULL, &demo->inst); if (err == VK_ERROR_INCOMPATIBLE_DRIVER) { ERR_EXIT("Cannot find a compatible Vulkan installable client driver " "(ICD).\n\nPlease look at the Getting Started guide for " "additional information.\n", "vkCreateInstance Failure"); } else if (err == VK_ERROR_EXTENSION_NOT_PRESENT) { ERR_EXIT("Cannot find a specified extension library" ".\nMake sure your layers path is set appropriately\n", "vkCreateInstance Failure"); } else if (err) { ERR_EXIT("vkCreateInstance failed.\n\nDo you have a compatible Vulkan " "installable client driver (ICD) installed?\nPlease look at " "the Getting Started guide for additional information.\n", "vkCreateInstance Failure"); } gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, demo->inst); /* Make initial call to query gpu_count, then second call for gpu info*/ err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, NULL); assert(!err && gpu_count > 0); if (gpu_count > 0) { VkPhysicalDevice *physical_devices = malloc(sizeof(VkPhysicalDevice) * gpu_count); err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, physical_devices); assert(!err); /* For tri demo we just grab the first physical device */ demo->gpu = physical_devices[0]; free(physical_devices); } else { ERR_EXIT("vkEnumeratePhysicalDevices reported zero accessible devices." "\n\nDo you have a compatible Vulkan installable client" " driver (ICD) installed?\nPlease look at the Getting Started" " guide for additional information.\n", "vkEnumeratePhysicalDevices Failure"); } gladLoadVulkanUserPtr(demo->gpu, glad_vulkan_callback, demo->inst); /* Look for device extensions */ uint32_t device_extension_count = 0; VkBool32 swapchainExtFound = 0; demo->enabled_extension_count = 0; err = vkEnumerateDeviceExtensionProperties(demo->gpu, NULL, &device_extension_count, NULL); assert(!err); if (device_extension_count > 0) { VkExtensionProperties *device_extensions = malloc(sizeof(VkExtensionProperties) * device_extension_count); err = vkEnumerateDeviceExtensionProperties( demo->gpu, NULL, &device_extension_count, device_extensions); assert(!err); for (i = 0; i < device_extension_count; i++) { if (!strcmp(VK_KHR_SWAPCHAIN_EXTENSION_NAME, device_extensions[i].extensionName)) { swapchainExtFound = 1; demo->extension_names[demo->enabled_extension_count++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME; } assert(demo->enabled_extension_count < 64); } free(device_extensions); } if (!swapchainExtFound) { ERR_EXIT("vkEnumerateDeviceExtensionProperties failed to find " "the " VK_KHR_SWAPCHAIN_EXTENSION_NAME " extension.\n\nDo you have a compatible " "Vulkan installable client driver (ICD) installed?\nPlease " "look at the Getting Started guide for additional " "information.\n", "vkCreateInstance Failure"); } if (demo->validate) { VkDebugReportCallbackCreateInfoEXT dbgCreateInfo; dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; dbgCreateInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT; dbgCreateInfo.pfnCallback = demo->use_break ? BreakCallback : dbgFunc; dbgCreateInfo.pUserData = demo; dbgCreateInfo.pNext = NULL; err = vkCreateDebugReportCallbackEXT(demo->inst, &dbgCreateInfo, NULL, &demo->msg_callback); switch (err) { case VK_SUCCESS: break; case VK_ERROR_OUT_OF_HOST_MEMORY: ERR_EXIT("CreateDebugReportCallback: out of host memory\n", "CreateDebugReportCallback Failure"); break; default: ERR_EXIT("CreateDebugReportCallback: unknown failure\n", "CreateDebugReportCallback Failure"); break; } } vkGetPhysicalDeviceProperties(demo->gpu, &demo->gpu_props); // Query with NULL data to get count vkGetPhysicalDeviceQueueFamilyProperties(demo->gpu, &demo->queue_count, NULL); demo->queue_props = (VkQueueFamilyProperties *)malloc( demo->queue_count * sizeof(VkQueueFamilyProperties)); vkGetPhysicalDeviceQueueFamilyProperties(demo->gpu, &demo->queue_count, demo->queue_props); assert(demo->queue_count >= 1); vkGetPhysicalDeviceFeatures(demo->gpu, &demo->gpu_features); // Graphics queue and MemMgr queue can be separate. // TODO: Add support for separate queues, including synchronization, // and appropriate tracking for QueueSubmit } static void demo_init_device(struct demo *demo) { VkResult U_ASSERT_ONLY err; float queue_priorities[1] = {0.0}; const VkDeviceQueueCreateInfo queue = { .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, .pNext = NULL, .queueFamilyIndex = demo->graphics_queue_node_index, .queueCount = 1, .pQueuePriorities = queue_priorities}; VkPhysicalDeviceFeatures features; memset(&features, 0, sizeof(features)); if (demo->gpu_features.shaderClipDistance) { features.shaderClipDistance = VK_TRUE; } VkDeviceCreateInfo device = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .pNext = NULL, .queueCreateInfoCount = 1, .pQueueCreateInfos = &queue, .enabledLayerCount = 0, .ppEnabledLayerNames = NULL, .enabledExtensionCount = demo->enabled_extension_count, .ppEnabledExtensionNames = (const char *const *)demo->extension_names, .pEnabledFeatures = &features, }; err = vkCreateDevice(demo->gpu, &device, NULL, &demo->device); assert(!err); } static void demo_init_vk_swapchain(struct demo *demo) { VkResult U_ASSERT_ONLY err; uint32_t i; // Create a WSI surface for the window: glfwCreateWindowSurface(demo->inst, demo->window, NULL, &demo->surface); // Iterate over each queue to learn whether it supports presenting: VkBool32 *supportsPresent = (VkBool32 *)malloc(demo->queue_count * sizeof(VkBool32)); for (i = 0; i < demo->queue_count; i++) { vkGetPhysicalDeviceSurfaceSupportKHR(demo->gpu, i, demo->surface, &supportsPresent[i]); } // Search for a graphics and a present queue in the array of queue // families, try to find one that supports both uint32_t graphicsQueueNodeIndex = UINT32_MAX; uint32_t presentQueueNodeIndex = UINT32_MAX; for (i = 0; i < demo->queue_count; i++) { if ((demo->queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) { if (graphicsQueueNodeIndex == UINT32_MAX) { graphicsQueueNodeIndex = i; } if (supportsPresent[i] == VK_TRUE) { graphicsQueueNodeIndex = i; presentQueueNodeIndex = i; break; } } } if (presentQueueNodeIndex == UINT32_MAX) { // If didn't find a queue that supports both graphics and present, then // find a separate present queue. for (i = 0; i < demo->queue_count; ++i) { if (supportsPresent[i] == VK_TRUE) { presentQueueNodeIndex = i; break; } } } free(supportsPresent); // Generate error if could not find both a graphics and a present queue if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX) { ERR_EXIT("Could not find a graphics and a present queue\n", "Swapchain Initialization Failure"); } // TODO: Add support for separate queues, including presentation, // synchronization, and appropriate tracking for QueueSubmit. // NOTE: While it is possible for an application to use a separate graphics // and a present queues, this demo program assumes it is only using // one: if (graphicsQueueNodeIndex != presentQueueNodeIndex) { ERR_EXIT("Could not find a common graphics and a present queue\n", "Swapchain Initialization Failure"); } demo->graphics_queue_node_index = graphicsQueueNodeIndex; demo_init_device(demo); vkGetDeviceQueue(demo->device, demo->graphics_queue_node_index, 0, &demo->queue); // Get the list of VkFormat's that are supported: uint32_t formatCount; err = vkGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface, &formatCount, NULL); assert(!err); VkSurfaceFormatKHR *surfFormats = (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR)); err = vkGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface, &formatCount, surfFormats); assert(!err); // If the format list includes just one entry of VK_FORMAT_UNDEFINED, // the surface has no preferred format. Otherwise, at least one // supported format will be returned. if (formatCount == 1 && surfFormats[0].format == VK_FORMAT_UNDEFINED) { demo->format = VK_FORMAT_B8G8R8A8_UNORM; } else { assert(formatCount >= 1); demo->format = surfFormats[0].format; } demo->color_space = surfFormats[0].colorSpace; demo->curFrame = 0; // Get Memory information and properties vkGetPhysicalDeviceMemoryProperties(demo->gpu, &demo->memory_properties); } static void demo_init_connection(struct demo *demo) { glfwSetErrorCallback(demo_error_callback); if (!glfwInit()) { printf("Cannot initialize GLFW.\nExiting ...\n"); fflush(stdout); exit(1); } if (!glfwVulkanSupported()) { printf("GLFW failed to find the Vulkan loader.\nExiting ...\n"); fflush(stdout); exit(1); } gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL); } static void demo_init(struct demo *demo, const int argc, const char *argv[]) { int i; memset(demo, 0, sizeof(*demo)); demo->frameCount = INT32_MAX; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--use_staging") == 0) { demo->use_staging_buffer = true; continue; } if (strcmp(argv[i], "--break") == 0) { demo->use_break = true; continue; } if (strcmp(argv[i], "--validate") == 0) { demo->validate = true; continue; } if (strcmp(argv[i], "--c") == 0 && demo->frameCount == INT32_MAX && i < argc - 1 && sscanf(argv[i + 1], "%d", &demo->frameCount) == 1 && demo->frameCount >= 0) { i++; continue; } fprintf(stderr, "Usage:\n %s [--use_staging] [--validate] [--break] " "[--c ]\n", APP_SHORT_NAME); fflush(stderr); exit(1); } demo_init_connection(demo); demo_init_vk(demo); demo->width = 300; demo->height = 300; demo->depthStencil = 1.0; demo->depthIncrement = -0.01f; } static void demo_cleanup(struct demo *demo) { uint32_t i; for (i = 0; i < demo->swapchainImageCount; i++) { vkDestroyFramebuffer(demo->device, demo->framebuffers[i], NULL); } free(demo->framebuffers); vkDestroyDescriptorPool(demo->device, demo->desc_pool, NULL); if (demo->setup_cmd) { vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->setup_cmd); } vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->draw_cmd); vkDestroyCommandPool(demo->device, demo->cmd_pool, NULL); vkDestroyPipeline(demo->device, demo->pipeline, NULL); vkDestroyRenderPass(demo->device, demo->render_pass, NULL); vkDestroyPipelineLayout(demo->device, demo->pipeline_layout, NULL); vkDestroyDescriptorSetLayout(demo->device, demo->desc_layout, NULL); vkDestroyBuffer(demo->device, demo->vertices.buf, NULL); vkFreeMemory(demo->device, demo->vertices.mem, NULL); for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { vkDestroyImageView(demo->device, demo->textures[i].view, NULL); vkDestroyImage(demo->device, demo->textures[i].image, NULL); vkFreeMemory(demo->device, demo->textures[i].mem, NULL); vkDestroySampler(demo->device, demo->textures[i].sampler, NULL); } for (i = 0; i < demo->swapchainImageCount; i++) { vkDestroyImageView(demo->device, demo->buffers[i].view, NULL); } vkDestroyImageView(demo->device, demo->depth.view, NULL); vkDestroyImage(demo->device, demo->depth.image, NULL); vkFreeMemory(demo->device, demo->depth.mem, NULL); vkDestroySwapchainKHR(demo->device, demo->swapchain, NULL); free(demo->buffers); vkDestroyDevice(demo->device, NULL); if (demo->validate) { vkDestroyDebugReportCallbackEXT(demo->inst, demo->msg_callback, NULL); } vkDestroySurfaceKHR(demo->inst, demo->surface, NULL); vkDestroyInstance(demo->inst, NULL); free(demo->queue_props); glfwDestroyWindow(demo->window); glfwTerminate(); } static void demo_resize(struct demo *demo) { uint32_t i; // In order to properly resize the window, we must re-create the swapchain // AND redo the command buffers, etc. // // First, perform part of the demo_cleanup() function: for (i = 0; i < demo->swapchainImageCount; i++) { vkDestroyFramebuffer(demo->device, demo->framebuffers[i], NULL); } free(demo->framebuffers); vkDestroyDescriptorPool(demo->device, demo->desc_pool, NULL); if (demo->setup_cmd) { vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->setup_cmd); demo->setup_cmd = VK_NULL_HANDLE; } vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->draw_cmd); vkDestroyCommandPool(demo->device, demo->cmd_pool, NULL); vkDestroyPipeline(demo->device, demo->pipeline, NULL); vkDestroyRenderPass(demo->device, demo->render_pass, NULL); vkDestroyPipelineLayout(demo->device, demo->pipeline_layout, NULL); vkDestroyDescriptorSetLayout(demo->device, demo->desc_layout, NULL); vkDestroyBuffer(demo->device, demo->vertices.buf, NULL); vkFreeMemory(demo->device, demo->vertices.mem, NULL); for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { vkDestroyImageView(demo->device, demo->textures[i].view, NULL); vkDestroyImage(demo->device, demo->textures[i].image, NULL); vkFreeMemory(demo->device, demo->textures[i].mem, NULL); vkDestroySampler(demo->device, demo->textures[i].sampler, NULL); } for (i = 0; i < demo->swapchainImageCount; i++) { vkDestroyImageView(demo->device, demo->buffers[i].view, NULL); } vkDestroyImageView(demo->device, demo->depth.view, NULL); vkDestroyImage(demo->device, demo->depth.image, NULL); vkFreeMemory(demo->device, demo->depth.mem, NULL); free(demo->buffers); // Second, re-perform the demo_prepare() function, which will re-create the // swapchain: demo_prepare(demo); } int main(const int argc, const char *argv[]) { struct demo demo; demo_init(&demo, argc, argv); demo_create_window(&demo); demo_init_vk_swapchain(&demo); demo_prepare(&demo); demo_run(&demo); demo_cleanup(&demo); return validation_error; } ================================================ FILE: thirdparty/glfw/tests/windows.c ================================================ //======================================================================== // Simple multi-window test // Copyright (c) Camilla Löwy // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== // // This test creates four windows and clears each in a different color // //======================================================================== #include #define GLFW_INCLUDE_NONE #include #include #include #include "getopt.h" static const char* titles[] = { "Red", "Green", "Blue", "Yellow" }; static const struct { float r, g, b; } colors[] = { { 0.95f, 0.32f, 0.11f }, { 0.50f, 0.80f, 0.16f }, { 0.f, 0.68f, 0.94f }, { 0.98f, 0.74f, 0.04f } }; static void usage(void) { printf("Usage: windows [-h] [-b] [-f] \n"); printf("Options:\n"); printf(" -b create decorated windows\n"); printf(" -f set focus on show off for all but first window\n"); printf(" -h show this help\n"); } static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (action != GLFW_PRESS) return; switch (key) { case GLFW_KEY_SPACE: { int xpos, ypos; glfwGetWindowPos(window, &xpos, &ypos); glfwSetWindowPos(window, xpos, ypos); break; } case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, GLFW_TRUE); break; } } int main(int argc, char** argv) { int i, ch; int decorated = GLFW_FALSE; int focusOnShow = GLFW_TRUE; int running = GLFW_TRUE; GLFWwindow* windows[4]; while ((ch = getopt(argc, argv, "bfh")) != -1) { switch (ch) { case 'b': decorated = GLFW_TRUE; break; case 'f': focusOnShow = GLFW_FALSE; break; case 'h': usage(); exit(EXIT_SUCCESS); default: usage(); exit(EXIT_FAILURE); } } glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); glfwWindowHint(GLFW_DECORATED, decorated); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); for (i = 0; i < 4; i++) { int left, top, right, bottom; if (i) glfwWindowHint(GLFW_FOCUS_ON_SHOW, focusOnShow); windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL); if (!windows[i]) { glfwTerminate(); exit(EXIT_FAILURE); } glfwSetKeyCallback(windows[i], key_callback); glfwMakeContextCurrent(windows[i]); gladLoadGL(glfwGetProcAddress); glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f); glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom); glfwSetWindowPos(windows[i], 100 + (i & 1) * (200 + left + right), 100 + (i >> 1) * (200 + top + bottom)); } for (i = 0; i < 4; i++) glfwShowWindow(windows[i]); while (running) { for (i = 0; i < 4; i++) { glfwMakeContextCurrent(windows[i]); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(windows[i]); if (glfwWindowShouldClose(windows[i])) running = GLFW_FALSE; } glfwWaitEvents(); } glfwTerminate(); exit(EXIT_SUCCESS); } ================================================ FILE: thirdparty/portaudio/.editorconfig ================================================ # EditorConfig info: https://editorconfig.org/ root = true [Makefile*] indent_style = tab [*.{c,cpp,h,cxx,hxx}] indent_style = space indent_size = 4 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true max_line_length = 120 ================================================ FILE: thirdparty/portaudio/.gitattributes ================================================ # Set the default behavior, in case people don't have core.autocrlf set. * text=auto # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. *.c text *.h text *.cpp text *.hpp text *.fth text *.java text *.f text *.txt text *.dox text *.m text # Declare files that will always have CRLF line endings on checkout. *.sln text eol=crlf *.def text eol=crlf *.dsp text eol=crlf *.dsw text eol=crlf *.vcproj text eol=crlf *.sln text eol=crlf *.doc text eol=crlf *.bat text eol=crlf # Denote all files that are truly binary and should not be modified. *.dic binary *.odt binary *.pdf binary *.png binary *.jpg binary *.wav binary *.la binary config.guess binary config.status binary config.sub binary configure binary depcomp binary install-sh binary libtool binary missing binary ================================================ FILE: thirdparty/portaudio/.github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- (Please use the mailing list for support requests and general discussion. This is only for actual bugs.) **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior. Include code if applicable. 1. **Expected behavior** A clear and concise description of what you expected to happen. **Actual behavior** What actually happened. Include a recording if helpful. Error messages or logs longer than a page should be attached as a .txt file. **Desktop (please complete the following information):** - OS: [e.g. Mac OS] - OS Version [e.g. 22] - PortAudio version: stable, nightly snapshot (which?), current (please give date and/or Git hash): - If Windows or Linux, which Host API (e.g. WASAPI): **Additional context** Add any other context about the problem here. ================================================ FILE: thirdparty/portaudio/.github/workflows/MSBuild.yml ================================================ name: MSBuild MSVC Project File CI on: [push, pull_request] env: # Path to the solution file relative to the root of the project. SOLUTION_FILE_PATH: ./build/msvc/portaudio.sln VCPROJ_FILE_PATH: ./build/msvc/portaudio.vcproj VCXPROJ_FILE_PATH: ./build/msvc/portaudio.vcxproj VCXPROJ_FILTERS_FILE_PATH: ./build/msvc/portaudio.vcxproj.filters VCXPROJ_USER_FILE_PATH: ./build/msvc/portaudio.vcxproj.user DEF_FILE_PATH: ./build/msvc/portaudio.def jobs: build: runs-on: windows-latest strategy: matrix: BUILD_CONFIGURATION: [Release] BUILD_PLATFORM: [Win32, x64] steps: - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1 - uses: actions/checkout@v2 - name: Upgrade VC Project File # We maintain our vcproj file in an old format to maintain backwards compatibility # This step upgrades the project to the latest version of MSVC # see https://docs.microsoft.com/en-us/visualstudio/ide/reference/upgrade-devenv-exe?view=vs-2019 # pipe to file to ensure that it terminates https://stackoverflow.com/questions/48896010/occasionally-occurring-msbuild-error-msb3428/48918105#48918105 # discussion of using vswhere.exe here: https://stackoverflow.com/questions/65287456/how-to-upgrade-a-visual-studio-project-from-within-a-github-action/65311868#65311868 run: | $devenv = & vswhere.exe '-property' productPath Write-Output "$devenv" & $devenv "${{env.VCPROJ_FILE_PATH}}" /Upgrade /NoSplash | Out-Null Write-Output "devenv launched" while (!(Test-Path "${{env.VCXPROJ_FILE_PATH}}")) { Start-Sleep -Seconds 10 } Write-Output "vcxproj found" while (!(Test-Path "${{env.VCXPROJ_FILTERS_FILE_PATH}}")) { Start-Sleep -Seconds 10 } Write-Output "vcxproj.filters found" Start-Sleep -Seconds 10 Write-Output "done." - name: Remove ASIO Files and Enable PA_USE_DS=1 # Process the project files to remove ASIO-related sources and includes (since we can not access the ASIO SDK in a public build) run: | # Process .vcxproj file: remove source files $xdoc = new-object System.Xml.XmlDocument $vcxprojFile = resolve-path("${{env.VCXPROJ_FILE_PATH}}") $xdoc.load($vcxprojFile) $namespace = New-Object -TypeName "Xml.XmlNamespaceManager" -ArgumentList $xdoc.NameTable $namespace.AddNamespace("vs", $xdoc.DocumentElement.NamespaceURI) $nodes = $xdoc.SelectNodes("//vs:ClCompile[contains(@Include, '..\src\hostapi\asio')]", $namespace) Write-Output "deleting ASIO related compilation nodes from .vcxproj:" Write-Output $nodes ForEach($node in $nodes) { $parent = $node.ParentNode $parent.RemoveChild($node) } # Enable DirectSound host API $nodes = $xdoc.SelectNodes("//vs:PreprocessorDefinitions[contains(., 'PA_USE_DS=0')]", $namespace) ForEach($node in $nodes) { $text = $node.InnerText $node.InnerText = $text -replace 'PA_USE_DS=0', 'PA_USE_DS=1' } $xdoc.save($vcxprojFile) # Process .vcxproj.filters file: remove source files and includes $vcxprojFiltersFile = resolve-path("${{env.VCXPROJ_FILTERS_FILE_PATH}}") $xdoc.load($vcxprojFiltersFile) $namespace = New-Object -TypeName "Xml.XmlNamespaceManager" -ArgumentList $xdoc.NameTable $namespace.AddNamespace("vs", $xdoc.DocumentElement.NamespaceURI) $nodes = $xdoc.SelectNodes("//vs:ClCompile[contains(@Include, '..\src\hostapi\asio')]", $namespace) Write-Output "deleting ASIO related compilation nodes from .vcxproj.filters:" Write-Output $nodes ForEach($node in $nodes) { $parent = $node.ParentNode $parent.RemoveChild($node) } $nodes = $xdoc.SelectNodes("//vs:ClInclude[contains(@Include, 'pa_asio.h')]", $namespace) Write-Output "deleting ASIO related include nodes from .vcxproj.filters:" Write-Output $nodes ForEach($node in $nodes) { $parent = $node.ParentNode $parent.RemoveChild($node) } $xdoc.save($vcxprojFiltersFile) # Process .def file: remove PaAsio_ symbols Set-Content -Path "${{env.DEF_FILE_PATH}}" -Value (Get-Content -Path "${{env.DEF_FILE_PATH}}" | Select-String -Pattern 'PaAsio_' -NotMatch) - name: Build working-directory: ${{env.GITHUB_WORKSPACE}} # Add additional options to the MSBuild command line here (like platform or verbosity level). # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference run: msbuild /m /p:Configuration=${{matrix.BUILD_CONFIGURATION}} /p:Platform=${{matrix.BUILD_PLATFORM}} ${{env.VCXPROJ_FILE_PATH}} ================================================ FILE: thirdparty/portaudio/.github/workflows/c-cpp.yml ================================================ name: C/C++ CI on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: configure run: ./configure - name: make run: make build-cmake: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: cmake run: cmake . - name: make run: make build-cmake-msvc: runs-on: windows-latest steps: - uses: actions/checkout@v1 - name: cmake run: cmake . - name: build run: cmake --build . build-cmake-mingw: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: apt run: sudo apt-get install mingw-w64 - name: cmake run: cmake -DCMAKE_TOOLCHAIN_FILE=i686-w64-mingw32.cmake . - name: make run: make ================================================ FILE: thirdparty/portaudio/.gitignore ================================================ # Compiled Object files *.slo *.lo *.o *.obj # annoying files **/.DS_Store # Generated by configure and make Makefile bin-stamp bin/* config.log config.status lib-stamp lib/* libtool portaudio-2.0.pc autom4te.cache/* # Precompiled Headers *.gch *.pch # Compiled Dynamic libraries *.so *.dylib *.dll # Fortran module files *.mod # Compiled Static libraries *.lai *.la *.a *.lib # Executables *.exe *.out *.app # Visual Studio 2017/2019 state folder .vs/ # Visual Studio CMake build output folder out/ # Visual Studio CMake settings file CMakeSettings.json ================================================ FILE: thirdparty/portaudio/CMakeLists.txt ================================================ # $Id: $ # # For a "How-To" please refer to the Portaudio documentation at: # http://www.portaudio.com/trac/wiki/TutorialDir/Compile/CMake # CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # Check if the user is building PortAudio stand-alone or as part of a larger # project. If this is part of a larger project (i.e. the CMakeLists.txt has # been imported by some other CMakeLists.txt), we don't want to trump over # the top of that project's global settings. IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR}) PROJECT(portaudio) # CMAKE_CONFIGURATION_TYPES only exists for multi-config generators (like # Visual Studio or Xcode). For these projects, we won't define # CMAKE_BUILD_TYPE as it does not make sense. IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) MESSAGE(STATUS "Setting CMAKE_BUILD_TYPE type to 'Debug' as none was specified.") SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") ENDIF() SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) IF(WIN32 AND MSVC) OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON) IF(PA_DLL_LINK_WITH_STATIC_RUNTIME) FOREACH(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) IF(${flag_var} MATCHES "/MD") STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") ENDIF() ENDFOREACH() ENDIF() ENDIF() ENDIF() SET(PA_VERSION 19) SET(PA_PKGCONFIG_VERSION ${PA_VERSION}) SET(PA_SOVERSION "${PA_VERSION}.0") # Most of the code from this point onwards is related to populating the # following variables: # PA_PUBLIC_INCLUDES - This contains the list of public PortAudio header # files. These files will be copied into /include paths on Unix'y # systems when "make install" is invoked. # PA_PRIVATE_INCLUDES - This contains the list of header files which # are not part of PortAudio, but are required by the various hostapis. # It is only used by CMake IDE generators (like Visual Studio) to # provide quick-links to useful headers. It has no impact on build # output. # PA_PRIVATE_INCLUDE_PATHS - This contains the list of include paths which # will be passed to the compiler while PortAudio is being built which # are not required by applications using the PortAudio API. # PA_PRIVATE_COMPILE_DEFINITIONS - This contains a list of preprocessor # macro definitions which will be set when compiling PortAudio source # files. # PA_SOURCES - This contains the list of source files which will be built # into the static and shared PortAudio libraries. # PA_NON_UNICODE_SOURCES - This also contains a list of source files which # will be build into the static and shared PortAudio libraries. However, # these sources will not have any unicode compiler definitions added # to them. This list should only contain external source dependencies. # PA_EXTRA_SHARED_SOURCES - Contains a list of extra files which will be # associated only with the shared PortAudio library. This only seems # relevant for Windows shared libraries which require a list of export # symbols. # Where other PA_* variables are set, these are almost always only used to # preserve the historic SOURCE_GROUP behavior (which again only has an impact # on IDE-style generators for visual appearance) or store the output of # find_library() calls. SET(PA_COMMON_INCLUDES src/common/pa_allocation.h src/common/pa_converters.h src/common/pa_cpuload.h src/common/pa_debugprint.h src/common/pa_dither.h src/common/pa_endianness.h src/common/pa_hostapi.h src/common/pa_memorybarrier.h src/common/pa_process.h src/common/pa_ringbuffer.h src/common/pa_stream.h src/common/pa_trace.h src/common/pa_types.h src/common/pa_util.h ) SET(PA_COMMON_SOURCES src/common/pa_allocation.c src/common/pa_converters.c src/common/pa_cpuload.c src/common/pa_debugprint.c src/common/pa_dither.c src/common/pa_front.c src/common/pa_process.c src/common/pa_ringbuffer.c src/common/pa_stream.c src/common/pa_trace.c ) SOURCE_GROUP("common" FILES ${PA_COMMON_INCLUDES} ${PA_COMMON_SOURCES}) SET(PA_PUBLIC_INCLUDES include/portaudio.h) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake_support) SET(PA_SKELETON_SOURCES src/hostapi/skeleton/pa_hostapi_skeleton.c) SOURCE_GROUP("hostapi\\skeleton" ${PA_SKELETON_SOURCES}) SET(PA_SOURCES ${PA_COMMON_SOURCES} ${PA_SKELETON_SOURCES}) SET(PA_PRIVATE_INCLUDE_PATHS src/common ${CMAKE_CURRENT_BINARY_DIR}) IF(WIN32) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} _CRT_SECURE_NO_WARNINGS) SET(PA_PLATFORM_SOURCES src/os/win/pa_win_hostapis.c src/os/win/pa_win_util.c src/os/win/pa_win_waveformat.c src/os/win/pa_win_wdmks_utils.c src/os/win/pa_win_coinitialize.c) SET(PA_PLATFORM_INCLUDES src/os/win/pa_win_coinitialize.h src/os/win/pa_win_wdmks_utils.h) IF(MSVC) SET(PA_PLATFORM_SOURCES ${PA_PLATFORM_SOURCES} src/os/win/pa_x86_plain_converters.c) SET(PA_PLATFORM_INCLUDES ${PA_PLATFORM_INCLUDES} src/os/win/pa_x86_plain_converters.h) ELSE() SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} _WIN32_WINNT=0x0501 WINVER=0x0501) SET(DEF_EXCLUDE_X86_PLAIN_CONVERTERS ";") ENDIF() SOURCE_GROUP("os\\win" FILES ${PA_PLATFORM_SOURCES} ${PA_PLATFORM_INCLUDES}) SET(PA_SOURCES ${PA_SOURCES} ${PA_PLATFORM_SOURCES}) SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_PLATFORM_INCLUDES}) SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} src/os/win) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} winmm) # Try to find ASIO SDK (assumes that portaudio and asiosdk folders are side-by-side, see # http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC) FIND_PACKAGE(ASIOSDK) IF(ASIOSDK_FOUND) OPTION(PA_USE_ASIO "Enable support for ASIO" ON) ELSE() OPTION(PA_USE_ASIO "Enable support for ASIO" OFF) ENDIF() IF(PA_USE_ASIO) SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ASIOSDK_ROOT_DIR}/common) SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ASIOSDK_ROOT_DIR}/host) SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ASIOSDK_ROOT_DIR}/host/pc) SET(PA_ASIO_SOURCES src/hostapi/asio/pa_asio.cpp src/hostapi/asio/iasiothiscallresolver.cpp) SET(PA_ASIOSDK_SOURCES ${ASIOSDK_ROOT_DIR}/common/asio.cpp ${ASIOSDK_ROOT_DIR}/host/pc/asiolist.cpp ${ASIOSDK_ROOT_DIR}/host/asiodrivers.cpp) SOURCE_GROUP("hostapi\\ASIO" FILES ${PA_ASIO_SOURCES}) SOURCE_GROUP("hostapi\\ASIO\\ASIOSDK" FILES ${PA_ASIOSDK_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_asio.h) SET(PA_SOURCES ${PA_SOURCES} ${PA_ASIO_SOURCES}) SET(PA_NON_UNICODE_SOURCES ${PA_NON_UNICODE_SOURCES} ${PA_ASIOSDK_SOURCES}) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid) ELSE() # Set variables for DEF file expansion SET(DEF_EXCLUDE_ASIO_SYMBOLS ";") ENDIF() OPTION(PA_USE_DS "Enable support for DirectSound" ON) IF(PA_USE_DS) IF(MINGW) MESSAGE(STATUS "DirectSound support will be built with DSound provided by MinGW.") OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" OFF) ELSE(MINGW) OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON) ENDIF(MINGW) MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE) IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE) ENDIF() SET(PA_DS_INCLUDES src/hostapi/dsound/pa_win_ds_dynlink.h) SET(PA_DS_SOURCES src/hostapi/dsound/pa_win_ds.c src/hostapi/dsound/pa_win_ds_dynlink.c) SOURCE_GROUP("hostapi\\dsound" FILES ${PA_DS_INCLUDES} ${PA_DS_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_ds.h include/pa_win_waveformat.h) SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_DS_INCLUDES}) SET(PA_SOURCES ${PA_SOURCES} ${PA_DS_SOURCES}) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} dsound) ENDIF(PA_USE_DS) OPTION(PA_USE_WMME "Enable support for MME" ON) IF(PA_USE_WMME) SET(PA_WMME_SOURCES src/hostapi/wmme/pa_win_wmme.c) SOURCE_GROUP("hostapi\\wmme" FILES ${PA_WMME_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wmme.h include/pa_win_waveformat.h) SET(PA_SOURCES ${PA_SOURCES} ${PA_WMME_SOURCES}) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid) ENDIF() # MinGW versions below 4.93, especially non MinGW-w64 distributions may # break in the wasapi build. If an older MinGW version is required, WASAPI- # support needs to be disabled. OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON) IF(PA_USE_WASAPI) SET(PA_WASAPI_SOURCES src/hostapi/wasapi/pa_win_wasapi.c) SOURCE_GROUP("hostapi\\wasapi" FILES ${PA_WASAPI_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wasapi.h include/pa_win_waveformat.h) SET(PA_SOURCES ${PA_SOURCES} ${PA_WASAPI_SOURCES}) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid) ELSE() SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";") ENDIF() OPTION(PA_USE_WDMKS "Enable support for WDMKS" ON) IF(PA_USE_WDMKS) SET(PA_WDMKS_SOURCES src/hostapi/wdmks/pa_win_wdmks.c) SOURCE_GROUP("hostapi\\wdmks" FILES ${PA_WDMKS_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wdmks.h) SET(PA_SOURCES ${PA_SOURCES} ${PA_WDMKS_SOURCES}) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} setupapi ole32 uuid) ENDIF() OPTION(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON) MARK_AS_ADVANCED(PA_USE_WDMKS_DEVICE_INFO) IF(PA_USE_WDMKS_DEVICE_INFO) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PAWIN_USE_WDMKS_DEVICE_INFO) ENDIF() SET(GENERATED_MESSAGE "CMake generated file, do NOT edit! Use CMake-GUI to change configuration instead.") CONFIGURE_FILE(cmake_support/template_portaudio.def ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def @ONLY) CONFIGURE_FILE(cmake_support/options_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h @ONLY) SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PORTAUDIO_CMAKE_GENERATED) SOURCE_GROUP("cmake_generated" FILES ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h) SET(PA_EXTRA_SHARED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def) ELSE() SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} src/os/unix) SET(PA_PLATFORM_SOURCES src/os/unix/pa_unix_hostapis.c src/os/unix/pa_unix_util.c) SOURCE_GROUP("os\\unix" FILES ${PA_PLATFORM_SOURCES}) SET(PA_SOURCES ${PA_SOURCES} ${PA_PLATFORM_SOURCES}) IF(APPLE) SET(CMAKE_MACOSX_RPATH 1) OPTION(PA_USE_COREAUDIO "Enable support for CoreAudio" ON) IF(PA_USE_COREAUDIO) SET(PA_COREAUDIO_SOURCES src/hostapi/coreaudio/pa_mac_core.c src/hostapi/coreaudio/pa_mac_core_blocking.c src/hostapi/coreaudio/pa_mac_core_utilities.c) SET(PA_COREAUDIO_INCLUDES src/hostapi/coreaudio/pa_mac_core_blocking.h src/hostapi/coreaudio/pa_mac_core_utilities.h) SOURCE_GROUP("hostapi\\coreaudio" FILES ${PA_COREAUDIO_SOURCES} ${PA_COREAUDIO_INCLUDES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_mac_core.h) SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_COREAUDIO_INCLUDES}) SET(PA_SOURCES ${PA_SOURCES} ${PA_COREAUDIO_SOURCES}) FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio REQUIRED) FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY AudioToolbox REQUIRED) FIND_LIBRARY(AUDIOUNIT_LIBRARY AudioUnit REQUIRED) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED) FIND_LIBRARY(CORESERVICES_LIBRARY CoreServices REQUIRED) MARK_AS_ADVANCED(COREAUDIO_LIBRARY AUDIOTOOLBOX_LIBRARY AUDIOUNIT_LIBRARY COREFOUNDATION_LIBRARY CORESERVICES_LIBRARY) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${COREAUDIO_LIBRARY} ${AUDIOTOOLBOX_LIBRARY} ${AUDIOUNIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${CORESERVICES_LIBRARY}) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_COREAUDIO) SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreFoundation -framework CoreServices") ENDIF() ELSEIF(UNIX) FIND_PACKAGE(Jack) IF(JACK_FOUND) OPTION(PA_USE_JACK "Enable support for Jack" ON) ELSE() OPTION(PA_USE_JACK "Enable support for Jack" OFF) ENDIF() IF(PA_USE_JACK) SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${JACK_INCLUDE_DIRS}) SET(PA_JACK_SOURCES src/hostapi/jack/pa_jack.c) SOURCE_GROUP("hostapi\\JACK" FILES ${PA_JACK_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_jack.h) SET(PA_SOURCES ${PA_SOURCES} ${PA_JACK_SOURCES}) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_JACK) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${JACK_LIBRARIES}) SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -ljack") ENDIF() FIND_PACKAGE(ALSA) IF(ALSA_FOUND) OPTION(PA_USE_ALSA "Enable support for ALSA" ON) OPTION(PA_ALSA_DYNAMIC "Enable loading ALSA through dlopen" OFF) ELSE() OPTION(PA_USE_ALSA "Enable support for ALSA" OFF) ENDIF() IF(PA_USE_ALSA) SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ALSA_INCLUDE_DIRS}) SET(PA_ALSA_SOURCES src/hostapi/alsa/pa_linux_alsa.c) SOURCE_GROUP("hostapi\\ALSA" FILES ${PA_ALSA_SOURCES}) SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_linux_alsa.h) SET(PA_SOURCES ${PA_SOURCES} ${PA_ALSA_SOURCES}) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_ALSA) IF(PA_ALSA_DYNAMIC) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_ALSA_DYNAMIC) SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${CMAKE_DL_LIBS}) SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -l${CMAKE_DL_LIBS}") ELSE() SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${ALSA_LIBRARIES}) SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -lasound") ENDIF() ENDIF() ENDIF() SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -lm -lpthread") SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} m pthread) ENDIF() SOURCE_GROUP("include" FILES ${PA_PUBLIC_INCLUDES}) SET(PA_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_PUBLIC_INCLUDES}) IF(WIN32) OPTION(PA_UNICODE_BUILD "Enable Portaudio Unicode build" ON) IF(PA_UNICODE_BUILD) SET_SOURCE_FILES_PROPERTIES(${PA_SOURCES} PROPERTIES COMPILE_DEFINITIONS "UNICODE;_UNICODE") ENDIF() ENDIF() OPTION(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF) IF(PA_ENABLE_DEBUG_OUTPUT) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_ENABLE_DEBUG_OUTPUT) ENDIF() INCLUDE(TestBigEndian) TEST_BIG_ENDIAN(IS_BIG_ENDIAN) IF(IS_BIG_ENDIAN) SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_BIG_ENDIAN) ELSE() SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_LITTLE_ENDIAN) ENDIF() OPTION(PA_BUILD_STATIC "Build static library" ON) OPTION(PA_BUILD_SHARED "Build shared/dynamic library" ON) IF(MSVC) OPTION(PA_LIBNAME_ADD_SUFFIX "Add suffix _static to static library name" ON) ELSE() OPTION(PA_LIBNAME_ADD_SUFFIX "Add suffix _static to static library name" OFF) ENDIF() # MSVC: if PA_LIBNAME_ADD_SUFFIX is not used, and both static and shared libraries are # built, one, of import- and static libraries, will overwrite the other. In # embedded builds this is not an issue as they will only build the configuration # used in the host application. MARK_AS_ADVANCED(PA_LIBNAME_ADD_SUFFIX) IF(MSVC AND PA_BUILD_STATIC AND PA_BUILD_SHARED AND NOT PA_LIBNAME_ADD_SUFFIX) MESSAGE(WARNING "Building both shared and static libraries, and avoiding the suffix _static will lead to a name conflict") SET(PA_LIBNAME_ADD_SUFFIX ON CACHE BOOL "Forcing use of suffix _static to avoid name conflict between static and import library" FORCE) MESSAGE(WARNING "PA_LIBNAME_ADD_SUFFIX was set to ON") ENDIF() SET(PA_TARGETS "") IF(PA_BUILD_SHARED) LIST(APPEND PA_TARGETS portaudio) ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES} ${PA_EXTRA_SHARED_SOURCES}) SET_PROPERTY(TARGET portaudio APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS}) TARGET_INCLUDE_DIRECTORIES(portaudio PRIVATE ${PA_PRIVATE_INCLUDE_PATHS}) TARGET_INCLUDE_DIRECTORIES(portaudio PUBLIC "$" "$") TARGET_LINK_LIBRARIES(portaudio ${PA_LIBRARY_DEPENDENCIES}) ENDIF() IF(PA_BUILD_STATIC) LIST(APPEND PA_TARGETS portaudio_static) ADD_LIBRARY(portaudio_static STATIC ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES}) SET_PROPERTY(TARGET portaudio_static APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS}) TARGET_INCLUDE_DIRECTORIES(portaudio_static PRIVATE ${PA_PRIVATE_INCLUDE_PATHS}) TARGET_INCLUDE_DIRECTORIES(portaudio_static PUBLIC "$" "$") TARGET_LINK_LIBRARIES(portaudio_static ${PA_LIBRARY_DEPENDENCIES}) IF(NOT PA_LIBNAME_ADD_SUFFIX) SET_PROPERTY(TARGET portaudio_static PROPERTY OUTPUT_NAME portaudio) ENDIF() ENDIF() IF(WIN32 AND MSVC) OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF) IF(CMAKE_CL_64) SET(TARGET_POSTFIX x64) IF(PA_CONFIG_LIB_OUTPUT_PATH) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/x64) ENDIF() ELSE() SET(TARGET_POSTFIX x86) IF(PA_CONFIG_LIB_OUTPUT_PATH) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32) ENDIF() ENDIF() IF(PA_BUILD_SHARED) IF(PA_LIBNAME_ADD_SUFFIX) SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX}) ELSE() SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio) ENDIF() ENDIF() IF(PA_BUILD_STATIC) IF(PA_LIBNAME_ADD_SUFFIX) SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX}) ELSE() SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio) ENDIF() ENDIF() ELSE() IF(APPLE AND CMAKE_VERSION VERSION_GREATER 3.4.2) OPTION(PA_OUTPUT_OSX_FRAMEWORK "Generate an OS X framework instead of the simple library" OFF) IF(PA_OUTPUT_OSX_FRAMEWORK) SET_TARGET_PROPERTIES(portaudio PROPERTIES FRAMEWORK TRUE MACOSX_FRAMEWORK_IDENTIFIER com.portaudio FRAMEWORK_VERSION A PUBLIC_HEADER "${PA_PUBLIC_INCLUDES}" VERSION ${PA_SOVERSION} SOVERSION ${PA_SOVERSION}) ENDIF() ENDIF() ENDIF() # At least on Windows in embedded builds, portaudio's install target should likely # not be executed, as the library would usually already be installed as part of, and # by means of the host application. # The option below offers the option to avoid executing the portaudio install target # for cases in which the host-application executes install, but no independent install # of portaudio is wished. OPTION(PA_DISABLE_INSTALL "Disable targets install and uninstall (for embedded builds)" OFF) IF(NOT PA_OUTPUT_OSX_FRAMEWORK AND NOT PA_DISABLE_INSTALL) INCLUDE(CMakePackageConfigHelpers) CONFIGURE_PACKAGE_CONFIG_FILE(cmake_support/portaudioConfig.cmake.in ${CMAKE_BINARY_DIR}/cmake/portaudio/portaudioConfig.cmake INSTALL_DESTINATION "lib/cmake/portaudio" NO_CHECK_REQUIRED_COMPONENTS_MACRO) WRITE_BASIC_PACKAGE_VERSION_FILE(${CMAKE_BINARY_DIR}/cmake/portaudio/portaudioConfigVersion.cmake VERSION ${PA_VERSION} COMPATIBILITY SameMajorVersion) CONFIGURE_FILE(cmake_support/portaudio-2.0.pc.in ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc @ONLY) INSTALL(FILES README.md DESTINATION share/doc/portaudio) INSTALL(FILES LICENSE.txt DESTINATION share/doc/portaudio) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc DESTINATION lib/pkgconfig) INSTALL(FILES ${PA_PUBLIC_INCLUDES} DESTINATION include) INSTALL(TARGETS ${PA_TARGETS} EXPORT portaudio-targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) INSTALL(EXPORT portaudio-targets FILE "portaudioTargets.cmake" DESTINATION "lib/cmake/portaudio") EXPORT(TARGETS ${PA_TARGETS} FILE "${PROJECT_BINARY_DIR}/cmake/portaudio/portaudioTargets.cmake") INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/portaudio/portaudioConfig.cmake" "${CMAKE_BINARY_DIR}/cmake/portaudio/portaudioConfigVersion.cmake" DESTINATION "lib/cmake/portaudio") IF (NOT TARGET uninstall) CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_support/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) ADD_CUSTOM_TARGET(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ENDIF() ENDIF() # Prepared for inclusion of test files OPTION(PA_BUILD_TESTS "Include test projects" OFF) IF(PA_BUILD_TESTS) SUBDIRS(test) ENDIF() # Prepared for inclusion of test files OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF) IF(PA_BUILD_EXAMPLES) SUBDIRS(examples) ENDIF() ================================================ FILE: thirdparty/portaudio/Doxyfile ================================================ # Doxyfile 1.4.6 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = PortAudio PROJECT_NUMBER = 2.0 OUTPUT_DIRECTORY = ./doc/ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO 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 = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO BUILTIN_STL_SUPPORT = NO DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES 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 = NO GENERATE_TESTLIST = NO GENERATE_BUGLIST = NO GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES 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 = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = doc/src \ include \ examples FILE_PATTERNS = *.h \ *.c \ *.cpp \ *.java \ *.dox RECURSIVE = YES EXCLUDE = src/hostapi/wasapi/mingw-include EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = doc/src/images 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 = YES REFERENCES_RELATION = YES USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 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 = NO HIDE_UNDOC_RELATIONS = NO HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO ================================================ FILE: thirdparty/portaudio/Doxyfile.developer ================================================ # Doxyfile 1.4.6 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = PortAudio PROJECT_NUMBER = 2.0 OUTPUT_DIRECTORY = ./doc/ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO 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 = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO BUILTIN_STL_SUPPORT = NO DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = YES 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 = INTERNAL MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES 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 = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = doc/src \ include \ examples \ src \ test \ qa FILE_PATTERNS = *.h \ *.c \ *.cpp \ *.java \ *.dox RECURSIVE = YES EXCLUDE = src/hostapi/wasapi/mingw-include EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = doc/src/images INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 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 = NO HIDE_UNDOC_RELATIONS = NO HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO ================================================ FILE: thirdparty/portaudio/LICENSE.txt ================================================ Portable header file to contain: >>>>> /* * PortAudio Portable Real-Time Audio Library * PortAudio API Header File * Latest version available at: http://www.portaudio.com * * Copyright (c) 1999-2006 Ross Bencina and Phil Burk * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ <<<<< Implementation files to contain: >>>>> /* * PortAudio Portable Real-Time Audio Library * Latest version at: http://www.portaudio.com * Implementation * Copyright (c) 1999-2000 * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ <<<<< ================================================ FILE: thirdparty/portaudio/Makefile.in ================================================ # # PortAudio V19 Makefile.in # # Dominic Mazzoni # Modifications by Mikael Magnusson # Modifications by Stelios Bounanos # top_srcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ top_builddir = . PREFIX = @prefix@ prefix = $(PREFIX) exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ CC = @CC@ CXX = @CXX@ CFLAGS = @CFLAGS@ @DEFS@ LIBS = @LIBS@ AR = @AR@ RANLIB = @RANLIB@ SHELL = @SHELL@ LIBTOOL = @LIBTOOL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ SHARED_FLAGS = @SHARED_FLAGS@ LDFLAGS = @LDFLAGS@ DLL_LIBS = @DLL_LIBS@ CXXFLAGS = @CXXFLAGS@ NASM = @NASM@ NASMOPT = @NASMOPT@ LN_S = @LN_S@ LT_CURRENT=@LT_CURRENT@ LT_REVISION=@LT_REVISION@ LT_AGE=@LT_AGE@ OTHER_OBJS = @OTHER_OBJS@ INCLUDES = @INCLUDES@ PALIB = libportaudio.la PAINC = include/portaudio.h PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined \ -export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa|PaAsio|PaOSS|PaWasapi|PaWasapiWinrt)_.*" \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) COMMON_OBJS = \ src/common/pa_allocation.o \ src/common/pa_converters.o \ src/common/pa_cpuload.o \ src/common/pa_dither.o \ src/common/pa_debugprint.o \ src/common/pa_front.o \ src/common/pa_process.o \ src/common/pa_stream.o \ src/common/pa_trace.o \ src/hostapi/skeleton/pa_hostapi_skeleton.o LOOPBACK_OBJS = \ qa/loopback/src/audio_analyzer.o \ qa/loopback/src/biquad_filter.o \ qa/loopback/src/paqa_tools.o \ qa/loopback/src/test_audio_analyzer.o \ qa/loopback/src/write_wav.o \ qa/loopback/src/paqa.o EXAMPLES = \ bin/pa_devs \ bin/pa_fuzz \ bin/paex_pink \ bin/paex_read_write_wire \ bin/paex_record \ bin/paex_saw \ bin/paex_sine \ bin/paex_write_sine \ bin/paex_write_sine_nonint SELFTESTS = \ bin/paqa_devs \ bin/paqa_errs \ bin/paqa_latency TESTS = \ bin/patest1 \ bin/patest_buffer \ bin/patest_callbackstop \ bin/patest_clip \ bin/patest_dither \ bin/patest_hang \ bin/patest_in_overflow \ bin/patest_latency \ bin/patest_leftright \ bin/patest_longsine \ bin/patest_many \ bin/patest_maxsines \ bin/patest_mono \ bin/patest_multi_sine \ bin/patest_out_underflow \ bin/patest_prime \ bin/patest_ringmix \ bin/patest_sine8 \ bin/patest_sine_channelmaps \ bin/patest_sine_formats \ bin/patest_sine_time \ bin/patest_sine_srate \ bin/patest_start_stop \ bin/patest_stop \ bin/patest_stop_playout \ bin/patest_toomanysines \ bin/patest_two_rates \ bin/patest_underflow \ bin/patest_wire \ bin/pa_minlat # Most of these don't compile yet. Put them in TESTS, above, if # you want to try to compile them... ALL_TESTS = \ $(TESTS) \ bin/patest_sync \ bin/debug_convert \ bin/debug_dither_calc \ bin/debug_dual \ bin/debug_multi_in \ bin/debug_multi_out \ bin/debug_record \ bin/debug_record_reuse \ bin/debug_sine_amp \ bin/debug_sine \ bin/debug_sine_formats \ bin/debug_srate \ bin/debug_test1 OBJS := $(COMMON_OBJS) $(OTHER_OBJS) LTOBJS := $(OBJS:.o=.lo) SRC_DIRS = \ src/common \ src/hostapi/alsa \ src/hostapi/asihpi \ src/hostapi/asio \ src/hostapi/coreaudio \ src/hostapi/dsound \ src/hostapi/jack \ src/hostapi/oss \ src/hostapi/skeleton \ src/hostapi/wasapi \ src/hostapi/wdmks \ src/hostapi/wmme \ src/os/unix \ src/os/win SUBDIRS = @ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp all: lib/$(PALIB) all-recursive tests examples selftests tests: bin-stamp $(TESTS) examples: bin-stamp $(EXAMPLES) selftests: bin-stamp $(SELFTESTS) loopback: bin-stamp bin/paloopback # With ASIO enabled we must link libportaudio and all test programs with CXX lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC) @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS) $(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) $(EXAMPLES): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) examples/%.c @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/examples/$*.c lib/$(PALIB) $(LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/examples/$*.c lib/$(PALIB) $(LIBS) $(SELFTESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) qa/%.c @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/qa/$*.c lib/$(PALIB) $(LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/qa/$*.c lib/$(PALIB) $(LIBS) bin/paloopback: lib/$(PALIB) $(MAKEFILE) $(PAINC) $(LOOPBACK_OBJS) @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS) install: lib/$(PALIB) portaudio-2.0.pc $(INSTALL) -d $(DESTDIR)$(libdir) $(LIBTOOL) --mode=install $(INSTALL) lib/$(PALIB) $(DESTDIR)$(libdir) $(INSTALL) -d $(DESTDIR)$(includedir) for include in $(INCLUDES); do \ $(INSTALL_DATA) -m 644 $(top_srcdir)/include/$$include $(DESTDIR)$(includedir)/$$include; \ done $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig $(INSTALL) -m 644 portaudio-2.0.pc $(DESTDIR)$(libdir)/pkgconfig/portaudio-2.0.pc @echo "" @echo "------------------------------------------------------------" @echo "PortAudio was successfully installed." @echo "" @echo "On some systems (e.g. Linux) you should run 'ldconfig' now" @echo "to make the shared object available. You may also need to" @echo "modify your LD_LIBRARY_PATH environment variable to include" @echo "the directory $(libdir)" @echo "------------------------------------------------------------" @echo "" $(MAKE) install-recursive uninstall: $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(PALIB) $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(includedir)/portaudio.h $(MAKE) uninstall-recursive clean: $(LIBTOOL) --mode=clean rm -f $(LTOBJS) $(LOOPBACK_OBJS) $(ALL_TESTS) lib/$(PALIB) $(RM) bin-stamp lib-stamp -$(RM) -r bin lib distclean: clean $(RM) config.log config.status Makefile libtool portaudio-2.0.pc %.o: %.c $(MAKEFILE) $(PAINC) lib-stamp $(CC) -c $(CFLAGS) $< -o $@ %.lo: %.c $(MAKEFILE) $(PAINC) lib-stamp $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $< -o $@ %.lo: %.cpp $(MAKEFILE) $(PAINC) lib-stamp $(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c $(CXXFLAGS) $< -o $@ %.o: %.cpp $(MAKEFILE) $(PAINC) lib-stamp $(CXX) -c $(CXXFLAGS) $< -o $@ %.o: %.asm $(NASM) $(NASMOPT) -o $@ $< bin-stamp: -mkdir bin touch $@ lib-stamp: -mkdir lib -mkdir -p $(SRC_DIRS) touch $@ Makefile: Makefile.in config.status $(SHELL) config.status all-recursive: if test -n "$(SUBDIRS)" ; then for dir in "$(SUBDIRS)"; do $(MAKE) -C $$dir all; done ; fi install-recursive: if test -n "$(SUBDIRS)" ; then for dir in "$(SUBDIRS)"; do $(MAKE) -C $$dir install; done ; fi uninstall-recursive: if test -n "$(SUBDIRS)" ; then for dir in "$(SUBDIRS)"; do $(MAKE) -C $$dir uninstall; done ; fi ================================================ FILE: thirdparty/portaudio/README.configure.txt ================================================ PortAudio uses "autoconf" tools to generate Makefiles for Linux and Mac platforms. The source for these are configure.in and Makefile.in If you modify either of these files then please run this command before testing and checking in your changes. I run this command on Linux. autoreconf -if If you do not have autoreconf then do: sudo apt-get install autoconf If you get error like "possibly undefined macro: AC_LIBTOOL_WIN32_DLL" then you try installing some more packages and then try again. sudo apt-get install build-essential sudo apt-get install pkg-config sudo apt-get install libtool autoreconf -if Then test a build by doing: ./configure make clean make then check in the related files that are modified. These might include files like: configure config.guess depcomp install.sh ================================================ FILE: thirdparty/portaudio/README.md ================================================ # PortAudio - portable audio I/O library PortAudio is a portable audio I/O library designed for cross-platform support of audio. It uses either a callback mechanism to request audio processing, or blocking read/write calls to buffer data between the native audio subsystem and the client. Audio can be processed in various formats, including 32 bit floating point, and will be converted to the native format internally. ## Documentation: * Documentation is available at http://www.portaudio.com/docs/ * Or at `/doc/html/index.html` after running Doxygen. * Also see `src/common/portaudio.h` for the API spec. * And see the `examples/` and `test/` directories for many examples of usage. (We suggest `examples/paex_saw.c` for an example.) For information on compiling programs with PortAudio, please see the tutorial at: http://portaudio.com/docs/v19-doxydocs/tutorial_start.html We have an active mailing list for user and developer discussions. Please feel free to join. See http://www.portaudio.com for details. ## Important Files and Folders: include/portaudio.h = header file for PortAudio API. Specifies API. src/common/ = platform independent code, host independent code for all implementations. src/os = os specific (but host api neutral) code src/hostapi = implementations for different host apis ### Host API Implementations: src/hostapi/alsa = Advanced Linux Sound Architecture (ALSA) src/hostapi/asihpi = AudioScience HPI src/hostapi/asio = ASIO for Windows and Macintosh src/hostapi/coreaudio = Macintosh Core Audio for OS X src/hostapi/dsound = Windows Direct Sound src/hostapi/jack = JACK Audio Connection Kit src/hostapi/oss = Unix Open Sound System (OSS) src/hostapi/wasapi = Windows Vista WASAPI src/hostapi/wdmks = Windows WDM Kernel Streaming src/hostapi/wmme = Windows MultiMedia Extensions (MME) ### Test Programs: test/pa_fuzz.c = guitar fuzz box test/pa_devs.c = print a list of available devices test/pa_minlat.c = determine minimum latency for your machine test/paqa_devs.c = self test that opens all devices test/paqa_errs.c = test error detection and reporting test/patest_clip.c = hear a sine wave clipped and unclipped test/patest_dither.c = hear effects of dithering (extremely subtle) test/patest_pink.c = fun with pink noise test/patest_record.c = record and playback some audio test/patest_maxsines.c = how many sine waves can we play? Tests Pa_GetCPULoad(). test/patest_sine.c = output a sine wave in a simple PA app test/patest_sync.c = test synchronization of audio and video test/patest_wire.c = pass input to output, wire simulator ================================================ FILE: thirdparty/portaudio/SConstruct ================================================ import sys, os.path def rsplit(toSplit, sub, max=-1): """ str.rsplit seems to have been introduced in 2.4 :( """ l = [] i = 0 while i != max: try: idx = toSplit.rindex(sub) except ValueError: break toSplit, splitOff = toSplit[:idx], toSplit[idx + len(sub):] l.insert(0, splitOff) i += 1 l.insert(0, toSplit) return l sconsDir = os.path.join("build", "scons") SConscript(os.path.join(sconsDir, "SConscript_common")) Import("Platform", "Posix", "ApiVer") # SConscript_opts exports PortAudio options optsDict = SConscript(os.path.join(sconsDir, "SConscript_opts")) optionsCache = os.path.join(sconsDir, "options.cache") # Save options between runs in this cache options = Options(optionsCache, args=ARGUMENTS) for k in ("Installation Dirs", "Build Targets", "Host APIs", "Build Parameters", "Bindings"): options.AddOptions(*optsDict[k]) # Propagate options into environment env = Environment(options=options) # Save options for next run options.Save(optionsCache, env) # Generate help text for options env.Help(options.GenerateHelpText(env)) buildDir = os.path.join("#", sconsDir, env["PLATFORM"]) # Determine parameters to build tools if Platform in Posix: threadCFlags = '' if Platform != 'darwin': threadCFlags = "-pthread " baseLinkFlags = threadCFlags baseCxxFlags = baseCFlags = "-Wall -pedantic -pipe " + threadCFlags debugCxxFlags = debugCFlags = "-g" optCxxFlags = optCFlags = "-O2" env.Append(CCFLAGS = baseCFlags) env.Append(CXXFLAGS = baseCxxFlags) env.Append(LINKFLAGS = baseLinkFlags) if env["enableDebug"]: env.AppendUnique(CCFLAGS=debugCFlags.split()) env.AppendUnique(CXXFLAGS=debugCxxFlags.split()) if env["enableOptimize"]: env.AppendUnique(CCFLAGS=optCFlags.split()) env.AppendUnique(CXXFLAGS=optCxxFlags.split()) if not env["enableAsserts"]: env.AppendUnique(CPPDEFINES=["-DNDEBUG"]) if env["customCFlags"]: env.Append(CCFLAGS=Split(env["customCFlags"])) if env["customCxxFlags"]: env.Append(CXXFLAGS=Split(env["customCxxFlags"])) if env["customLinkFlags"]: env.Append(LINKFLAGS=Split(env["customLinkFlags"])) env.Append(CPPPATH=[os.path.join("#", "include"), "common"]) # Store all signatures in one file, otherwise .sconsign files will get installed along with our own files env.SConsignFile(os.path.join(sconsDir, ".sconsign")) env.SConscriptChdir(False) sources, sharedLib, staticLib, tests, portEnv, hostApis = env.SConscript(os.path.join("src", "SConscript"), build_dir=buildDir, duplicate=False, exports=["env"]) if Platform in Posix: prefix = env["prefix"] includeDir = os.path.join(prefix, "include") libDir = os.path.join(prefix, "lib") env.Alias("install", includeDir) env.Alias("install", libDir) # pkg-config def installPkgconfig(env, target, source): tgt = str(target[0]) src = str(source[0]) f = open(src) try: txt = f.read() finally: f.close() txt = txt.replace("@prefix@", prefix) txt = txt.replace("@exec_prefix@", prefix) txt = txt.replace("@libdir@", libDir) txt = txt.replace("@includedir@", includeDir) txt = txt.replace("@LIBS@", " ".join(["-l%s" % l for l in portEnv["LIBS"]])) txt = txt.replace("@THREAD_CFLAGS@", threadCFlags) f = open(tgt, "w") try: f.write(txt) finally: f.close() pkgconfigTgt = "portaudio-%d.0.pc" % int(ApiVer.split(".", 1)[0]) env.Command(os.path.join(libDir, "pkgconfig", pkgconfigTgt), os.path.join("#", pkgconfigTgt + ".in"), installPkgconfig) # Default to None, since if the user disables all targets and no Default is set, all targets # are built by default env.Default(None) if env["enableTests"]: env.Default(tests) if env["enableShared"]: env.Default(sharedLib) if Platform in Posix: def symlink(env, target, source): trgt = str(target[0]) src = str(source[0]) if os.path.islink(trgt) or os.path.exists(trgt): os.remove(trgt) os.symlink(os.path.basename(src), trgt) major, minor, micro = [int(c) for c in ApiVer.split(".")] soFile = "%s.%s" % (os.path.basename(str(sharedLib[0])), ApiVer) env.InstallAs(target=os.path.join(libDir, soFile), source=sharedLib) # Install symlinks symTrgt = os.path.join(libDir, soFile) env.Command(os.path.join(libDir, "libportaudio.so.%d.%d" % (major, minor)), symTrgt, symlink) symTrgt = rsplit(symTrgt, ".", 1)[0] env.Command(os.path.join(libDir, "libportaudio.so.%d" % major), symTrgt, symlink) symTrgt = rsplit(symTrgt, ".", 1)[0] env.Command(os.path.join(libDir, "libportaudio.so"), symTrgt, symlink) if env["enableStatic"]: env.Default(staticLib) env.Install(libDir, staticLib) env.Install(includeDir, os.path.join("include", "portaudio.h")) if env["enableCxx"]: env.SConscriptChdir(True) cxxEnv = env.Copy() sharedLibs, staticLibs, headers = env.SConscript(os.path.join("bindings", "cpp", "SConscript"), exports={"env": cxxEnv, "buildDir": buildDir}, build_dir=os.path.join(buildDir, "portaudiocpp"), duplicate=False) if env["enableStatic"]: env.Default(staticLibs) env.Install(libDir, staticLibs) if env["enableShared"]: env.Default(sharedLibs) env.Install(libDir, sharedLibs) env.Install(os.path.join(includeDir, "portaudiocpp"), headers) # Generate portaudio_config.h header with compile-time definitions of which PA # back-ends are available, and which includes back-end extension headers # Host-specific headers hostApiHeaders = {"ALSA": "pa_linux_alsa.h", "ASIO": "pa_asio.h", "COREAUDIO": "pa_mac_core.h", "JACK": "pa_jack.h", "WMME": "pa_winwmme.h", } def buildConfigH(target, source, env): """builder for portaudio_config.h""" global hostApiHeaders, hostApis out = "" for hostApi in hostApis: out += "#define PA_HAVE_%s\n" % hostApi hostApiSpecificHeader = hostApiHeaders.get(hostApi, None) if hostApiSpecificHeader: out += "#include \"%s\"\n" % hostApiSpecificHeader out += "\n" # Strip the last newline if out and out[-1] == "\n": out = out[:-1] f = file(str(target[0]), 'w') try: f.write(out) finally: f.close() return 0 # Define the builder for the config header env.Append(BUILDERS={"portaudioConfig": env.Builder( action=Action(buildConfigH), target_factory=env.fs.File)}) confH = env.portaudioConfig(File("portaudio_config.h", "include"), File("portaudio.h", "include")) env.Default(confH) env.Install(os.path.join(includeDir, "portaudio"), confH) for api in hostApis: if api in hostApiHeaders: env.Install(os.path.join(includeDir, "portaudio"), File(hostApiHeaders[api], "include")) ================================================ FILE: thirdparty/portaudio/aclocal.m4 ================================================ # generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 # General Public License for more details. # # You should have received a copy of the GNU 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurrence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES ================================================ FILE: thirdparty/portaudio/bindings/cpp/AUTHORS ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/COPYING ================================================ PortAudio Portable Real-Time Audio Library Copyright (c) 1999-2006 Ross Bencina and Phil Burk 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. The text above constitutes the entire PortAudio license; however, the PortAudio community also makes the following non-binding requests: Any person wishing to distribute modifications to the Software is requested to send the modifications to the original developer so that they can be incorporated into the canonical version. It is also requested that these non-binding requests be included along with the license above. ================================================ FILE: thirdparty/portaudio/bindings/cpp/ChangeLog ================================================ Note: Because PortAudioCpp is now in the main PortAudio SVN repository, having these per-release changelogs probably doesn't make much sense anymore. Perhaps it's better to just note mayor changes by date from now on. PortAudioCpp v19 revision 16 06/05/22: mblaauw: - Added up-to-date MSVC 6.0 projects created by David Moore. Besides MSVC 6.0 users, MSVC 7.0 users may use these projects and automatically convert them to MSVC 7.0 projects. - Changed the code and projects (MSVC 7.1 only) to be up-to-date with PortAudio's new directory structure. - Added equivalents of the PaAsio_GetInputChannelName() and PaAsio_GetOutputChannelName() functions to the AsioDeviceAdapter wrapper-class (missing functions pointed out by David Moore). - Added code to PortAudio's main SVN repository. PortAudioCpp v19 revision 15 (unknown release date): mblaauw: - Changed some exception handling code in HostApi's constructor. - Added accessors to PortAudio PaStream from PortAudioCpp Stream (their absence being pointed out by Tom Jordan). - Fixed a bug/typo in MemFunToCallbackInterfaceAdapter::init() thanks to Fredrik Viklund. - Fixed issue with concrete Stream classes possibly throwing an exception and fixed documentation w.r.t. this. - Moved files to portaudio/binding/cpp/. Made new msvc 7.1 projects to reflect the change and removed msvc 6.0 and 7.0 projects (because I can no longer maintain them myself). Gnu projects will probably need updating. PortAudioCpp v19 revision 14 03/10/24: mblaauw: - Fixed some error handling bugs in Stream and System (pointed out by Tom Jordan). - Updated documentation a little (main page). - Fixed order of members so initializer list was in the right order in StreamParameters (pointed out by Ludwig Schwardt). - Added new lines at EOF's (as indicated by Ludwig Schwardt). PortAudioCpp v19 revision 13 03/10/19: lschwardt: - Added build files for GNU/Linux. - Fixed bug in Exception where the inherited what() member function (and destructor) had looser exception specification (namely no exception specification, i.e. could throw anything) than the std::exception base class's what() member function (which had throw(), i.e. no-throw guarantee). - Changed the iterators so that they have a set of public typedefs instead of deriving the C++ standard library std::iterator<> struct. G++ 2.95 doesn't support std::exception<> and composition-by-aggregation is preferred over composition-by-inheritance in this case. - Changed some minor things to avoid G++ warning messages. mblaauw: - Renamed this file (/WHATSNEW.txt) to /CHANGELOG. - Renamed /PA_ISSUES.txt to /PA_ISSUES. - Added /INSTALL file with some build info for GNU/Linux and VC6. - Added MSVC 6.0 projects for building PortAudioCpp as a statically or dynamically linkable library. - Moved build files to /build/(gnu/ or vc6/). - Moved Doxygen configuration files to /doc/ and output to /doc/api_reference/. - Added a /doc/README with some info how to generate Doxygen documentation. PortAudioCpp v19 revision 12 03/09/02: mblaauw: - Updated code to reflect changes on V19-devel CVS branch. - Fixed some typos in the documentation. PortAudioCpp v19 revision 11 03/07/31: mblaauw: - Renamed SingleDirecionStreamParameters to DirectionSpecificStreamParameters. - Implemented BlockingStream. - Updated code to reflect recent changes to PortAudio V19-devel. - Fixed a potential memory leak when an exception was thrown in the HostApi constructor. - Renamed ``Latency'' to ``BufferSize'' in AsioDeviceAdapter. - Updated class documentation. PortAudioCpp v19 revision 10 03/07/18: mblaauw: - SingleDirectionStreamParameters now has a (static) null() method. - StreamParameters uses references for the direction-specific stream parameters instead of pointers (use null() method (above) instead of NULL). - StreamParameters and SingleDirectionStreamParameters must now be fully specified and now default values are used (because this was not very useful in general and only made things more complex). - Updated documentation. PortAudioCpp v19 revision 09 03/06/25: mblaauw: - Changed some things in SingleDirectionStreamParameters to ease it's usage. - Placed all SingleDirectionStreamParameters stuff into a separate file. + Totally redid the callback stuff, now it's less awkward and supports C++ functions. PortAudioCpp v19 revision 08 03/06/20: mblaauw: - Made deconstructors for Device and HostApi private. + Added a AsioDeviceWrapper host api specific device extension class. - Refactored Exception into a Exception base class and PaException and PaCppException derived classes. - Added ASIO specific device info to the devs.cxx example. - Fixed a bug in System::hostApiCount() and System::defaultHostApi(). + Moved Device::null to System::nullDevice. - Fixed some bugs in Device and System. PortAudioCpp v19 revision 07 03/06/08: mblaauw: - Updated some doxy comments. + Renamed CbXyz to CallbackXyz. + Renamed all ``configurations'' to ``parameters''. + Renamed HalfDuplexStreamConfiguration to SingleDirectionStreamConfiguration. - Renamed SingleDirectionStreamParameters::streamParameters() to SingleDirectionStreamParameters::paSteamParameters. - Added a non-constant version of SingleDirectionStreamParameters::paStreamParameters(). - A few improvements to SingleDirectionStreamParameters. - Allowed AutoSystem to be created without initializing the System singleton (using a ctor flag). - Added a BlockingStream class (not implemented for now). - Fixed many bugs in the implementation of the iterators. - Fixed a bug in Device::operator==(). + Added a C++ version of the patest_sine.c test/example. - Added a ctor for StreamParameters for a default half-duplex stream. - Added SingleDirectionStreamParameters::setDevice() and setNumChannels(). - Renamed System::numHostApis() to System::hostApiCount(). + Rewrote the iterators and related classes. They are now fully STL compliant. The System now has a static array of all HostApis and all Devices. Only the System can create HostApis and Devices and they are non-copyable now. All HostApis and Devices are now passed by-reference. - Renamed (System::) getVersion() to version() and getVersionText() to versionText(). - Renamed (Device::) numXyzChannels() to maxXyzChannels(). - Changed some stuff in StreamParameters. + Added a C++ version of the patest_devs.c test/example. PortAudioCpp v19 revision 06 03/06/04: mblaauw: + Added this file to the project (roughly, a `+' denotes a major change, a `-' a minor change). - Added System::deviceByIndex(), useful when a Device's index is stored for instance. - Renamed System::hostApiFromTypeId() to System::hostApiByTypeId(). - Updated and added some Doxygen documentation. - Made Stream::usedIntputLatency(), Stream::usedOutputLatency() and Stream::usedSampleRate() throw an paInternalError equivalent exception instead of paBadStreamPtr. - Changed exception handling in Stream::open() functions. They now follow the PA error handling mechanism better and a couple of bugs regarding ownership of objects were fixed. - Renamed Device::isDefaultXyzDevice() to Device::isSystemDefaultXyzDevice(). - Added Device::isHostApiDefaultXyzDevice(). - Added StreamConfiguration::unsetFlag(). - Removed CUSTOM from SampleDataFormat. - System::hostApiByTypeId() now throws an paInternalError if the type id was out-of-range; this is a temporary work-around (see comments). - Changed CbInterface to use paCallbackFun() instead of operator()(). - Renamed ``object'' to ``instance'' in CbMemFunAdapter.hxx. - Added StreamConfiguration::setXyzHostApiSpecificSampleFormat(). - Added StreamConfiguration::isXyzSampleFormatHostApiSpecific(). - Changed error handling in System::terminate(), it can now throw an Exception. - Added error handling in System::defaultHostApi(). - Added error handling in System::hostApisEnd(). - Changed some (but probably not all) C casts to C++ casts to avoid confusion with a certain Python person. - Renamed RaiiSystem to AutoSystem (class and file) as this is a come common convention. - Renamed System::numDevices() to System::deviceCount() to be more compatible with PortAudio (although PortAudio uses Pa_CountDevices() instead, see comment). - Renamed HostApi::numDevices() to HostApi::deviceCount(). - Changed INC_ to INCLUDED_ in the header multiple include guards. - Changed the order of functions in the StreamConfiguration class' header. - Written some more info in PortAudioCpp.hxx (Doxygen). - Added CallbackStream.hxx and CallbackStream.cxx files. + Refactored StreamConfiguration to remove the duplication which was there. There is now a HalfDuplexStreamConfiguration class. Also made some improvements to these classes while doing the refactoring. + Moved all code files to source/portaudiocpp/ and changed includes. + Moved all header files to include/portaudiocpp/ to easy a binary build if needed. The project must be set to have .../include/ as a path to look for includes. + Refactored the Stream class into a Stream base class and a CallbackStream derived class. - Renamed Stream::usingXyz() to Stream::xyz(). - Updated some doxy comments. - Changed ``using namespace portaudio'' in .cxx files to ``namespace portaudio { ... }''. PortAudioCpp v19 revision 05 03/04/09: mblaauw: - Initial release on the PortAudio mailinglist. ================================================ FILE: thirdparty/portaudio/bindings/cpp/INSTALL ================================================ Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command `./configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. ================================================ FILE: thirdparty/portaudio/bindings/cpp/Makefile.am ================================================ SUBDIRS = lib include bin #doc EXTRA_DIST = portaudiocpp.pc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = portaudiocpp.pc ================================================ FILE: thirdparty/portaudio/bindings/cpp/Makefile.in ================================================ # Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/portaudiocpp.pc.in COPYING \ $(top_srcdir)/../../compile $(top_srcdir)/../../config.guess \ $(top_srcdir)/../../config.sub $(top_srcdir)/../../install-sh \ $(top_srcdir)/../../ltmain.sh $(top_srcdir)/../../missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = portaudiocpp.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_INCLUDES = @DEFAULT_INCLUDES@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION_INFO = @LT_VERSION_INFO@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PORTAUDIO_ROOT = @PORTAUDIO_ROOT@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = lib include bin #doc EXTRA_DIST = portaudiocpp.pc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = portaudiocpp.pc all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): portaudiocpp.pc: $(top_builddir)/config.status $(srcdir)/portaudiocpp.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgconfigDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-pkgconfigDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ================================================ FILE: thirdparty/portaudio/bindings/cpp/NEWS ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/README ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/SConscript ================================================ import os.path Import("env", "buildDir") env.Append(CPPPATH="include") ApiVer = "0.0.12" Major, Minor, Micro = [int(c) for c in ApiVer.split(".")] sharedLibs = [] staticLibs = [] Import("Platform", "Posix") if Platform in Posix: env["SHLIBSUFFIX"] = ".so.%d.%d.%d" % (Major, Minor, Micro) soFile = "libportaudiocpp.so" if Platform != 'darwin': env.AppendUnique(SHLINKFLAGS="-Wl,-soname=%s.%d" % (soFile, Major)) # Create symlinks def symlink(env, target, source): trgt = str(target[0]) src = str(source[0]) if os.path.islink(trgt) or os.path.exists(trgt): os.remove(trgt) os.symlink(os.path.basename(src), trgt) lnk0 = env.Command(soFile + ".%d" % (Major), soFile + ".%d.%d.%d" % (Major, Minor, Micro), symlink) lnk1 = env.Command(soFile, soFile + ".%d" % (Major), symlink) sharedLibs.append(lnk0) sharedLibs.append(lnk1) src = [os.path.join("source", "portaudiocpp", "%s.cxx" % f) for f in ("BlockingStream", "CallbackInterface", \ "CallbackStream", "CFunCallbackStream","CppFunCallbackStream", "Device", "DirectionSpecificStreamParameters", "Exception", "HostApi", "InterfaceCallbackStream", "MemFunCallbackStream", "Stream", "StreamParameters", "System", "SystemDeviceIterator", "SystemHostApiIterator")] env.Append(LIBS="portaudio", LIBPATH=buildDir) sharedLib = env.SharedLibrary("portaudiocpp", src, LIBS=["portaudio"]) staticLib = env.Library("portaudiocpp", src, LIBS=["portaudio"]) sharedLibs.append(sharedLib) staticLibs.append(staticLib) headers = Split("""AutoSystem.hxx BlockingStream.hxx CallbackInterface.hxx CallbackStream.hxx CFunCallbackStream.hxx CppFunCallbackStream.hxx Device.hxx DirectionSpecificStreamParameters.hxx Exception.hxx HostApi.hxx InterfaceCallbackStream.hxx MemFunCallbackStream.hxx PortAudioCpp.hxx SampleDataFormat.hxx Stream.hxx StreamParameters.hxx SystemDeviceIterator.hxx SystemHostApiIterator.hxx System.hxx """) if env["PLATFORM"] == "win32": headers.append("AsioDeviceAdapter.hxx") headers = [File(os.path.join("include", "portaudiocpp", h)) for h in headers] Return("sharedLibs", "staticLibs", "headers") ================================================ FILE: thirdparty/portaudio/bindings/cpp/aclocal.m4 ================================================ # generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR ================================================ FILE: thirdparty/portaudio/bindings/cpp/bin/Makefile.am ================================================ BINDIR = $(top_srcdir)/example LIBDIR = $(top_builddir)/lib noinst_PROGRAMS = devs sine LDADD = $(LIBDIR)/libportaudiocpp.la $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la devs_SOURCES = $(BINDIR)/devs.cxx sine_SOURCES = $(BINDIR)/sine.cxx ================================================ FILE: thirdparty/portaudio/bindings/cpp/bin/Makefile.in ================================================ # Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = devs$(EXEEXT) sine$(EXEEXT) subdir = bin DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/../../depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_devs_OBJECTS = devs.$(OBJEXT) devs_OBJECTS = $(am_devs_OBJECTS) devs_LDADD = $(LDADD) devs_DEPENDENCIES = $(LIBDIR)/libportaudiocpp.la \ $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_sine_OBJECTS = sine.$(OBJEXT) sine_OBJECTS = $(am_sine_OBJECTS) sine_LDADD = $(LDADD) sine_DEPENDENCIES = $(LIBDIR)/libportaudiocpp.la \ $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = $(SHELL) $(top_srcdir)/../../depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(devs_SOURCES) $(sine_SOURCES) DIST_SOURCES = $(devs_SOURCES) $(sine_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_INCLUDES = @DEFAULT_INCLUDES@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION_INFO = @LT_VERSION_INFO@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PORTAUDIO_ROOT = @PORTAUDIO_ROOT@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ BINDIR = $(top_srcdir)/example LIBDIR = $(top_builddir)/lib LDADD = $(LIBDIR)/libportaudiocpp.la $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la devs_SOURCES = $(BINDIR)/devs.cxx sine_SOURCES = $(BINDIR)/sine.cxx all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bin/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu bin/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list devs$(EXEEXT): $(devs_OBJECTS) $(devs_DEPENDENCIES) $(EXTRA_devs_DEPENDENCIES) @rm -f devs$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(devs_OBJECTS) $(devs_LDADD) $(LIBS) sine$(EXEEXT): $(sine_OBJECTS) $(sine_DEPENDENCIES) $(EXTRA_sine_DEPENDENCIES) @rm -f sine$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(sine_OBJECTS) $(sine_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sine.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< devs.o: $(BINDIR)/devs.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT devs.o -MD -MP -MF $(DEPDIR)/devs.Tpo -c -o devs.o `test -f '$(BINDIR)/devs.cxx' || echo '$(srcdir)/'`$(BINDIR)/devs.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/devs.Tpo $(DEPDIR)/devs.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(BINDIR)/devs.cxx' object='devs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o devs.o `test -f '$(BINDIR)/devs.cxx' || echo '$(srcdir)/'`$(BINDIR)/devs.cxx devs.obj: $(BINDIR)/devs.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT devs.obj -MD -MP -MF $(DEPDIR)/devs.Tpo -c -o devs.obj `if test -f '$(BINDIR)/devs.cxx'; then $(CYGPATH_W) '$(BINDIR)/devs.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/devs.cxx'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/devs.Tpo $(DEPDIR)/devs.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(BINDIR)/devs.cxx' object='devs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o devs.obj `if test -f '$(BINDIR)/devs.cxx'; then $(CYGPATH_W) '$(BINDIR)/devs.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/devs.cxx'; fi` sine.o: $(BINDIR)/sine.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sine.o -MD -MP -MF $(DEPDIR)/sine.Tpo -c -o sine.o `test -f '$(BINDIR)/sine.cxx' || echo '$(srcdir)/'`$(BINDIR)/sine.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sine.Tpo $(DEPDIR)/sine.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(BINDIR)/sine.cxx' object='sine.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sine.o `test -f '$(BINDIR)/sine.cxx' || echo '$(srcdir)/'`$(BINDIR)/sine.cxx sine.obj: $(BINDIR)/sine.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sine.obj -MD -MP -MF $(DEPDIR)/sine.Tpo -c -o sine.obj `if test -f '$(BINDIR)/sine.cxx'; then $(CYGPATH_W) '$(BINDIR)/sine.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/sine.cxx'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sine.Tpo $(DEPDIR)/sine.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(BINDIR)/sine.cxx' object='sine.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sine.obj `if test -f '$(BINDIR)/sine.cxx'; then $(CYGPATH_W) '$(BINDIR)/sine.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/sine.cxx'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/Makefile.in ================================================ # # Makefile template for PortAudioCpp # Ludwig Schwardt # 01/10/2003 # # Not much to edit here - rather check configure.ac # PREFIX = @prefix@ CC = @CC@ CXX = @CXX@ CFLAGS = @CFLAGS@ @DEFS@ CXXFLAGS = @CXXFLAGS@ SHARED_FLAGS = @SHARED_FLAGS@ LIBS = @LIBS@ DLL_LIBS = @DLL_LIBS@ AR = @AR@ RANLIB = @RANLIB@ INSTALL = @INSTALL@ PACPP_ROOT = @PACPP_ROOT@ PORTAUDIO = @PORTAUDIO@ PADLL = @PADLL@ PACPP_DLL = @PACPP_DLL@ PALIB = libportaudio.a PACPP_LIB = libportaudiocpp.a PACPP_DLLV = $(PACPP_DLL).0.0.12 SRCDIR = $(PACPP_ROOT)/source/portaudiocpp BINDIR = $(PACPP_ROOT)/example LIBDIR = $(PACPP_ROOT)/lib DOCDIR = $(PACPP_ROOT)/doc OBJS = \ $(SRCDIR)/BlockingStream.o \ $(SRCDIR)/CallbackInterface.o \ $(SRCDIR)/CallbackStream.o \ $(SRCDIR)/CFunCallbackStream.o \ $(SRCDIR)/CppFunCallbackStream.o \ $(SRCDIR)/Device.o \ $(SRCDIR)/DirectionSpecificStreamParameters.o \ $(SRCDIR)/Exception.o \ $(SRCDIR)/HostApi.o \ $(SRCDIR)/InterfaceCallbackStream.o \ $(SRCDIR)/MemFunCallbackStream.o \ $(SRCDIR)/Stream.o \ $(SRCDIR)/StreamParameters.o \ $(SRCDIR)/System.o \ $(SRCDIR)/SystemDeviceIterator.o \ $(SRCDIR)/SystemHostApiIterator.o # Not supported yet # $(SRCDIR)/AsioDeviceAdapter.o EXAMPLES = \ $(BINDIR)/devs \ $(BINDIR)/sine .PHONY: all clean docs all: $(EXAMPLES) $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLL) clean: rm -rf $(SRCDIR)/*.o $(BINDIR)/*.o $(EXAMPLES) $(LIBDIR) $(DOCDIR)/api_reference rm -rf autom4te.cache config.status config.log docs: cd $(DOCDIR); doxygen config.doxy.linux %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ %.o: %.cxx $(CXX) -c $(CXXFLAGS) $< -o $@ $(EXAMPLES): $(BINDIR)/%: $(BINDIR)/%.o $(OBJS) $(CXX) $^ -o $@ $(LIBS) $(LIBDIR)/$(PACPP_LIB): $(LIBDIR) $(OBJS) $(AR) ruv $(LIBDIR)/$(PACPP_LIB) $(OBJS) $(RANLIB) $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLLV): $(LIBDIR) $(OBJS) $(CXX) $(SHARED_FLAGS) -o $(LIBDIR)/$(PACPP_DLLV) $(OBJS) $(DLL_LIBS) $(LIBDIR)/$(PACPP_DLL): $(LIBDIR) $(OBJS) $(CXX) $(SHARED_FLAGS) -o $(LIBDIR)/$(PACPP_DLL) $(OBJS) $(DLL_LIBS) #install: $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLLV) # $(INSTALL) -m 644 $(LIBDIR)/$(PACPP_DLLV) $(PREFIX)/lib/$(PACPP_DLLV) # $(INSTALL) -m 644 $(LIBDIR)/$(PACPP_LIB) $(PREFIX)/lib/$(PACPP_LIB) # cd $(PREFIX)/lib && rm -f $(PACPP_DLL) && ln -s $(PACPP_DLLV) $(PACPP_DLL) # @echo "" # @echo "------------------------------------------------------------" # @echo "PortAudioCpp was successfully installed." # @echo "" # @echo "On some systems (e.g. Linux) you should run 'ldconfig' now" # @echo "to make the shared object available. You may also need to" # @echo "modify your LD_LIBRARY_PATH environment variable to include" # @echo "the directory $(PREFIX)/lib" # @echo "------------------------------------------------------------" # @echo "" $(LIBDIR): mkdir $(LIBDIR) ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/OUT_OF_DATE ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/aclocal.m4 ================================================ dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error AC_DEFUN(PKG_CHECK_MODULES, [ succeeded=no if test -z "$PKG_CONFIG"; then AC_PATH_PROG(PKG_CONFIG, pkg-config, no) fi if test "$PKG_CONFIG" = "no" ; then echo "*** The pkg-config script could not be found. Make sure it is" echo "*** in your path, or set the PKG_CONFIG environment variable" echo "*** to the full path to pkg-config." echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." else PKG_CONFIG_MIN_VERSION=0.9.0 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then AC_MSG_CHECKING(for $2) if $PKG_CONFIG --exists "$2" ; then AC_MSG_RESULT(yes) succeeded=yes AC_MSG_CHECKING($1_CFLAGS) $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` AC_MSG_RESULT($$1_CFLAGS) AC_MSG_CHECKING($1_LIBS) $1_LIBS=`$PKG_CONFIG --libs "$2"` AC_MSG_RESULT($$1_LIBS) else $1_CFLAGS="" $1_LIBS="" ## If we have a custom action on failure, don't print errors, but ## do set a variable so people can do so. $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` ifelse([$4], ,echo $$1_PKG_ERRORS,) fi AC_SUBST($1_CFLAGS) AC_SUBST($1_LIBS) else echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." echo "*** See http://www.freedesktop.org/software/pkgconfig" fi fi if test $succeeded = yes; then ifelse([$3], , :, [$3]) else ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) fi ]) ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/config.guess ================================================ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-10-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 # General Public License for more details. # # You should have received a copy of the GNU 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; sparc*) machine=`uname -p`-unknown ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in big) echo mips-unknown-linux-gnu && exit 0 ;; little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_targets=`cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-pc-linux-gnu\n", argv[1]); # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/config.sub ================================================ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-07-17' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU 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. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/configure ================================================ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for PortAudioCpp 12. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='PortAudioCpp' PACKAGE_TARNAME='portaudiocpp' PACKAGE_VERSION='12' PACKAGE_STRING='PortAudioCpp 12' PACKAGE_BUGREPORT='' ac_unique_file="../../include/portaudiocpp/PortAudioCpp.hxx" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX LN_S RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR PACPP_ROOT PORTAUDIO PADLL PACPP_DLL PACPP_INC SHARED_FLAGS DLL_LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os PKG_CONFIG JACK_CFLAGS JACK_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures PortAudioCpp 12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of PortAudioCpp 12:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-alsa (default=auto) --with-jack (default=auto) --with-oss (default=yes) --with-host_os (no default) --with-winapi ((wmme/directx/asio) default=wmme) --with-macapi (asio) default=asio) --with-asiodir (default=/usr/local/asiosdk2) --with-dxdir (default=/usr/local/dx7sdk) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF PortAudioCpp configure 12 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by PortAudioCpp $as_me 12, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ###### Top-level directory of pacpp ###### This makes it easy to shuffle the build directories ###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! PACPP_ROOT="../.." ###### ###### SET THIS TO PORTAUDIO DIRECTORY ###### PORTAUDIO="$PACPP_ROOT/../portaudio" # Various other variables and flags PACPP_INC="$PACPP_ROOT/include" INCLUDES="-I$PACPP_INC -I$PORTAUDIO -I$PORTAUDIO/pa_common" CFLAGS="-g -O2 -Wall -ansi -pedantic $INCLUDES" CXXFLAGS="$CFLAGS" PALIBDIR="$PORTAUDIO/lib" # Checks for programs ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_AR" && ac_cv_path_AR="no" ;; esac fi AR=$ac_cv_path_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if [ $AR = "no" ] ; then { { echo "$as_me:$LINENO: error: \"Could not find ar - needed to create a library\"" >&5 echo "$as_me: error: \"Could not find ar - needed to create a library\"" >&2;} { (exit 1); exit 1; }; }; fi # This must be one of the first tests we do or it will fail... echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6 case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac # Transfer these variables to the Makefile ##################### CHECK FOR INSTALLED PACKAGES ############################ # checks for various host APIs and arguments to configure that # turn them on or off echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5 echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6 if test "${ac_cv_lib_asound_snd_pcm_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char snd_pcm_open (); int main () { snd_pcm_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_asound_snd_pcm_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_asound_snd_pcm_open=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6 if test $ac_cv_lib_asound_snd_pcm_open = yes; then have_alsa=yes else have_alsa=no fi # Determine the host description for the subsequent test. # PKG_CHECK_MODULES seems to check and set the host variable also, but # that then requires pkg-config availability which is not standard on # MinGW systems and can be a pain to install. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` succeeded=no if test -z "$PKG_CONFIG"; then # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test "$PKG_CONFIG" = "no" ; then echo "*** The pkg-config script could not be found. Make sure it is" echo "*** in your path, or set the PKG_CONFIG environment variable" echo "*** to the full path to pkg-config." echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." else PKG_CONFIG_MIN_VERSION=0.9.0 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then echo "$as_me:$LINENO: checking for jack" >&5 echo $ECHO_N "checking for jack... $ECHO_C" >&6 if $PKG_CONFIG --exists "jack" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 succeeded=yes echo "$as_me:$LINENO: checking JACK_CFLAGS" >&5 echo $ECHO_N "checking JACK_CFLAGS... $ECHO_C" >&6 JACK_CFLAGS=`$PKG_CONFIG --cflags "jack"` echo "$as_me:$LINENO: result: $JACK_CFLAGS" >&5 echo "${ECHO_T}$JACK_CFLAGS" >&6 echo "$as_me:$LINENO: checking JACK_LIBS" >&5 echo $ECHO_N "checking JACK_LIBS... $ECHO_C" >&6 JACK_LIBS=`$PKG_CONFIG --libs "jack"` echo "$as_me:$LINENO: result: $JACK_LIBS" >&5 echo "${ECHO_T}$JACK_LIBS" >&6 else JACK_CFLAGS="" JACK_LIBS="" ## If we have a custom action on failure, don't print errors, but ## do set a variable so people can do so. JACK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "jack"` fi else echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." echo "*** See http://www.freedesktop.org/software/pkgconfig" fi fi if test $succeeded = yes; then have_jack=yes else have_jack=no fi # Check whether --with-alsa or --without-alsa was given. if test "${with_alsa+set}" = set; then withval="$with_alsa" with_alsa=$withval else with_alsa="yes" fi; # Check whether --with-jack or --without-jack was given. if test "${with_jack+set}" = set; then withval="$with_jack" with_jack=$withval else with_jack="yes" fi; # Check whether --with-oss or --without-oss was given. if test "${with_oss+set}" = set; then withval="$with_oss" with_oss=$withval else with_oss="yes" fi; # Check whether --with-host_os or --without-host_os was given. if test "${with_host_os+set}" = set; then withval="$with_host_os" host_os=$withval fi; # Check whether --with-winapi or --without-winapi was given. if test "${with_winapi+set}" = set; then withval="$with_winapi" with_winapi=$withval else with_winapi="wmme" fi; # Mac API added for ASIO, can have other api's listed # Check whether --with-macapi or --without-macapi was given. if test "${with_macapi+set}" = set; then withval="$with_macapi" with_macapi=$withval else with_macapi="asio" fi; # Check whether --with-asiodir or --without-asiodir was given. if test "${with_asiodir+set}" = set; then withval="$with_asiodir" with_asiodir=$withval else with_asiodir="/usr/local/asiosdk2" fi; # Check whether --with-dxdir or --without-dxdir was given. if test "${with_dxdir+set}" = set; then withval="$with_dxdir" with_dxdir=$withval else with_dxdir="/usr/local/dx7sdk" fi; ##################### HOST-SPECIFIC LIBRARY SETTINGS ########################## case "${host_os}" in darwin* ) # Mac OS X configuration LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio"; PADLL="libportaudio.dylib"; PACPP_DLL="libportaudiocpp.dylib"; SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox"; SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib"; if [ $with_macapi = "asio" ] ; then if [ $with_asiodir ] ; then ASIODIR="$with_asiodir"; else ASIODIR="/usr/local/asiosdk2"; fi echo "ASIODIR: $ASIODIR"; fi ;; mingw* ) # MingW configuration echo "WINAPI: $with_winapi" if [ $with_winapi = "directx" ] ; then if [ $with_dxdir ] ; then DXDIR="$with_dxdir"; else DXDIR="/usr/local/dx7sdk"; fi echo "DXDIR: $DXDIR" LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm -ldsound -lole32"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm -lm -L./dx7sdk/lib -ldsound -lole32"; CFLAGS="$CFLAGS -DPA_NO_WMME -DPA_NO_ASIO"; CXXFLAGS="$CFLAGS" elif [ $with_winapi = "asio" ] ; then if [ $with_asiodir ] ; then ASIODIR="$with_asiodir"; else ASIODIR="/usr/local/asiosdk2"; fi echo "ASIODIR: $ASIODIR" LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"; CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -DPA_NO_WMME -DPA_NO_DS -DWINDOWS"; CXXFLAGS="$CFLAGS"; else # WMME default LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm"; CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_ASIO"; CXXFLAGS="$CFLAGS"; fi ;; cygwin* ) # Cygwin configuration LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm"; ;; *) # Unix OSS configuration echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_create (); int main () { pthread_create (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread_pthread_create=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_create=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 if test $ac_cv_lib_pthread_pthread_create = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else { { echo "$as_me:$LINENO: error: libpthread not found!" >&5 echo "$as_me: error: libpthread not found!" >&2;} { (exit 1); exit 1; }; } fi LIBS="$LIBS -L$PALIBDIR -lportaudio" if [ $have_jack = "yes" ] && [ $with_jack != "no" ] ; then LIBS="$LIBS $JACK_LIBS" CFLAGS="$CFLAGS $JACK_CFLAGS" cat >>confdefs.h <<\_ACEOF #define PA_USE_JACK 1 _ACEOF fi if [ $have_alsa = "yes" ] && [ $with_alsa != "no" ] ; then LIBS="$LIBS -lasound" cat >>confdefs.h <<\_ACEOF #define PA_USE_ALSA 1 _ACEOF fi if [ $with_oss != "no" ] ; then cat >>confdefs.h <<\_ACEOF #define PA_USE_OSS 1 _ACEOF fi LIBS="$LIBS -lm -lpthread"; PADLL="libportaudio.so"; PACPP_DLL="libportaudiocpp.so"; SHARED_FLAGS="-shared"; esac ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by PortAudioCpp $as_me 12, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ PortAudioCpp config.status 12 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@AR@,$AR,;t t s,@PACPP_ROOT@,$PACPP_ROOT,;t t s,@PORTAUDIO@,$PORTAUDIO,;t t s,@PADLL@,$PADLL,;t t s,@PACPP_DLL@,$PACPP_DLL,;t t s,@PACPP_INC@,$PACPP_INC,;t t s,@SHARED_FLAGS@,$SHARED_FLAGS,;t t s,@DLL_LIBS@,$DLL_LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@JACK_CFLAGS@,$JACK_CFLAGS,;t t s,@JACK_LIBS@,$JACK_LIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/configure.ac ================================================ # # PortAudioCpp V19 autoconf input file # Shamelessly ripped from the PortAudio one by Dominic Mazzoni # Ludwig Schwardt # # Require autoconf >= 2.13 AC_PREREQ(2.13) AC_INIT([PortAudioCpp], [12]) AC_CONFIG_SRCDIR([../../include/portaudiocpp/PortAudioCpp.hxx]) ###### Top-level directory of pacpp ###### This makes it easy to shuffle the build directories ###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! PACPP_ROOT="../.." ###### ###### SET THIS TO PORTAUDIO DIRECTORY ###### PORTAUDIO="$PACPP_ROOT/../portaudio" # Various other variables and flags PACPP_INC="$PACPP_ROOT/include" INCLUDES="-I$PACPP_INC -I$PORTAUDIO -I$PORTAUDIO/pa_common" CFLAGS="-g -O2 -Wall -ansi -pedantic $INCLUDES" CXXFLAGS="$CFLAGS" PALIBDIR="$PORTAUDIO/lib" # Checks for programs AC_PROG_CC AC_PROG_CXX AC_PROG_LN_S AC_PROG_RANLIB AC_PROG_INSTALL AC_PATH_PROG(AR, ar, no) if [[ $AR = "no" ]] ; then AC_MSG_ERROR("Could not find ar - needed to create a library"); fi # This must be one of the first tests we do or it will fail... AC_C_BIGENDIAN # Transfer these variables to the Makefile AC_SUBST(PACPP_ROOT) AC_SUBST(PORTAUDIO) AC_SUBST(PADLL) AC_SUBST(PACPP_DLL) AC_SUBST(PACPP_INC) AC_SUBST(SHARED_FLAGS) AC_SUBST(DLL_LIBS) AC_SUBST(CXXFLAGS) ##################### CHECK FOR INSTALLED PACKAGES ############################ # checks for various host APIs and arguments to configure that # turn them on or off AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) # Determine the host description for the subsequent test. # PKG_CHECK_MODULES seems to check and set the host variable also, but # that then requires pkg-config availability which is not standard on # MinGW systems and can be a pain to install. AC_CANONICAL_HOST PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) AC_ARG_WITH(alsa, [ --with-alsa (default=auto)], with_alsa=$withval, with_alsa="yes") AC_ARG_WITH(jack, [ --with-jack (default=auto)], with_jack=$withval, with_jack="yes") AC_ARG_WITH(oss, [ --with-oss (default=yes)], with_oss=$withval, with_oss="yes") AC_ARG_WITH(host_os, [ --with-host_os (no default)], host_os=$withval) AC_ARG_WITH(winapi, [ --with-winapi ((wmme/directx/asio) default=wmme)], with_winapi=$withval, with_winapi="wmme") # Mac API added for ASIO, can have other api's listed AC_ARG_WITH(macapi, [ --with-macapi (asio) default=asio)], with_macapi=$withval, with_macapi="asio") AC_ARG_WITH(asiodir, [ --with-asiodir (default=/usr/local/asiosdk2)], with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2") AC_ARG_WITH(dxdir, [ --with-dxdir (default=/usr/local/dx7sdk)], with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk") ##################### HOST-SPECIFIC LIBRARY SETTINGS ########################## case "${host_os}" in darwin* ) # Mac OS X configuration LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio"; PADLL="libportaudio.dylib"; PACPP_DLL="libportaudiocpp.dylib"; SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox"; SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib"; if [[ $with_macapi = "asio" ]] ; then if [[ $with_asiodir ]] ; then ASIODIR="$with_asiodir"; else ASIODIR="/usr/local/asiosdk2"; fi echo "ASIODIR: $ASIODIR"; fi ;; mingw* ) # MingW configuration echo "WINAPI: $with_winapi" if [[ $with_winapi = "directx" ]] ; then if [[ $with_dxdir ]] ; then DXDIR="$with_dxdir"; else DXDIR="/usr/local/dx7sdk"; fi echo "DXDIR: $DXDIR" LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm -ldsound -lole32"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm -lm -L./dx7sdk/lib -ldsound -lole32"; CFLAGS="$CFLAGS -DPA_NO_WMME -DPA_NO_ASIO"; CXXFLAGS="$CFLAGS" elif [[ $with_winapi = "asio" ]] ; then if [[ $with_asiodir ]] ; then ASIODIR="$with_asiodir"; else ASIODIR="/usr/local/asiosdk2"; fi echo "ASIODIR: $ASIODIR" LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"; CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -DPA_NO_WMME -DPA_NO_DS -DWINDOWS"; CXXFLAGS="$CFLAGS"; else # WMME default LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm"; CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_ASIO"; CXXFLAGS="$CFLAGS"; fi ;; cygwin* ) # Cygwin configuration LIBS="-L$PALIBDIR -lportaudio" LIBS="$LIBS -lwinmm -lm"; PADLL="portaudio.dll"; PACPP_DLL="portaudiocpp.dll"; SHARED_FLAGS="-shared -mthreads"; DLL_LIBS="-lwinmm"; ;; *) # Unix OSS configuration AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([libpthread not found!])) LIBS="$LIBS -L$PALIBDIR -lportaudio" if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then LIBS="$LIBS $JACK_LIBS" CFLAGS="$CFLAGS $JACK_CFLAGS" AC_DEFINE(PA_USE_JACK) fi if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then LIBS="$LIBS -lasound" AC_DEFINE(PA_USE_ALSA) fi if [[ $with_oss != "no" ]] ; then AC_DEFINE(PA_USE_OSS) fi LIBS="$LIBS -lm -lpthread"; PADLL="libportaudio.so"; PACPP_DLL="libportaudiocpp.so"; SHARED_FLAGS="-shared"; esac AC_CONFIG_FILES([Makefile]) AC_OUTPUT ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/gnu/install-sh ================================================ #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc6/devs_example.dsp ================================================ # Microsoft Developer Studio Project File - Name="devs_example" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=devs_example - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "devs_example.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "devs_example.mak" CFG="devs_example - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "devs_example - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "devs_example - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "devs_example - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 portaudiocpp-vc6-r.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/devs_example.exe" /libpath:"../../lib" !ELSEIF "$(CFG)" == "devs_example - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 portaudiocpp-vc6-d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/devs_example.exe" /pdbtype:sept /libpath:"../../lib" !ENDIF # Begin Target # Name "devs_example - Win32 Release" # Name "devs_example - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_allocation.c # End Source File # Begin Source File SOURCE=..\..\..\..\pa_asio\pa_asio.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_converters.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_cpuload.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_dither.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_front.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_process.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_stream.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_trace.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_win_hostapis.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_win_util.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\wmme\pa_win_wmme.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_allocation.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_converters.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_cpuload.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_dither.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_endianness.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_hostapi.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_process.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_stream.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_trace.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_types.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_util.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # Begin Group "Example Files" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\example\devs.cxx # End Source File # End Group # Begin Group "ASIO 2 SDK" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\..\..\..\asiosdk2\common\asio.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\..\asiosdk2\host\asiodrivers.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp # End Source File # End Group # End Target # End Project ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc6/devs_example.dsw ================================================ Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "devs_example"=".\devs_example.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name static_library End Project Dependency }}} ############################################################################### Project: "static_library"=".\static_library.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc6/sine_example.dsp ================================================ # Microsoft Developer Studio Project File - Name="sine_example" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=sine_example - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "sine_example.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "sine_example.mak" CFG="sine_example - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "sine_example - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "sine_example - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "sine_example - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 portaudiocpp-vc6-r.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/sine_example.exe" /libpath:"../../lib" !ELSEIF "$(CFG)" == "sine_example - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 portaudiocpp-vc6-d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/sine_example.exe" /pdbtype:sept /libpath:"../../lib" !ENDIF # Begin Target # Name "sine_example - Win32 Release" # Name "sine_example - Win32 Debug" # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_allocation.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_converters.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_cpuload.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_dither.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_endianness.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_hostapi.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_process.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_stream.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_trace.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_types.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_util.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.h # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # Begin Group "Example Files" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\example\sine.cxx # End Source File # End Group # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_allocation.c # End Source File # Begin Source File SOURCE=..\..\..\..\pa_asio\pa_asio.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_converters.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_cpuload.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_dither.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_front.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_process.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_stream.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\common\pa_trace.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_win_hostapis.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_win_util.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\src\hostapi\wmme\pa_win_wmme.c # End Source File # Begin Source File SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.c # End Source File # End Group # Begin Group "ASIO 2 SDK" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\..\..\..\asiosdk2\common\asio.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\..\asiosdk2\host\asiodrivers.cpp # End Source File # Begin Source File SOURCE=..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp # End Source File # End Group # End Target # End Project ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc6/sine_example.dsw ================================================ Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "sine_example"=".\sine_example.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name static_library End Project Dependency }}} ############################################################################### Project: "static_library"=".\static_library.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc6/static_library.dsp ================================================ # Microsoft Developer Studio Project File - Name="static_library" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=static_library - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "static_library.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "static_library.mak" CFG="static_library - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "static_library - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "static_library - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "static_library - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"../../lib/portaudiocpp-vc6-r.lib" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"../../lib/portaudiocpp-vc6-d.lib" !ENDIF # Begin Target # Name "static_library - Win32 Release" # Name "static_library - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\source\portaudiocpp\AsioDeviceAdapter.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\BlockingStream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\CallbackInterface.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\CallbackStream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\CFunCallbackStream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\CppFunCallbackStream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\Device.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\DirectionSpecificStreamParameters.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\Exception.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\HostApi.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\InterfaceCallbackStream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\MemFunCallbackStream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\Stream.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\StreamParameters.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\System.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\SystemDeviceIterator.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # Begin Source File SOURCE=..\..\source\portaudiocpp\SystemHostApiIterator.cxx !IF "$(CFG)" == "static_library - Win32 Release" !ELSEIF "$(CFG)" == "static_library - Win32 Debug" # SUBTRACT CPP /YX !ENDIF # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\..\include\portaudiocpp\AsioDeviceAdapter.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\AutoSystem.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\BlockingStream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\CallbackInterface.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\CallbackStream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\CFunCallbackStream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\CppFunCallbackStream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\Device.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\DirectionSpecificStreamParameters.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\Exception.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\HostApi.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\InterfaceCallbackStream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\MemFunCallbackStream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\PortAudioCpp.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\SampleDataFormat.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\Stream.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\StreamParameters.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\System.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\SystemDeviceIterator.hxx # End Source File # Begin Source File SOURCE=..\..\include\portaudiocpp\SystemHostApiIterator.hxx # End Source File # End Group # End Target # End Project ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc6/static_library.dsw ================================================ Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "static_library"=".\static_library.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7/OUT_OF_DATE ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7_1/devs_example.sln ================================================ Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devs_example", "devs_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}" ProjectSection(ProjectDependencies) = postProject {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32 {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32 {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32 {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7_1/devs_example.vcproj ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7_1/sine_example.sln ================================================ Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sine_example", "sine_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}" ProjectSection(ProjectDependencies) = postProject {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32 {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32 {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32 {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7_1/sine_example.vcproj ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7_1/static_library.sln ================================================ Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32 {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal ================================================ FILE: thirdparty/portaudio/bindings/cpp/build/vc7_1/static_library.vcproj ================================================ ================================================ FILE: thirdparty/portaudio/bindings/cpp/configure ================================================ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for PortAudioCpp 12. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='PortAudioCpp' PACKAGE_TARNAME='portaudiocpp' PACKAGE_VERSION='12' PACKAGE_STRING='PortAudioCpp 12' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="include/portaudiocpp/PortAudioCpp.hxx" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS LT_VERSION_INFO PORTAUDIO_ROOT DEFAULT_INCLUDES CXXCPP CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL OBJDUMP DLLTOOL AS host_os host_vendor host_cpu host build_os build_vendor build_cpu build am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures PortAudioCpp 12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/portaudiocpp] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of PortAudioCpp 12:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF PortAudioCpp configure 12 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by PortAudioCpp $as_me 12, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.14' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='portaudiocpp' VERSION='12' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ###### Top-level directory of pacpp ###### This makes it easy to shuffle the build directories ###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! PACPP_ROOT="\$(top_srcdir)" PORTAUDIO_ROOT="../.." # Various other variables and flags DEFAULT_INCLUDES="-I$PACPP_ROOT/include -I$PACPP_ROOT/$PORTAUDIO_ROOT/include" CFLAGS=${CFLAGS-"-g -O2 -Wall -ansi -pedantic"} CXXFLAGS=${CXXFLAGS-"${CFLAGS}"} LT_VERSION_INFO="0:12:0" # Checks for programs ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf # Set options enable_dlopen=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: # Transfer these variables to the Makefile ac_config_files="$ac_config_files Makefile lib/Makefile include/Makefile bin/Makefile doc/Makefile portaudiocpp.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by PortAudioCpp $as_me 12, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ PortAudioCpp config.status 12 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "bin/Makefile") CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "portaudiocpp.pc") CONFIG_FILES="$CONFIG_FILES portaudiocpp.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ================================================ FILE: thirdparty/portaudio/bindings/cpp/configure.ac ================================================ # # PortAudioCpp V19 autoconf input file # Shamelessly ripped from the PortAudio one by Dominic Mazzoni # Ludwig Schwardt # Customized for automake by Mikael Magnusson # # Require autoconf >= 2.13 AC_PREREQ(2.13) m4_define([lt_current], [0]) m4_define([lt_revision], [12]) m4_define([lt_age], [0]) AC_INIT([PortAudioCpp], [12]) AC_CONFIG_SRCDIR([include/portaudiocpp/PortAudioCpp.hxx]) AM_INIT_AUTOMAKE AM_MAINTAINER_MODE ###### Top-level directory of pacpp ###### This makes it easy to shuffle the build directories ###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! PACPP_ROOT="\$(top_srcdir)" PORTAUDIO_ROOT="../.." # Various other variables and flags DEFAULT_INCLUDES="-I$PACPP_ROOT/include -I$PACPP_ROOT/$PORTAUDIO_ROOT/include" CFLAGS=${CFLAGS-"-g -O2 -Wall -ansi -pedantic"} CXXFLAGS=${CXXFLAGS-"${CFLAGS}"} LT_VERSION_INFO="lt_current:lt_revision:lt_age" # Checks for programs AC_PROG_CC AC_PROG_CXX AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL # Transfer these variables to the Makefile AC_SUBST(DEFAULT_INCLUDES) AC_SUBST(PORTAUDIO_ROOT) AC_SUBST(CXXFLAGS) AC_SUBST(LT_VERSION_INFO) AC_CONFIG_FILES([ Makefile lib/Makefile include/Makefile bin/Makefile doc/Makefile portaudiocpp.pc ]) AC_OUTPUT ================================================ FILE: thirdparty/portaudio/bindings/cpp/doc/Makefile.am ================================================ PACPP_ROOT = . #INCLUDES = -I$(srcdir)/$(PACPP_ROOT)/include -I$(top_srcdir)/include docs: doxygen $(srcdir)/config.doxy.linux ================================================ FILE: thirdparty/portaudio/bindings/cpp/doc/Makefile.in ================================================ # Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_INCLUDES = @DEFAULT_INCLUDES@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION_INFO = @LT_VERSION_INFO@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PORTAUDIO_ROOT = @PORTAUDIO_ROOT@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PACPP_ROOT = . all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am #INCLUDES = -I$(srcdir)/$(PACPP_ROOT)/include -I$(top_srcdir)/include docs: doxygen $(srcdir)/config.doxy.linux # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ================================================ FILE: thirdparty/portaudio/bindings/cpp/doc/README ================================================ GNU/Linux: ---------- 1) Download and install a recent version of Doxygen (preferably version 1.3.3 or later). See http://www.doxygen.org/. 2) Download and install a recent version of GraphViz. See http://www.research.att.com/sw/tools/graphviz/. 3) Run ``doxygen config.doxy.linux'' in this directory or load and generate the file config.doxy.linux from the Doxywizard application. Or alternatively ``make docs'' can be run from the build/gnu folder. The generated html documentation will be placed in /doc/api_reference/. To open the main page of the documentation, open the file /doc/api_reference/index.html in an html browser. Windows: -------- 1) Download and install a recent Doxygen (preferably version 1.3.4 or later). See http://www.doxygen.org/. 2) Download and install a recent version of GraphViz. See http://www.research.att.com/sw/tools/graphviz/. 3) If needed, edit the config.doxy file in an ascii text editor so that ``DOT_PATH'' variable points to the folder where GraphViz is installed. 4) Run ``doxygen config.doxy'' in this directory or load and generate the file config.doxy from the Doxywizard application. The generated html documentation will be placed in /doc/api_reference/. To open the main page of the documentation, open the file /doc/api_reference/index.html in an html browser. ================================================ FILE: thirdparty/portaudio/bindings/cpp/doc/config.doxy ================================================ # Doxyfile 1.3.6 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = PortAudioCpp PROJECT_NUMBER = 2.0 OUTPUT_DIRECTORY = ./ OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = YES BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = SHORT_NAMES = YES JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = YES INHERIT_DOCS = YES DISTRIBUTE_GROUP_DOC = NO TAB_SIZE = 4 ALIASES = OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES 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 = NO 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 #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ../source \ ../include FILE_PATTERNS = *.hxx \ *.cxx RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES COLS_IN_ALPHA_INDEX = 2 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = api_reference HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 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 HIDE_UNDOC_RELATIONS = YES HAVE_DOT = YES CLASS_GRAPH = YES COLLABORATION_GRAPH = YES UML_LOOK = YES TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DOT_IMAGE_FORMAT = png DOT_PATH = "c:/Program Files/ATT/Graphviz/bin/" DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 0 GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO ================================================ FILE: thirdparty/portaudio/bindings/cpp/doc/config.doxy.linux ================================================ # Doxyfile 1.3.3 #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = PortAudioCpp PROJECT_NUMBER = 2.0 OUTPUT_DIRECTORY = ./ OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = YES EXTRACT_ALL = YES EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES SHORT_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = YES INHERIT_DOCS = YES INLINE_INFO = YES SORT_MEMBER_DOCS = NO DISTRIBUTE_GROUP_DOC = NO TAB_SIZE = 4 GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ALIASES = ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO SHOW_USED_FILES = YES SUBGROUPING = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ../source \ ../include FILE_PATTERNS = *.hxx \ *.cxx RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES COLS_IN_ALPHA_INDEX = 2 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = api_reference HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 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 = #--------------------------------------------------------------------------- # 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::addtions 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 HIDE_UNDOC_RELATIONS = YES HAVE_DOT = YES CLASS_GRAPH = YES COLLABORATION_GRAPH = YES UML_LOOK = YES TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DOT_IMAGE_FORMAT = png DOT_PATH = "/usr/bin/dot" DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 0 GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO CGI_NAME = search.cgi CGI_URL = DOC_URL = DOC_ABSPATH = BIN_ABSPATH = /usr/local/bin/ EXT_DOC_PATHS = ================================================ FILE: thirdparty/portaudio/bindings/cpp/example/devs.cxx ================================================ #include #include "portaudiocpp/PortAudioCpp.hxx" #ifdef WIN32 #include "portaudiocpp/AsioDeviceAdapter.hxx" #endif // --------------------------------------------------------------------------------------- void printSupportedStandardSampleRates( const portaudio::DirectionSpecificStreamParameters &inputParameters, const portaudio::DirectionSpecificStreamParameters &outputParameters) { static double STANDARD_SAMPLE_RATES[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0, 44100.0, 48000.0, 88200.0, 96000.0, -1 }; // negative terminated list int printCount = 0; for (int i = 0; STANDARD_SAMPLE_RATES[i] > 0; ++i) { portaudio::StreamParameters tmp = portaudio::StreamParameters(inputParameters, outputParameters, STANDARD_SAMPLE_RATES[i], 0, paNoFlag); if (tmp.isSupported()) { if (printCount == 0) { std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2 printCount = 1; } else if (printCount == 4) { std::cout << "," << std::endl; std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2 printCount = 1; } else { std::cout << ", " << STANDARD_SAMPLE_RATES[i]; // 8.2 ++printCount; } } } if (printCount == 0) std::cout << "None" << std::endl; else std::cout << std::endl; } // --------------------------------------------------------------------------------------- int main(int, char*[]); int main(int, char*[]) { try { portaudio::AutoSystem autoSys; portaudio::System &sys = portaudio::System::instance(); std::cout << "PortAudio version number = " << sys.version() << std::endl; std::cout << "PortAudio version text = '" << sys.versionText() << "'" << std::endl; int numDevices = sys.deviceCount(); std::cout << "Number of devices = " << numDevices << std::endl; for (portaudio::System::DeviceIterator i = sys.devicesBegin(); i != sys.devicesEnd(); ++i) { std::cout << "--------------------------------------- device #" << (*i).index() << std::endl; // Mark global and API specific default devices: bool defaultDisplayed = false; if ((*i).isSystemDefaultInputDevice()) { std::cout << "[ Default Input"; defaultDisplayed = true; } else if ((*i).isHostApiDefaultInputDevice()) { std::cout << "[ Default " << (*i).hostApi().name() << " Input"; defaultDisplayed = true; } if ((*i).isSystemDefaultOutputDevice()) { std::cout << (defaultDisplayed ? "," : "["); std::cout << " Default Output"; defaultDisplayed = true; } else if ((*i).isHostApiDefaultOutputDevice()) { std::cout << (defaultDisplayed ? "," : "["); std::cout << " Default " << (*i).hostApi().name() << " Output"; defaultDisplayed = true; } if (defaultDisplayed) std::cout << " ]" << std::endl; // Print device info: std::cout << "Name = " << (*i).name() << std::endl; std::cout << "Host API = " << (*i).hostApi().name() << std::endl; std::cout << "Max inputs = " << (*i).maxInputChannels() << ", Max outputs = " << (*i).maxOutputChannels() << std::endl; std::cout << "Default low input latency = " << (*i).defaultLowInputLatency() << std::endl; // 8.3 std::cout << "Default low output latency = " << (*i).defaultLowOutputLatency() << std::endl; // 8.3 std::cout << "Default high input latency = " << (*i).defaultHighInputLatency() << std::endl; // 8.3 std::cout << "Default high output latency = " << (*i).defaultHighOutputLatency() << std::endl; // 8.3 #ifdef WIN32 // ASIO specific latency information: if ((*i).hostApi().typeId() == paASIO) { portaudio::AsioDeviceAdapter asioDevice((*i)); std::cout << "ASIO minimum buffer size = " << asioDevice.minBufferSize() << std::endl; std::cout << "ASIO maximum buffer size = " << asioDevice.maxBufferSize() << std::endl; std::cout << "ASIO preferred buffer size = " << asioDevice.preferredBufferSize() << std::endl; if (asioDevice.granularity() == -1) std::cout << "ASIO buffer granularity = power of 2" << std::endl; else std::cout << "ASIO buffer granularity = " << asioDevice.granularity() << std::endl; } #endif // WIN32 std::cout << "Default sample rate = " << (*i).defaultSampleRate() << std::endl; // 8.2 // Poll for standard sample rates: portaudio::DirectionSpecificStreamParameters inputParameters((*i), (*i).maxInputChannels(), portaudio::INT16, true, 0.0, NULL); portaudio::DirectionSpecificStreamParameters outputParameters((*i), (*i).maxOutputChannels(), portaudio::INT16, true, 0.0, NULL); if (inputParameters.numChannels() > 0) { std::cout << "Supported standard sample rates" << std::endl; std::cout << " for half-duplex 16 bit " << inputParameters.numChannels() << " channel input = " << std::endl; printSupportedStandardSampleRates(inputParameters, portaudio::DirectionSpecificStreamParameters::null()); } if (outputParameters.numChannels() > 0) { std::cout << "Supported standard sample rates" << std::endl; std::cout << " for half-duplex 16 bit " << outputParameters.numChannels() << " channel output = " << std::endl; printSupportedStandardSampleRates(portaudio::DirectionSpecificStreamParameters::null(), outputParameters); } if (inputParameters.numChannels() > 0 && outputParameters.numChannels() > 0) { std::cout << "Supported standard sample rates" << std::endl; std::cout << " for full-duplex 16 bit " << inputParameters.numChannels() << " channel input, " << outputParameters.numChannels() << " channel output = " << std::endl; printSupportedStandardSampleRates(inputParameters, outputParameters); } } std::cout << "----------------------------------------------" << std::endl; } catch (const portaudio::PaException &e) { std::cout << "A PortAudio error occurred: " << e.paErrorText() << std::endl; } catch (const portaudio::PaCppException &e) { std::cout << "A PortAudioCpp error occurred: " << e.what() << std::endl; } catch (const std::exception &e) { std::cout << "A generic exception occurred: " << e.what() << std::endl; } catch (...) { std::cout << "An unknown exception occurred." << std::endl; } return 0; } ================================================ FILE: thirdparty/portaudio/bindings/cpp/example/sine.cxx ================================================ // --------------------------------------------------------------------------------------- #include #include #include #include #include "portaudiocpp/PortAudioCpp.hxx" // --------------------------------------------------------------------------------------- // Some constants: const int NUM_SECONDS = 5; const double SAMPLE_RATE = 44100.0; const int FRAMES_PER_BUFFER = 64; const int TABLE_SIZE = 200; // --------------------------------------------------------------------------------------- // SineGenerator class: class SineGenerator { public: SineGenerator(int tableSize) : tableSize_(tableSize), leftPhase_(0), rightPhase_(0) { const double PI = 3.14159265; table_ = new float[tableSize]; for (int i = 0; i < tableSize; ++i) { table_[i] = 0.125f * (float)sin(((double)i/(double)tableSize)*PI*2.); } } ~SineGenerator() { delete[] table_; } int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) { assert(outputBuffer != NULL); float **out = static_cast(outputBuffer); for (unsigned int i = 0; i < framesPerBuffer; ++i) { out[0][i] = table_[leftPhase_]; out[1][i] = table_[rightPhase_]; leftPhase_ += 1; if (leftPhase_ >= tableSize_) leftPhase_ -= tableSize_; rightPhase_ += 3; if (rightPhase_ >= tableSize_) rightPhase_ -= tableSize_; } return paContinue; } private: float *table_; int tableSize_; int leftPhase_; int rightPhase_; }; // --------------------------------------------------------------------------------------- // main: int main(int, char *[]); int main(int, char *[]) { try { // Create a SineGenerator object: SineGenerator sineGenerator(TABLE_SIZE); std::cout << "Setting up PortAudio..." << std::endl; // Set up the System: portaudio::AutoSystem autoSys; portaudio::System &sys = portaudio::System::instance(); // Set up the parameters required to open a (Callback)Stream: portaudio::DirectionSpecificStreamParameters outParams(sys.defaultOutputDevice(), 2, portaudio::FLOAT32, false, sys.defaultOutputDevice().defaultLowOutputLatency(), NULL); portaudio::StreamParameters params(portaudio::DirectionSpecificStreamParameters::null(), outParams, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff); std::cout << "Opening stereo output stream..." << std::endl; // Create (and open) a new Stream, using the SineGenerator::generate function as a callback: portaudio::MemFunCallbackStream stream(params, sineGenerator, &SineGenerator::generate); std::cout << "Starting playback for " << NUM_SECONDS << " seconds." << std::endl; // Start the Stream (audio playback starts): stream.start(); // Wait for 5 seconds: sys.sleep(NUM_SECONDS * 1000); std::cout << "Closing stream..." <&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = include DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(pkginclude_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_INCLUDES = @DEFAULT_INCLUDES@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION_INFO = @LT_VERSION_INFO@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PORTAUDIO_ROOT = @PORTAUDIO_ROOT@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkginclude_HEADERS = \ portaudiocpp/AutoSystem.hxx \ portaudiocpp/BlockingStream.hxx \ portaudiocpp/CallbackInterface.hxx \ portaudiocpp/CallbackStream.hxx \ portaudiocpp/CFunCallbackStream.hxx \ portaudiocpp/CppFunCallbackStream.hxx \ portaudiocpp/Device.hxx \ portaudiocpp/DirectionSpecificStreamParameters.hxx \ portaudiocpp/Exception.hxx \ portaudiocpp/HostApi.hxx \ portaudiocpp/InterfaceCallbackStream.hxx \ portaudiocpp/MemFunCallbackStream.hxx \ portaudiocpp/PortAudioCpp.hxx \ portaudiocpp/SampleDataFormat.hxx \ portaudiocpp/Stream.hxx \ portaudiocpp/StreamParameters.hxx \ portaudiocpp/SystemDeviceIterator.hxx \ portaudiocpp/SystemHostApiIterator.hxx \ portaudiocpp/System.hxx all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgincludeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkgincludeHEADERS install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkgincludeHEADERS # portaudiocpp/AsioDeviceAdapter.hxx # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX #define INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX namespace portaudio { // Forward declaration(s): class Device; // Declaration(s): ////// /// @brief Adapts the given Device to an ASIO specific extension. /// /// Deleting the AsioDeviceAdapter does not affect the underlying /// Device. ////// class AsioDeviceAdapter { public: AsioDeviceAdapter(Device &device); Device &device(); long minBufferSize() const; long maxBufferSize() const; long preferredBufferSize() const; long granularity() const; void showControlPanel(void *systemSpecific); const char *inputChannelName(int channelIndex) const; const char *outputChannelName(int channelIndex) const; private: Device *device_; long minBufferSize_; long maxBufferSize_; long preferredBufferSize_; long granularity_; }; } #endif // INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/AutoSystem.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX #define INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX // --------------------------------------------------------------------------------------- #include "portaudiocpp/System.hxx" // --------------------------------------------------------------------------------------- namespace portaudio { ////// /// @brief A RAII idiom class to ensure automatic clean-up when an exception is /// raised. /// /// A simple helper class which uses the 'Resource Acquisition is Initialization' /// idiom (RAII). Use this class to initialize/terminate the System rather than /// using System directly. AutoSystem must be created on stack and must be valid /// throughout the time you wish to use PortAudioCpp. Your 'main' function might be /// a good place for it. /// /// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually /// a good idea to make a reference to the System which can be accessed directly. /// @verbatim /// portaudio::AutoSys autoSys; /// portaudio::System &sys = portaudio::System::instance(); /// @endverbatim ////// class AutoSystem { public: AutoSystem(bool initialize = true) { if (initialize) System::initialize(); } ~AutoSystem() { if (System::exists()) System::terminate(); } void initialize() { System::initialize(); } void terminate() { System::terminate(); } }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/BlockingStream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX #define INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX // --------------------------------------------------------------------------------------- #include "portaudiocpp/Stream.hxx" // --------------------------------------------------------------------------------------- namespace portaudio { ////// /// @brief Stream class for blocking read/write-style input and output. ////// class BlockingStream : public Stream { public: BlockingStream(); BlockingStream(const StreamParameters ¶meters); ~BlockingStream(); void open(const StreamParameters ¶meters); void read(void *buffer, unsigned long numFrames); void write(const void *buffer, unsigned long numFrames); signed long availableReadSize() const; signed long availableWriteSize() const; private: BlockingStream(const BlockingStream &); // non-copyable BlockingStream &operator=(const BlockingStream &); // non-copyable }; } // portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX #define INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/CallbackStream.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s) namespace portaudio { class StreamParameters; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { // ----------------------------------------------------------------------------------- ////// /// @brief Callback stream using a free function with C linkage. It's important that the function /// the passed function pointer points to is declared ``extern "C"''. ////// class CFunCallbackStream : public CallbackStream { public: CFunCallbackStream(); CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); ~CFunCallbackStream(); void open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); private: CFunCallbackStream(const CFunCallbackStream &); // non-copyable CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable }; // ----------------------------------------------------------------------------------- } // portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX #define INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" // --------------------------------------------------------------------------------------- namespace portaudio { // ----------------------------------------------------------------------------------- ////// /// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the /// paCallbackFun method). ////// class CallbackInterface { public: virtual ~CallbackInterface() {} virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0; }; // ----------------------------------------------------------------------------------- namespace impl { extern "C" { int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData); } // extern "C" } // ----------------------------------------------------------------------------------- } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackStream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX #define INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/Stream.hxx" // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief Base class for all Streams which use a callback-based mechanism. ////// class CallbackStream : public Stream { protected: CallbackStream(); virtual ~CallbackStream(); public: // stream info (time-varying) double cpuLoad() const; private: CallbackStream(const CallbackStream &); // non-copyable CallbackStream &operator=(const CallbackStream &); // non-copyable }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX #define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/CallbackStream.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class StreamParameters; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { namespace impl { extern "C" { int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData); } // extern "C" } // ----------------------------------------------------------------------------------- ////// /// @brief Callback stream using a C++ function (either a free function or a static function) /// callback. ////// class FunCallbackStream : public CallbackStream { public: typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData); // ------------------------------------------------------------------------------- ////// /// @brief Simple structure containing a function pointer to the C++ callback function and a /// (void) pointer to the user supplied data. ////// struct CppToCCallbackData { CppToCCallbackData(); CppToCCallbackData(CallbackFunPtr funPtr, void *userData); void init(CallbackFunPtr funPtr, void *userData); CallbackFunPtr funPtr; void *userData; }; // ------------------------------------------------------------------------------- FunCallbackStream(); FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); ~FunCallbackStream(); void open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); private: FunCallbackStream(const FunCallbackStream &); // non-copyable FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable CppToCCallbackData adapterData_; void open(const StreamParameters ¶meters); }; } // portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/Device.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_DEVICE_HXX #define INCLUDED_PORTAUDIO_DEVICE_HXX // --------------------------------------------------------------------------------------- #include #include "portaudio.h" #include "portaudiocpp/SampleDataFormat.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class System; class HostApi; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief Class which represents a PortAudio device in the System. /// /// A single physical device in the system may have multiple PortAudio /// Device representations using different HostApi 's though. A Device /// can be half-duplex or full-duplex. A half-duplex Device can be used /// to create a half-duplex Stream. A full-duplex Device can be used to /// create a full-duplex Stream. If supported by the HostApi, two /// half-duplex Devices can even be used to create a full-duplex Stream. /// /// Note that Device objects are very light-weight and can be passed around /// by-value. ////// class Device { public: // query info: name, max in channels, max out channels, // default low/high input/output latency, default sample rate PaDeviceIndex index() const; const char *name() const; int maxInputChannels() const; int maxOutputChannels() const; PaTime defaultLowInputLatency() const; PaTime defaultHighInputLatency() const; PaTime defaultLowOutputLatency() const; PaTime defaultHighOutputLatency() const; double defaultSampleRate() const; bool isInputOnlyDevice() const; // extended bool isOutputOnlyDevice() const; // extended bool isFullDuplexDevice() const; // extended bool isSystemDefaultInputDevice() const; // extended bool isSystemDefaultOutputDevice() const; // extended bool isHostApiDefaultInputDevice() const; // extended bool isHostApiDefaultOutputDevice() const; // extended bool operator==(const Device &rhs) const; bool operator!=(const Device &rhs) const; // host api reference HostApi &hostApi(); const HostApi &hostApi() const; private: PaDeviceIndex index_; const PaDeviceInfo *info_; private: friend class System; explicit Device(PaDeviceIndex index); ~Device(); Device(const Device &); // non-copyable Device &operator=(const Device &); // non-copyable }; // ----------------------------------------------------------------------------------- } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_DEVICE_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX #define INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX // --------------------------------------------------------------------------------------- #include #include "portaudio.h" #include "portaudiocpp/System.hxx" #include "portaudiocpp/SampleDataFormat.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class Device; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief All parameters for one direction (either in or out) of a Stream. Together with /// parameters common to both directions, two DirectionSpecificStreamParameters can make up /// a StreamParameters object which contains all parameters for a Stream. ////// class DirectionSpecificStreamParameters { public: static DirectionSpecificStreamParameters null(); DirectionSpecificStreamParameters(); DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo); // Set up methods: void setDevice(const Device &device); void setNumChannels(int numChannels); void setSampleFormat(SampleDataFormat format, bool interleaved = true); void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true); void setSuggestedLatency(PaTime latency); void setHostApiSpecificStreamInfo(void *streamInfo); // Accessor methods: PaStreamParameters *paStreamParameters(); const PaStreamParameters *paStreamParameters() const; Device &device() const; int numChannels() const; SampleDataFormat sampleFormat() const; bool isSampleFormatInterleaved() const; bool isSampleFormatHostApiSpecific() const; PaSampleFormat hostApiSpecificSampleFormat() const; PaTime suggestedLatency() const; void *hostApiSpecificStreamInfo() const; private: PaStreamParameters paStreamParameters_; }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/Exception.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_EXCEPTION_HXX #define INCLUDED_PORTAUDIO_EXCEPTION_HXX // --------------------------------------------------------------------------------------- #include #include "portaudio.h" // --------------------------------------------------------------------------------------- namespace portaudio { ////// /// @brief Base class for all exceptions PortAudioCpp can throw. /// /// Class is derived from std::exception. ////// class Exception : public std::exception { public: virtual ~Exception() throw() {} virtual const char *what() const throw() = 0; }; // ----------------------------------------------------------------------------------- ////// /// @brief Wrapper for PortAudio error codes to C++ exceptions. /// /// It wraps up PortAudio's error handling mechanism using /// C++ exceptions and is derived from std::exception for /// easy exception handling and to ease integration with /// other code. /// /// To know what exceptions each function may throw, look up /// the errors that can occur in the PortAudio documentation /// for the equivalent functions. /// /// Some functions are likely to throw an exception (such as /// Stream::open(), etc) and these should always be called in /// try{} catch{} blocks and the thrown exceptions should be /// handled properly (ie. the application shouldn't just abort, /// but merely display a warning dialog to the user or something). /// However nearly all functions in PortAudioCpp are capable /// of throwing exceptions. When a function like Stream::isStopped() /// throws an exception, it's such an exceptional state that it's /// not likely that it can be recovered. PaExceptions such as these /// can ``safely'' be left to be handled by some outer catch-all-like /// mechanism for unrecoverable errors. ////// class PaException : public Exception { public: explicit PaException(PaError error); const char *what() const throw(); PaError paError() const; const char *paErrorText() const; bool isHostApiError() const; // extended long lastHostApiError() const; const char *lastHostApiErrorText() const; bool operator==(const PaException &rhs) const; bool operator!=(const PaException &rhs) const; private: PaError error_; }; // ----------------------------------------------------------------------------------- ////// /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an /// equivalent PortAudio error code). ////// class PaCppException : public Exception { public: enum ExceptionSpecifier { UNABLE_TO_ADAPT_DEVICE }; PaCppException(ExceptionSpecifier specifier); const char *what() const throw(); ExceptionSpecifier specifier() const; bool operator==(const PaCppException &rhs) const; bool operator!=(const PaCppException &rhs) const; private: ExceptionSpecifier specifier_; }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/HostApi.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_HOSTAPI_HXX #define INCLUDED_PORTAUDIO_HOSTAPI_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/System.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class Device; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief HostApi represents a host API (usually type of driver) in the System. /// /// A single System can support multiple HostApi's each one typically having /// a set of Devices using that HostApi (usually driver type). All Devices in /// the HostApi can be enumerated and the default input/output Device for this /// HostApi can be retrieved. ////// class HostApi { public: typedef System::DeviceIterator DeviceIterator; // query info: id, name, numDevices PaHostApiTypeId typeId() const; PaHostApiIndex index() const; const char *name() const; int deviceCount() const; // iterate devices DeviceIterator devicesBegin(); DeviceIterator devicesEnd(); // default devices Device &defaultInputDevice() const; Device &defaultOutputDevice() const; // comparison operators bool operator==(const HostApi &rhs) const; bool operator!=(const HostApi &rhs) const; private: const PaHostApiInfo *info_; Device **devices_; private: friend class System; explicit HostApi(PaHostApiIndex index); ~HostApi(); HostApi(const HostApi &); // non-copyable HostApi &operator=(const HostApi &); // non-copyable }; } // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX #define INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/CallbackStream.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s) namespace portaudio { class StreamParameters; class CallbackInterface; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface /// interface. ////// class InterfaceCallbackStream : public CallbackStream { public: InterfaceCallbackStream(); InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance); ~InterfaceCallbackStream(); void open(const StreamParameters ¶meters, CallbackInterface &instance); private: InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable }; } // portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX #define INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/CallbackStream.hxx" #include "portaudiocpp/CallbackInterface.hxx" #include "portaudiocpp/StreamParameters.hxx" #include "portaudiocpp/Exception.hxx" #include "portaudiocpp/InterfaceCallbackStream.hxx" // --------------------------------------------------------------------------------------- namespace portaudio { ////// /// @brief Callback stream using a class's member function as a callback. Template argument T is the type of the /// class of which a member function is going to be used. /// /// Example usage: /// @verbatim MemFunCallback stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim ////// template class MemFunCallbackStream : public CallbackStream { public: typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *, PaStreamCallbackFlags); // ------------------------------------------------------------------------------- MemFunCallbackStream() { } MemFunCallbackStream(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun) { open(parameters); } ~MemFunCallbackStream() { close(); } void open(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) { // XXX: need to check if already open? adapter_.init(instance, memFun); open(parameters); } private: MemFunCallbackStream(const MemFunCallbackStream &); // non-copyable MemFunCallbackStream &operator=(const MemFunCallbackStream &); // non-copyable ////// /// @brief Inner class which adapts a member function callback to a CallbackInterface compliant /// class (so it can be adapted using the paCallbackAdapter function). ////// class MemFunToCallbackInterfaceAdapter : public CallbackInterface { public: MemFunToCallbackInterfaceAdapter() {} MemFunToCallbackInterfaceAdapter(T &instance, CallbackFunPtr memFun) : instance_(&instance), memFun_(memFun) {} void init(T &instance, CallbackFunPtr memFun) { instance_ = &instance; memFun_ = memFun; } int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) { return (instance_->*memFun_)(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags); } private: T *instance_; CallbackFunPtr memFun_; }; MemFunToCallbackInterfaceAdapter adapter_; void open(const StreamParameters ¶meters) { PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast(&adapter_)); if (err != paNoError) throw PaException(err); } }; } // portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX #define INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX // --------------------------------------------------------------------------------------- ////// /// @mainpage PortAudioCpp /// ///

    PortAudioCpp - A Native C++ Binding of PortAudio V19

    ///

    PortAudio

    ///

    /// PortAudio is a portable and mature C API for accessing audio hardware. It offers both callback-based and blocking /// style input and output, deals with sample data format conversions, dithering and much more. There are a large number /// of implementations available for various platforms including Windows MME, Windows DirectX, Windows and MacOS (Classic) /// ASIO, MacOS Classic SoundManager, MacOS X CoreAudio, OSS (Linux), Linux ALSA, JACK (MacOS X and Linux) and SGI Irix /// AL. Note that, currently not all of these implementations are equally complete or up-to-date (as PortAudio V19 is /// still in development). Because PortAudio has a C API, it can easily be called from a variety of other programming /// languages. ///

    ///

    PortAudioCpp

    ///

    /// Although, it is possible to use PortAudio's C API from within a C++ program, this is usually a little awkward /// as procedural and object-oriented paradigms need to be mixed. PortAudioCpp aims to resolve this by encapsulating /// PortAudio's C API to form an equivalent object-oriented C++ API. It provides a more natural integration of PortAudio /// into C++ programs as well as a more structured interface. PortAudio's concepts were preserved as much as possible and /// no additional features were added except for some `convenience methods'. ///

    ///

    /// PortAudioCpp's main features are: ///

      ///
    • Structured object model.
    • ///
    • C++ exception handling instead of C-style error return codes.
    • ///
    • Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes /// derived from a given interface.
    • ///
    • STL compliant iterators to host APIs and devices.
    • ///
    • Some additional convenience functions to more easily set up and use PortAudio.
    • ///
    ///

    ///

    /// PortAudioCpp requires a recent version of the PortAudio V19 source code. This can be obtained from CVS or as a snapshot /// from the website. The examples also require the ASIO 2 SDK which can be obtained from the Steinberg website. Alternatively, the /// examples can easily be modified to compile without needing ASIO. ///

    ///

    /// Supported platforms: ///

      ///
    • Microsoft Visual C++ 6.0, 7.0 (.NET 2002) and 7.1 (.NET 2003).
    • ///
    • GNU G++ 2.95 and G++ 3.3.
    • ///
    /// Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant. ///

    ///

    /// This documentation mainly provides information specific to PortAudioCpp. For a more complete explanation of all of the /// concepts used, please consult the PortAudio documentation. ///

    ///

    /// PortAudioCpp was developed by Merlijn Blaauw with many great suggestions and help from Ross Bencina. Ludwig Schwardt provided /// GNU/Linux build files and checked G++ compatibility. PortAudioCpp may be used under the same licensing, conditions and /// warranty as PortAudio. See the PortAudio license for more details. ///

    ///

    Links

    ///

    /// Official PortAudio site.
    ///

    ////// // --------------------------------------------------------------------------------------- ////// /// @namespace portaudio /// /// To avoid name collision, everything in PortAudioCpp is in the portaudio /// namespace. If this name is too long it's usually pretty safe to use an /// alias like ``namespace pa = portaudio;''. ////// // --------------------------------------------------------------------------------------- ////// /// @file PortAudioCpp.hxx /// An include-all header file (for lazy programmers and using pre-compiled headers). ////// // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/AutoSystem.hxx" #include "portaudiocpp/BlockingStream.hxx" #include "portaudiocpp/CallbackInterface.hxx" #include "portaudiocpp/CallbackStream.hxx" #include "portaudiocpp/CFunCallbackStream.hxx" #include "portaudiocpp/CppFunCallbackStream.hxx" #include "portaudiocpp/Device.hxx" #include "portaudiocpp/Exception.hxx" #include "portaudiocpp/HostApi.hxx" #include "portaudiocpp/InterfaceCallbackStream.hxx" #include "portaudiocpp/MemFunCallbackStream.hxx" #include "portaudiocpp/SampleDataFormat.hxx" #include "portaudiocpp/DirectionSpecificStreamParameters.hxx" #include "portaudiocpp/Stream.hxx" #include "portaudiocpp/StreamParameters.hxx" #include "portaudiocpp/System.hxx" #include "portaudiocpp/SystemDeviceIterator.hxx" #include "portaudiocpp/SystemHostApiIterator.hxx" // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX #define INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" // --------------------------------------------------------------------------------------- namespace portaudio { ////// /// @brief PortAudio sample data formats. /// /// Small helper enum to wrap the PortAudio defines. ////// enum SampleDataFormat { INVALID_FORMAT = 0, FLOAT32 = paFloat32, INT32 = paInt32, INT24 = paInt24, INT16 = paInt16, INT8 = paInt8, UINT8 = paUInt8 }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/Stream.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_STREAM_HXX #define INCLUDED_PORTAUDIO_STREAM_HXX #include "portaudio.h" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class StreamParameters; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief A Stream represents an active or inactive input and/or output data /// stream in the System. /// /// Concrete Stream classes should ensure themselves being in a closed state at /// destruction (i.e. by calling their own close() method in their deconstructor). /// Following good C++ programming practices, care must be taken to ensure no /// exceptions are thrown by the deconstructor of these classes. As a consequence, /// clients need to explicitly call close() to ensure the stream closed successfully. /// /// The Stream object can be used to manipulate the Stream's state. Also, time-constant /// and time-varying information about the Stream can be retrieved. ////// class Stream { public: // Opening/closing: virtual ~Stream(); virtual void close(); bool isOpen() const; // Additional set up: void setStreamFinishedCallback(PaStreamFinishedCallback *callback); // State management: void start(); void stop(); void abort(); bool isStopped() const; bool isActive() const; // Stream info (time-constant, but might become time-variant soon): PaTime inputLatency() const; PaTime outputLatency() const; double sampleRate() const; // Stream info (time-varying): PaTime time() const; // Accessors for PortAudio PaStream, useful for interfacing // with PortAudio add-ons (such as PortMixer) for instance: const PaStream *paStream() const; PaStream *paStream(); protected: Stream(); // abstract class PaStream *stream_; private: Stream(const Stream &); // non-copyable Stream &operator=(const Stream &); // non-copyable }; } // namespace portaudio #endif // INCLUDED_PORTAUDIO_STREAM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX #define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" #include "portaudiocpp/DirectionSpecificStreamParameters.hxx" // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief The entire set of parameters needed to configure and open /// a Stream. /// /// It contains parameters of input, output and shared parameters. /// Using the isSupported() method, the StreamParameters can be /// checked if opening a Stream using this StreamParameters would /// succeed or not. Accessors are provided to higher-level parameters /// aswell as the lower-level parameters which are mainly intended for /// internal use. ////// class StreamParameters { public: StreamParameters(); StreamParameters(const DirectionSpecificStreamParameters &inputParameters, const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags flags); // Set up for direction-specific: void setInputParameters(const DirectionSpecificStreamParameters ¶meters); void setOutputParameters(const DirectionSpecificStreamParameters ¶meters); // Set up for common parameters: void setSampleRate(double sampleRate); void setFramesPerBuffer(unsigned long framesPerBuffer); void setFlag(PaStreamFlags flag); void unsetFlag(PaStreamFlags flag); void clearFlags(); // Validation: bool isSupported() const; // Accessors (direction-specific): DirectionSpecificStreamParameters &inputParameters(); const DirectionSpecificStreamParameters &inputParameters() const; DirectionSpecificStreamParameters &outputParameters(); const DirectionSpecificStreamParameters &outputParameters() const; // Accessors (common): double sampleRate() const; unsigned long framesPerBuffer() const; PaStreamFlags flags() const; bool isFlagSet(PaStreamFlags flag) const; private: // Half-duplex specific parameters: DirectionSpecificStreamParameters inputParameters_; DirectionSpecificStreamParameters outputParameters_; // Common parameters: double sampleRate_; unsigned long framesPerBuffer_; PaStreamFlags flags_; }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/System.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_SYSTEM_HXX #define INCLUDED_PORTAUDIO_SYSTEM_HXX // --------------------------------------------------------------------------------------- #include "portaudio.h" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class Device; class Stream; class HostApi; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief System singleton which represents the PortAudio system. /// /// The System is used to initialize/terminate PortAudio and provide /// a single access point to the PortAudio System (instance()). /// It can be used to iterate through all HostApi 's in the System as /// well as all devices in the System. It also provides some utility /// functionality of PortAudio. /// /// Terminating the System will also abort and close the open streams. /// The Stream objects will need to be deallocated by the client though /// (it's usually a good idea to have them cleaned up automatically). ////// class System { public: class HostApiIterator; // forward declaration class DeviceIterator; // forward declaration // ------------------------------------------------------------------------------- static int version(); static const char *versionText(); static void initialize(); static void terminate(); static System &instance(); static bool exists(); // ------------------------------------------------------------------------------- // host apis: HostApiIterator hostApisBegin(); HostApiIterator hostApisEnd(); HostApi &defaultHostApi(); HostApi &hostApiByTypeId(PaHostApiTypeId type); HostApi &hostApiByIndex(PaHostApiIndex index); int hostApiCount(); // ------------------------------------------------------------------------------- // devices: DeviceIterator devicesBegin(); DeviceIterator devicesEnd(); Device &defaultInputDevice(); Device &defaultOutputDevice(); Device &deviceByIndex(PaDeviceIndex index); int deviceCount(); static Device &nullDevice(); // ------------------------------------------------------------------------------- // misc: void sleep(long msec); int sizeOfSample(PaSampleFormat format); private: System(); ~System(); static System *instance_; static int initCount_; static HostApi **hostApis_; static Device **devices_; static Device *nullDevice_; }; } // namespace portaudio #endif // INCLUDED_PORTAUDIO_SYSTEM_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX #define INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX // --------------------------------------------------------------------------------------- #include #include #include "portaudiocpp/System.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class Device; class HostApi; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief Iterator class for iterating through all Devices in a System. /// /// Devices will be iterated by iterating all Devices in each /// HostApi in the System. Compliant with the STL bidirectional /// iterator concept. ////// class System::DeviceIterator { public: typedef std::bidirectional_iterator_tag iterator_category; typedef Device value_type; typedef ptrdiff_t difference_type; typedef Device * pointer; typedef Device & reference; Device &operator*() const; Device *operator->() const; DeviceIterator &operator++(); DeviceIterator operator++(int); DeviceIterator &operator--(); DeviceIterator operator--(int); bool operator==(const DeviceIterator &rhs) const; bool operator!=(const DeviceIterator &rhs) const; private: friend class System; friend class HostApi; Device **ptr_; }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx ================================================ #ifndef INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX #define INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX // --------------------------------------------------------------------------------------- #include #include #include "portaudiocpp/System.hxx" // --------------------------------------------------------------------------------------- // Forward declaration(s): namespace portaudio { class HostApi; } // --------------------------------------------------------------------------------------- // Declaration(s): namespace portaudio { ////// /// @brief Iterator class for iterating through all HostApis in a System. /// /// Compliant with the STL bidirectional iterator concept. ////// class System::HostApiIterator { public: typedef std::bidirectional_iterator_tag iterator_category; typedef Device value_type; typedef ptrdiff_t difference_type; typedef HostApi * pointer; typedef HostApi & reference; HostApi &operator*() const; HostApi *operator->() const; HostApiIterator &operator++(); HostApiIterator operator++(int); HostApiIterator &operator--(); HostApiIterator operator--(int); bool operator==(const HostApiIterator &rhs) const; bool operator!=(const HostApiIterator &rhs) const; private: friend class System; HostApi **ptr_; }; } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX ================================================ FILE: thirdparty/portaudio/bindings/cpp/lib/Makefile.am ================================================ SRCDIR = $(top_srcdir)/source/portaudiocpp lib_LTLIBRARIES = libportaudiocpp.la LDADD = libportaudiocpp.la libportaudiocpp_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined libportaudiocpp_la_LIBADD = $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la libportaudiocpp_la_SOURCES = \ $(SRCDIR)/BlockingStream.cxx \ $(SRCDIR)/CallbackInterface.cxx \ $(SRCDIR)/CallbackStream.cxx \ $(SRCDIR)/CFunCallbackStream.cxx \ $(SRCDIR)/CppFunCallbackStream.cxx \ $(SRCDIR)/Device.cxx \ $(SRCDIR)/DirectionSpecificStreamParameters.cxx \ $(SRCDIR)/Exception.cxx \ $(SRCDIR)/HostApi.cxx \ $(SRCDIR)/InterfaceCallbackStream.cxx \ $(SRCDIR)/MemFunCallbackStream.cxx \ $(SRCDIR)/Stream.cxx \ $(SRCDIR)/StreamParameters.cxx \ $(SRCDIR)/System.cxx \ $(SRCDIR)/SystemDeviceIterator.cxx \ $(SRCDIR)/SystemHostApiIterator.cxx ================================================ FILE: thirdparty/portaudio/bindings/cpp/lib/Makefile.in ================================================ # Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/../../depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libportaudiocpp_la_DEPENDENCIES = \ $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la am_libportaudiocpp_la_OBJECTS = BlockingStream.lo CallbackInterface.lo \ CallbackStream.lo CFunCallbackStream.lo \ CppFunCallbackStream.lo Device.lo \ DirectionSpecificStreamParameters.lo Exception.lo HostApi.lo \ InterfaceCallbackStream.lo MemFunCallbackStream.lo Stream.lo \ StreamParameters.lo System.lo SystemDeviceIterator.lo \ SystemHostApiIterator.lo libportaudiocpp_la_OBJECTS = $(am_libportaudiocpp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libportaudiocpp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(AM_CXXFLAGS) $(CXXFLAGS) $(libportaudiocpp_la_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = $(SHELL) $(top_srcdir)/../../depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(libportaudiocpp_la_SOURCES) DIST_SOURCES = $(libportaudiocpp_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_INCLUDES = @DEFAULT_INCLUDES@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION_INFO = @LT_VERSION_INFO@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PORTAUDIO_ROOT = @PORTAUDIO_ROOT@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SRCDIR = $(top_srcdir)/source/portaudiocpp lib_LTLIBRARIES = libportaudiocpp.la LDADD = libportaudiocpp.la libportaudiocpp_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined libportaudiocpp_la_LIBADD = $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la libportaudiocpp_la_SOURCES = \ $(SRCDIR)/BlockingStream.cxx \ $(SRCDIR)/CallbackInterface.cxx \ $(SRCDIR)/CallbackStream.cxx \ $(SRCDIR)/CFunCallbackStream.cxx \ $(SRCDIR)/CppFunCallbackStream.cxx \ $(SRCDIR)/Device.cxx \ $(SRCDIR)/DirectionSpecificStreamParameters.cxx \ $(SRCDIR)/Exception.cxx \ $(SRCDIR)/HostApi.cxx \ $(SRCDIR)/InterfaceCallbackStream.cxx \ $(SRCDIR)/MemFunCallbackStream.cxx \ $(SRCDIR)/Stream.cxx \ $(SRCDIR)/StreamParameters.cxx \ $(SRCDIR)/System.cxx \ $(SRCDIR)/SystemDeviceIterator.cxx \ $(SRCDIR)/SystemHostApiIterator.cxx all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libportaudiocpp.la: $(libportaudiocpp_la_OBJECTS) $(libportaudiocpp_la_DEPENDENCIES) $(EXTRA_libportaudiocpp_la_DEPENDENCIES) $(AM_V_CXXLD)$(libportaudiocpp_la_LINK) -rpath $(libdir) $(libportaudiocpp_la_OBJECTS) $(libportaudiocpp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlockingStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CFunCallbackStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CallbackInterface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CallbackStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CppFunCallbackStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DirectionSpecificStreamParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Exception.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HostApi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InterfaceCallbackStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MemFunCallbackStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Stream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/System.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemDeviceIterator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemHostApiIterator.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< BlockingStream.lo: $(SRCDIR)/BlockingStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT BlockingStream.lo -MD -MP -MF $(DEPDIR)/BlockingStream.Tpo -c -o BlockingStream.lo `test -f '$(SRCDIR)/BlockingStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/BlockingStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/BlockingStream.Tpo $(DEPDIR)/BlockingStream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/BlockingStream.cxx' object='BlockingStream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o BlockingStream.lo `test -f '$(SRCDIR)/BlockingStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/BlockingStream.cxx CallbackInterface.lo: $(SRCDIR)/CallbackInterface.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CallbackInterface.lo -MD -MP -MF $(DEPDIR)/CallbackInterface.Tpo -c -o CallbackInterface.lo `test -f '$(SRCDIR)/CallbackInterface.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackInterface.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/CallbackInterface.Tpo $(DEPDIR)/CallbackInterface.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/CallbackInterface.cxx' object='CallbackInterface.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CallbackInterface.lo `test -f '$(SRCDIR)/CallbackInterface.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackInterface.cxx CallbackStream.lo: $(SRCDIR)/CallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CallbackStream.lo -MD -MP -MF $(DEPDIR)/CallbackStream.Tpo -c -o CallbackStream.lo `test -f '$(SRCDIR)/CallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/CallbackStream.Tpo $(DEPDIR)/CallbackStream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/CallbackStream.cxx' object='CallbackStream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CallbackStream.lo `test -f '$(SRCDIR)/CallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackStream.cxx CFunCallbackStream.lo: $(SRCDIR)/CFunCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/CFunCallbackStream.Tpo -c -o CFunCallbackStream.lo `test -f '$(SRCDIR)/CFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CFunCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/CFunCallbackStream.Tpo $(DEPDIR)/CFunCallbackStream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/CFunCallbackStream.cxx' object='CFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CFunCallbackStream.lo `test -f '$(SRCDIR)/CFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CFunCallbackStream.cxx CppFunCallbackStream.lo: $(SRCDIR)/CppFunCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CppFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/CppFunCallbackStream.Tpo -c -o CppFunCallbackStream.lo `test -f '$(SRCDIR)/CppFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CppFunCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/CppFunCallbackStream.Tpo $(DEPDIR)/CppFunCallbackStream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/CppFunCallbackStream.cxx' object='CppFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CppFunCallbackStream.lo `test -f '$(SRCDIR)/CppFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CppFunCallbackStream.cxx Device.lo: $(SRCDIR)/Device.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Device.lo -MD -MP -MF $(DEPDIR)/Device.Tpo -c -o Device.lo `test -f '$(SRCDIR)/Device.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Device.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Device.Tpo $(DEPDIR)/Device.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/Device.cxx' object='Device.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Device.lo `test -f '$(SRCDIR)/Device.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Device.cxx DirectionSpecificStreamParameters.lo: $(SRCDIR)/DirectionSpecificStreamParameters.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DirectionSpecificStreamParameters.lo -MD -MP -MF $(DEPDIR)/DirectionSpecificStreamParameters.Tpo -c -o DirectionSpecificStreamParameters.lo `test -f '$(SRCDIR)/DirectionSpecificStreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/DirectionSpecificStreamParameters.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/DirectionSpecificStreamParameters.Tpo $(DEPDIR)/DirectionSpecificStreamParameters.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/DirectionSpecificStreamParameters.cxx' object='DirectionSpecificStreamParameters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DirectionSpecificStreamParameters.lo `test -f '$(SRCDIR)/DirectionSpecificStreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/DirectionSpecificStreamParameters.cxx Exception.lo: $(SRCDIR)/Exception.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Exception.lo -MD -MP -MF $(DEPDIR)/Exception.Tpo -c -o Exception.lo `test -f '$(SRCDIR)/Exception.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Exception.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Exception.Tpo $(DEPDIR)/Exception.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/Exception.cxx' object='Exception.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Exception.lo `test -f '$(SRCDIR)/Exception.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Exception.cxx HostApi.lo: $(SRCDIR)/HostApi.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT HostApi.lo -MD -MP -MF $(DEPDIR)/HostApi.Tpo -c -o HostApi.lo `test -f '$(SRCDIR)/HostApi.cxx' || echo '$(srcdir)/'`$(SRCDIR)/HostApi.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/HostApi.Tpo $(DEPDIR)/HostApi.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/HostApi.cxx' object='HostApi.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o HostApi.lo `test -f '$(SRCDIR)/HostApi.cxx' || echo '$(srcdir)/'`$(SRCDIR)/HostApi.cxx InterfaceCallbackStream.lo: $(SRCDIR)/InterfaceCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT InterfaceCallbackStream.lo -MD -MP -MF $(DEPDIR)/InterfaceCallbackStream.Tpo -c -o InterfaceCallbackStream.lo `test -f '$(SRCDIR)/InterfaceCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/InterfaceCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/InterfaceCallbackStream.Tpo $(DEPDIR)/InterfaceCallbackStream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/InterfaceCallbackStream.cxx' object='InterfaceCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InterfaceCallbackStream.lo `test -f '$(SRCDIR)/InterfaceCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/InterfaceCallbackStream.cxx MemFunCallbackStream.lo: $(SRCDIR)/MemFunCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MemFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/MemFunCallbackStream.Tpo -c -o MemFunCallbackStream.lo `test -f '$(SRCDIR)/MemFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/MemFunCallbackStream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/MemFunCallbackStream.Tpo $(DEPDIR)/MemFunCallbackStream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/MemFunCallbackStream.cxx' object='MemFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MemFunCallbackStream.lo `test -f '$(SRCDIR)/MemFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/MemFunCallbackStream.cxx Stream.lo: $(SRCDIR)/Stream.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Stream.lo -MD -MP -MF $(DEPDIR)/Stream.Tpo -c -o Stream.lo `test -f '$(SRCDIR)/Stream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Stream.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Stream.Tpo $(DEPDIR)/Stream.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/Stream.cxx' object='Stream.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Stream.lo `test -f '$(SRCDIR)/Stream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Stream.cxx StreamParameters.lo: $(SRCDIR)/StreamParameters.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT StreamParameters.lo -MD -MP -MF $(DEPDIR)/StreamParameters.Tpo -c -o StreamParameters.lo `test -f '$(SRCDIR)/StreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/StreamParameters.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/StreamParameters.Tpo $(DEPDIR)/StreamParameters.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/StreamParameters.cxx' object='StreamParameters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o StreamParameters.lo `test -f '$(SRCDIR)/StreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/StreamParameters.cxx System.lo: $(SRCDIR)/System.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT System.lo -MD -MP -MF $(DEPDIR)/System.Tpo -c -o System.lo `test -f '$(SRCDIR)/System.cxx' || echo '$(srcdir)/'`$(SRCDIR)/System.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/System.Tpo $(DEPDIR)/System.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/System.cxx' object='System.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o System.lo `test -f '$(SRCDIR)/System.cxx' || echo '$(srcdir)/'`$(SRCDIR)/System.cxx SystemDeviceIterator.lo: $(SRCDIR)/SystemDeviceIterator.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SystemDeviceIterator.lo -MD -MP -MF $(DEPDIR)/SystemDeviceIterator.Tpo -c -o SystemDeviceIterator.lo `test -f '$(SRCDIR)/SystemDeviceIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemDeviceIterator.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SystemDeviceIterator.Tpo $(DEPDIR)/SystemDeviceIterator.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/SystemDeviceIterator.cxx' object='SystemDeviceIterator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SystemDeviceIterator.lo `test -f '$(SRCDIR)/SystemDeviceIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemDeviceIterator.cxx SystemHostApiIterator.lo: $(SRCDIR)/SystemHostApiIterator.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SystemHostApiIterator.lo -MD -MP -MF $(DEPDIR)/SystemHostApiIterator.Tpo -c -o SystemHostApiIterator.lo `test -f '$(SRCDIR)/SystemHostApiIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemHostApiIterator.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SystemHostApiIterator.Tpo $(DEPDIR)/SystemHostApiIterator.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/SystemHostApiIterator.cxx' object='SystemHostApiIterator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SystemHostApiIterator.lo `test -f '$(SRCDIR)/SystemHostApiIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemHostApiIterator.cxx mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ================================================ FILE: thirdparty/portaudio/bindings/cpp/portaudiocpp.pc.in ================================================ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: PortAudioCpp Description: Portable audio I/O C++ bindings Version: 12 Requires: portaudio-2.0 Libs: -L${libdir} -lportaudiocpp Cflags: -I${includedir} ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx ================================================ #include "portaudiocpp/AsioDeviceAdapter.hxx" #include "portaudio.h" #include "pa_asio.h" #include "portaudiocpp/Device.hxx" #include "portaudiocpp/HostApi.hxx" #include "portaudiocpp/Exception.hxx" namespace portaudio { AsioDeviceAdapter::AsioDeviceAdapter(Device &device) { if (device.hostApi().typeId() != paASIO) throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE); device_ = &device; PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_, &preferredBufferSize_, &granularity_); if (err != paNoError) throw PaException(err); } Device &AsioDeviceAdapter::device() { return *device_; } long AsioDeviceAdapter::minBufferSize() const { return minBufferSize_; } long AsioDeviceAdapter::maxBufferSize() const { return maxBufferSize_; } long AsioDeviceAdapter::preferredBufferSize() const { return preferredBufferSize_; } long AsioDeviceAdapter::granularity() const { return granularity_; } void AsioDeviceAdapter::showControlPanel(void *systemSpecific) { PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific); if (err != paNoError) throw PaException(err); } const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const { const char *channelName; PaError err = PaAsio_GetInputChannelName(device_->index(), channelIndex, &channelName); if (err != paNoError) throw PaException(err); return channelName; } const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const { const char *channelName; PaError err = PaAsio_GetOutputChannelName(device_->index(), channelIndex, &channelName); if (err != paNoError) throw PaException(err); return channelName; } } ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx ================================================ #include "portaudiocpp/BlockingStream.hxx" #include "portaudio.h" #include "portaudiocpp/StreamParameters.hxx" #include "portaudiocpp/Exception.hxx" namespace portaudio { // -------------------------------------------------------------------------------------- BlockingStream::BlockingStream() { } BlockingStream::BlockingStream(const StreamParameters ¶meters) { open(parameters); } BlockingStream::~BlockingStream() { try { close(); } catch (...) { // ignore all errors } } // -------------------------------------------------------------------------------------- void BlockingStream::open(const StreamParameters ¶meters) { PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL); if (err != paNoError) { throw PaException(err); } } // -------------------------------------------------------------------------------------- void BlockingStream::read(void *buffer, unsigned long numFrames) { PaError err = Pa_ReadStream(stream_, buffer, numFrames); if (err != paNoError) { throw PaException(err); } } void BlockingStream::write(const void *buffer, unsigned long numFrames) { PaError err = Pa_WriteStream(stream_, buffer, numFrames); if (err != paNoError) { throw PaException(err); } } // -------------------------------------------------------------------------------------- signed long BlockingStream::availableReadSize() const { signed long avail = Pa_GetStreamReadAvailable(stream_); if (avail < 0) { throw PaException(avail); } return avail; } signed long BlockingStream::availableWriteSize() const { signed long avail = Pa_GetStreamWriteAvailable(stream_); if (avail < 0) { throw PaException(avail); } return avail; } // -------------------------------------------------------------------------------------- } // portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx ================================================ #include "portaudiocpp/CFunCallbackStream.hxx" #include "portaudiocpp/StreamParameters.hxx" #include "portaudiocpp/Exception.hxx" namespace portaudio { CFunCallbackStream::CFunCallbackStream() { } CFunCallbackStream::CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData) { open(parameters, funPtr, userData); } CFunCallbackStream::~CFunCallbackStream() { try { close(); } catch (...) { // ignore all errors } } // ---------------------------------------------------------------------------------== void CFunCallbackStream::open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData) { PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData); if (err != paNoError) { throw PaException(err); } } } ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx ================================================ #include "portaudiocpp/CallbackInterface.hxx" namespace portaudio { namespace impl { ////// /// Adapts any CallbackInterface object to a C-callable function (ie this function). A /// pointer to the object should be passed as ``userData'' when setting up the callback. ////// int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) { CallbackInterface *cb = static_cast(userData); return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags); } } // namespace impl } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx ================================================ #include "portaudiocpp/CallbackStream.hxx" namespace portaudio { CallbackStream::CallbackStream() { } CallbackStream::~CallbackStream() { } // ----------------------------------------------------------------------------------- double CallbackStream::cpuLoad() const { return Pa_GetStreamCpuLoad(stream_); } } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx ================================================ #include "portaudiocpp/CppFunCallbackStream.hxx" #include "portaudiocpp/StreamParameters.hxx" #include "portaudiocpp/Exception.hxx" namespace portaudio { namespace impl { ////// /// Adapts any a C++ callback to a C-callable function (ie this function). A /// pointer to a struct with the C++ function pointer and the actual user data should be /// passed as the ``userData'' parameter when setting up the callback. ////// int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) { FunCallbackStream::CppToCCallbackData *data = static_cast(userData); return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData); } } // ----------------------------------------------------------------------------------- FunCallbackStream::CppToCCallbackData::CppToCCallbackData() { } FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData) { } void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData) { this->funPtr = funPtr; this->userData = userData; } // ----------------------------------------------------------------------------------- FunCallbackStream::FunCallbackStream() { } FunCallbackStream::FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData) { open(parameters); } FunCallbackStream::~FunCallbackStream() { try { close(); } catch (...) { // ignore all errors } } void FunCallbackStream::open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) { adapterData_.init(funPtr, userData); open(parameters); } void FunCallbackStream::open(const StreamParameters ¶meters) { PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter, static_cast(&adapterData_)); if (err != paNoError) { throw PaException(err); } } // ----------------------------------------------------------------------------------- } ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/Device.cxx ================================================ #include "portaudiocpp/Device.hxx" #include #include "portaudiocpp/HostApi.hxx" #include "portaudiocpp/System.hxx" #include "portaudiocpp/Exception.hxx" namespace portaudio { // ------------------------------------------------------------------------------- Device::Device(PaDeviceIndex index) : index_(index) { if (index == paNoDevice) info_ = NULL; else info_ = Pa_GetDeviceInfo(index); } Device::~Device() { } PaDeviceIndex Device::index() const { return index_; } const char *Device::name() const { if (info_ == NULL) return ""; return info_->name; } int Device::maxInputChannels() const { if (info_ == NULL) return 0; return info_->maxInputChannels; } int Device::maxOutputChannels() const { if (info_ == NULL) return 0; return info_->maxOutputChannels; } PaTime Device::defaultLowInputLatency() const { if (info_ == NULL) return static_cast(0.0); return info_->defaultLowInputLatency; } PaTime Device::defaultHighInputLatency() const { if (info_ == NULL) return static_cast(0.0); return info_->defaultHighInputLatency; } PaTime Device::defaultLowOutputLatency() const { if (info_ == NULL) return static_cast(0.0); return info_->defaultLowOutputLatency; } PaTime Device::defaultHighOutputLatency() const { if (info_ == NULL) return static_cast(0.0); return info_->defaultHighOutputLatency; } double Device::defaultSampleRate() const { if (info_ == NULL) return 0.0; return info_->defaultSampleRate; } // ------------------------------------------------------------------------------- bool Device::isInputOnlyDevice() const { return (maxOutputChannels() == 0); } bool Device::isOutputOnlyDevice() const { return (maxInputChannels() == 0); } bool Device::isFullDuplexDevice() const { return (maxInputChannels() > 0 && maxOutputChannels() > 0); } bool Device::isSystemDefaultInputDevice() const { return (System::instance().defaultInputDevice() == *this); } bool Device::isSystemDefaultOutputDevice() const { return (System::instance().defaultOutputDevice() == *this); } bool Device::isHostApiDefaultInputDevice() const { return (hostApi().defaultInputDevice() == *this); } bool Device::isHostApiDefaultOutputDevice() const { return (hostApi().defaultOutputDevice() == *this); } // ------------------------------------------------------------------------------- bool Device::operator==(const Device &rhs) const { return (index_ == rhs.index_); } bool Device::operator!=(const Device &rhs) const { return !(*this == rhs); } // ------------------------------------------------------------------------------- HostApi &Device::hostApi() { // NOTE: will cause an exception when called for the null device if (info_ == NULL) throw PaException(paInternalError); return System::instance().hostApiByIndex(info_->hostApi); } const HostApi &Device::hostApi() const { // NOTE; will cause an exception when called for the null device if (info_ == NULL) throw PaException(paInternalError); return System::instance().hostApiByIndex(info_->hostApi); } // ------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx ================================================ #include "portaudiocpp/DirectionSpecificStreamParameters.hxx" #include "portaudiocpp/Device.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- ////// /// Returns a `nil' DirectionSpecificStreamParameters object. This can be used to /// specify that one direction of a Stream is not required (i.e. when creating /// a half-duplex Stream). All fields of the null DirectionSpecificStreamParameters /// object are invalid except for the device and the number of channel, which are set /// to paNoDevice and 0 respectively. ////// DirectionSpecificStreamParameters DirectionSpecificStreamParameters::null() { DirectionSpecificStreamParameters tmp; tmp.paStreamParameters_.device = paNoDevice; tmp.paStreamParameters_.channelCount = 0; return tmp; } // ----------------------------------------------------------------------------------- ////// /// Default constructor -- all parameters will be uninitialized. ////// DirectionSpecificStreamParameters::DirectionSpecificStreamParameters() { } ////// /// Constructor which sets all required fields. ////// DirectionSpecificStreamParameters::DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo) { setDevice(device); setNumChannels(numChannels); setSampleFormat(format, interleaved); setSuggestedLatency(suggestedLatency); setHostApiSpecificStreamInfo(hostApiSpecificStreamInfo); } // ----------------------------------------------------------------------------------- void DirectionSpecificStreamParameters::setDevice(const Device &device) { paStreamParameters_.device = device.index(); } void DirectionSpecificStreamParameters::setNumChannels(int numChannels) { paStreamParameters_.channelCount = numChannels; } void DirectionSpecificStreamParameters::setSampleFormat(SampleDataFormat format, bool interleaved) { paStreamParameters_.sampleFormat = static_cast(format); if (!interleaved) paStreamParameters_.sampleFormat |= paNonInterleaved; } void DirectionSpecificStreamParameters::setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved) { paStreamParameters_.sampleFormat = format; paStreamParameters_.sampleFormat |= paCustomFormat; if (!interleaved) paStreamParameters_.sampleFormat |= paNonInterleaved; } void DirectionSpecificStreamParameters::setSuggestedLatency(PaTime latency) { paStreamParameters_.suggestedLatency = latency; } void DirectionSpecificStreamParameters::setHostApiSpecificStreamInfo(void *streamInfo) { paStreamParameters_.hostApiSpecificStreamInfo = streamInfo; } // ----------------------------------------------------------------------------------- PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() { if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice) return &paStreamParameters_; else return NULL; } const PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() const { if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice) return &paStreamParameters_; else return NULL; } Device &DirectionSpecificStreamParameters::device() const { return System::instance().deviceByIndex(paStreamParameters_.device); } int DirectionSpecificStreamParameters::numChannels() const { return paStreamParameters_.channelCount; } ////// /// Returns the (non host api-specific) sample format, without including /// the paNonInterleaved flag. If the sample format is host api-spefific, /// INVALID_FORMAT (0) will be returned. ////// SampleDataFormat DirectionSpecificStreamParameters::sampleFormat() const { if (isSampleFormatHostApiSpecific()) return INVALID_FORMAT; else return static_cast(paStreamParameters_.sampleFormat & ~paNonInterleaved); } bool DirectionSpecificStreamParameters::isSampleFormatInterleaved() const { return ((paStreamParameters_.sampleFormat & paNonInterleaved) == 0); } bool DirectionSpecificStreamParameters::isSampleFormatHostApiSpecific() const { return ((paStreamParameters_.sampleFormat & paCustomFormat) == 0); } ////// /// Returns the host api-specific sample format, without including any /// paCustomFormat or paNonInterleaved flags. Will return 0 if the sample format is /// not host api-specific. ////// PaSampleFormat DirectionSpecificStreamParameters::hostApiSpecificSampleFormat() const { if (isSampleFormatHostApiSpecific()) return paStreamParameters_.sampleFormat & ~paCustomFormat & ~paNonInterleaved; else return 0; } PaTime DirectionSpecificStreamParameters::suggestedLatency() const { return paStreamParameters_.suggestedLatency; } void *DirectionSpecificStreamParameters::hostApiSpecificStreamInfo() const { return paStreamParameters_.hostApiSpecificStreamInfo; } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx ================================================ #include "portaudiocpp/Exception.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- // PaException: // ----------------------------------------------------------------------------------- ////// /// Wraps a PortAudio error into a PortAudioCpp PaException. ////// PaException::PaException(PaError error) : error_(error) { } // ----------------------------------------------------------------------------------- ////// /// Alias for paErrorText(), to have std::exception compliance. ////// const char *PaException::what() const throw() { return paErrorText(); } // ----------------------------------------------------------------------------------- ////// /// Returns the PortAudio error code (PaError). ////// PaError PaException::paError() const { return error_; } ////// /// Returns the error as a (zero-terminated) text string. ////// const char *PaException::paErrorText() const { return Pa_GetErrorText(error_); } ////// /// Returns true is the error is a HostApi error. ////// bool PaException::isHostApiError() const { return (error_ == paUnanticipatedHostError); } ////// /// Returns the last HostApi error (which is the current one if /// isHostApiError() returns true) as an error code. ////// long PaException::lastHostApiError() const { return Pa_GetLastHostErrorInfo()->errorCode; } ////// /// Returns the last HostApi error (which is the current one if /// isHostApiError() returns true) as a (zero-terminated) text /// string, if it's available. ////// const char *PaException::lastHostApiErrorText() const { return Pa_GetLastHostErrorInfo()->errorText; } // ----------------------------------------------------------------------------------- bool PaException::operator==(const PaException &rhs) const { return (error_ == rhs.error_); } bool PaException::operator!=(const PaException &rhs) const { return !(*this == rhs); } // ----------------------------------------------------------------------------------- // PaCppException: // ----------------------------------------------------------------------------------- PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier) { } const char *PaCppException::what() const throw() { switch (specifier_) { case UNABLE_TO_ADAPT_DEVICE: { return "Unable to adapt the given device to the specified host api specific device extension"; } } return "Unknown exception"; } PaCppException::ExceptionSpecifier PaCppException::specifier() const { return specifier_; } bool PaCppException::operator==(const PaCppException &rhs) const { return (specifier_ == rhs.specifier_); } bool PaCppException::operator!=(const PaCppException &rhs) const { return !(*this == rhs); } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx ================================================ #include "portaudiocpp/HostApi.hxx" #include "portaudiocpp/System.hxx" #include "portaudiocpp/Device.hxx" #include "portaudiocpp/SystemDeviceIterator.hxx" #include "portaudiocpp/Exception.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- HostApi::HostApi(PaHostApiIndex index) : devices_(NULL) { try { info_ = Pa_GetHostApiInfo(index); // Create and populate devices array: int numDevices = deviceCount(); devices_ = new Device*[numDevices]; for (int i = 0; i < numDevices; ++i) { PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i); if (deviceIndex < 0) { throw PaException(deviceIndex); } devices_[i] = &System::instance().deviceByIndex(deviceIndex); } } catch (const std::exception &e) { // Delete any (partially) constructed objects (deconstructor isn't called): delete[] devices_; // devices_ is either NULL or valid // Re-throw exception: throw e; } } HostApi::~HostApi() { // Destroy devices array: delete[] devices_; } // ----------------------------------------------------------------------------------- PaHostApiTypeId HostApi::typeId() const { return info_->type; } PaHostApiIndex HostApi::index() const { PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId()); if (index < 0) throw PaException(index); return index; } const char *HostApi::name() const { return info_->name; } int HostApi::deviceCount() const { return info_->deviceCount; } // ----------------------------------------------------------------------------------- HostApi::DeviceIterator HostApi::devicesBegin() { DeviceIterator tmp; tmp.ptr_ = &devices_[0]; // begin (first element) return tmp; } HostApi::DeviceIterator HostApi::devicesEnd() { DeviceIterator tmp; tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element) return tmp; } // ----------------------------------------------------------------------------------- Device &HostApi::defaultInputDevice() const { return System::instance().deviceByIndex(info_->defaultInputDevice); } Device &HostApi::defaultOutputDevice() const { return System::instance().deviceByIndex(info_->defaultOutputDevice); } // ----------------------------------------------------------------------------------- bool HostApi::operator==(const HostApi &rhs) const { return (typeId() == rhs.typeId()); } bool HostApi::operator!=(const HostApi &rhs) const { return !(*this == rhs); } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx ================================================ #include "portaudiocpp/InterfaceCallbackStream.hxx" #include "portaudiocpp/StreamParameters.hxx" #include "portaudiocpp/Exception.hxx" #include "portaudiocpp/CallbackInterface.hxx" namespace portaudio { // ---------------------------------------------------------------------------------== InterfaceCallbackStream::InterfaceCallbackStream() { } InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance) { open(parameters, instance); } InterfaceCallbackStream::~InterfaceCallbackStream() { try { close(); } catch (...) { // ignore all errors } } // ---------------------------------------------------------------------------------== void InterfaceCallbackStream::open(const StreamParameters ¶meters, CallbackInterface &instance) { PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast(&instance)); if (err != paNoError) { throw PaException(err); } } } ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx ================================================ #include "portaudiocpp/MemFunCallbackStream.hxx" // (... template class ...) ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/Stream.cxx ================================================ #include "portaudiocpp/Stream.hxx" #include #include "portaudiocpp/Exception.hxx" #include "portaudiocpp/System.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- Stream::Stream() : stream_(NULL) { } Stream::~Stream() { // (can't call close here, // the derived class should atleast call // close() in it's deconstructor) } // ----------------------------------------------------------------------------------- ////// /// Closes the Stream if it's open, else does nothing. ////// void Stream::close() { if (isOpen() && System::exists()) { PaError err = Pa_CloseStream(stream_); stream_ = NULL; if (err != paNoError) throw PaException(err); } } ////// /// Returns true if the Stream is open. ////// bool Stream::isOpen() const { return (stream_ != NULL); } // ----------------------------------------------------------------------------------- void Stream::setStreamFinishedCallback(PaStreamFinishedCallback *callback) { PaError err = Pa_SetStreamFinishedCallback(stream_, callback); if (err != paNoError) throw PaException(err); } // ----------------------------------------------------------------------------------- void Stream::start() { PaError err = Pa_StartStream(stream_); if (err != paNoError) throw PaException(err); } void Stream::stop() { PaError err = Pa_StopStream(stream_); if (err != paNoError) throw PaException(err); } void Stream::abort() { PaError err = Pa_AbortStream(stream_); if (err != paNoError) throw PaException(err); } bool Stream::isStopped() const { PaError ret = Pa_IsStreamStopped(stream_); if (ret < 0) throw PaException(ret); return (ret == 1); } bool Stream::isActive() const { PaError ret = Pa_IsStreamActive(stream_); if (ret < 0) throw PaException(ret); return (ret == 1); } // ----------------------------------------------------------------------------------- ////// /// Returns the best known input latency for the Stream. This value may differ from the /// suggested input latency set in the StreamParameters. Includes all sources of /// latency known to PortAudio such as internal buffering, and Host API reported latency. /// Doesn't include any estimates of unknown latency. ////// PaTime Stream::inputLatency() const { const PaStreamInfo *info = Pa_GetStreamInfo(stream_); if (info == NULL) { throw PaException(paInternalError); return PaTime(0.0); } return info->inputLatency; } ////// /// Returns the best known output latency for the Stream. This value may differ from the /// suggested output latency set in the StreamParameters. Includes all sources of /// latency known to PortAudio such as internal buffering, and Host API reported latency. /// Doesn't include any estimates of unknown latency. ////// PaTime Stream::outputLatency() const { const PaStreamInfo *info = Pa_GetStreamInfo(stream_); if (info == NULL) { throw PaException(paInternalError); return PaTime(0.0); } return info->outputLatency; } ////// /// Returns the sample rate of the Stream. Usually this will be the /// best known estimate of the used sample rate. For instance when opening a /// Stream setting 44100.0 Hz in the StreamParameters, the actual sample /// rate might be something like 44103.2 Hz (due to imperfections in the /// sound card hardware). ////// double Stream::sampleRate() const { const PaStreamInfo *info = Pa_GetStreamInfo(stream_); if (info == NULL) { throw PaException(paInternalError); return 0.0; } return info->sampleRate; } // ----------------------------------------------------------------------------------- PaTime Stream::time() const { return Pa_GetStreamTime(stream_); } // ----------------------------------------------------------------------------------- ////// /// Accessor (const) for PortAudio PaStream pointer, useful for interfacing with /// PortAudio add-ons such as PortMixer for instance. Normally accessing this /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's /// functionality. ////// const PaStream *Stream::paStream() const { return stream_; } ////// /// Accessor (non-const) for PortAudio PaStream pointer, useful for interfacing with /// PortAudio add-ons such as PortMixer for instance. Normally accessing this /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's /// functionality. ////// PaStream *Stream::paStream() { return stream_; } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/StreamParameters.cxx ================================================ #include "portaudiocpp/StreamParameters.hxx" #include #include "portaudiocpp/Device.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- ////// /// Default constructor; does nothing. ////// StreamParameters::StreamParameters() { } ////// /// Sets up the all parameters needed to open either a half-duplex or full-duplex Stream. /// /// @param inputParameters The parameters for the input direction of the to-be opened /// Stream or DirectionSpecificStreamParameters::null() for an output-only Stream. /// @param outputParameters The parameters for the output direction of the to-be opened /// Stream or DirectionSpecificStreamParameters::null() for an input-only Stream. /// @param sampleRate The to-be opened Stream's sample rate in Hz. /// @param framesPerBuffer The number of frames per buffer for a CallbackStream, or /// the preferred buffer granularity for a BlockingStream. /// @param flags The flags for the to-be opened Stream; default paNoFlag. ////// StreamParameters::StreamParameters(const DirectionSpecificStreamParameters &inputParameters, const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags flags) : inputParameters_(inputParameters), outputParameters_(outputParameters), sampleRate_(sampleRate), framesPerBuffer_(framesPerBuffer), flags_(flags) { } // ----------------------------------------------------------------------------------- ////// /// Sets the requested sample rate. If this sample rate isn't supported by the hardware, the /// Stream will fail to open. The real-life sample rate used might differ slightly due to /// imperfections in the sound card hardware; use Stream::sampleRate() to retrieve the /// best known estimate for this value. ////// void StreamParameters::setSampleRate(double sampleRate) { sampleRate_ = sampleRate; } ////// /// Either the number of frames per buffer for a CallbackStream, or /// the preferred buffer granularity for a BlockingStream. See PortAudio /// documentation. ////// void StreamParameters::setFramesPerBuffer(unsigned long framesPerBuffer) { framesPerBuffer_ = framesPerBuffer; } ////// /// Sets the specified flag or does nothing when the flag is already set. Doesn't /// `unset' any previously existing flags (use clearFlags() for that). ////// void StreamParameters::setFlag(PaStreamFlags flag) { flags_ |= flag; } ////// /// Unsets the specified flag or does nothing if the flag isn't set. Doesn't affect /// any other flags. ////// void StreamParameters::unsetFlag(PaStreamFlags flag) { flags_ &= ~flag; } ////// /// Clears or `unsets' all set flags. ////// void StreamParameters::clearFlags() { flags_ = paNoFlag; } // ----------------------------------------------------------------------------------- void StreamParameters::setInputParameters(const DirectionSpecificStreamParameters ¶meters) { inputParameters_ = parameters; } void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters ¶meters) { outputParameters_ = parameters; } // ----------------------------------------------------------------------------------- bool StreamParameters::isSupported() const { return (Pa_IsFormatSupported(inputParameters_.paStreamParameters(), outputParameters_.paStreamParameters(), sampleRate_) == paFormatIsSupported); } // ----------------------------------------------------------------------------------- double StreamParameters::sampleRate() const { return sampleRate_; } unsigned long StreamParameters::framesPerBuffer() const { return framesPerBuffer_; } ////// /// Returns all currently set flags as a binary combined /// integer value (PaStreamFlags). Use isFlagSet() to /// avoid dealing with the bitmasks. ////// PaStreamFlags StreamParameters::flags() const { return flags_; } ////// /// Returns true if the specified flag is currently set /// or false if it isn't. ////// bool StreamParameters::isFlagSet(PaStreamFlags flag) const { return ((flags_ & flag) != 0); } // ----------------------------------------------------------------------------------- DirectionSpecificStreamParameters &StreamParameters::inputParameters() { return inputParameters_; } const DirectionSpecificStreamParameters &StreamParameters::inputParameters() const { return inputParameters_; } DirectionSpecificStreamParameters &StreamParameters::outputParameters() { return outputParameters_; } const DirectionSpecificStreamParameters &StreamParameters::outputParameters() const { return outputParameters_; } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/System.cxx ================================================ #include "portaudiocpp/System.hxx" #include #include #include "portaudiocpp/HostApi.hxx" #include "portaudiocpp/Device.hxx" #include "portaudiocpp/Stream.hxx" #include "portaudiocpp/Exception.hxx" #include "portaudiocpp/SystemHostApiIterator.hxx" #include "portaudiocpp/SystemDeviceIterator.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- // Static members: System *System::instance_ = NULL; int System::initCount_ = 0; HostApi **System::hostApis_ = NULL; Device **System::devices_ = NULL; Device *System::nullDevice_ = NULL; // ----------------------------------------------------------------------------------- int System::version() { return Pa_GetVersion(); } const char *System::versionText() { return Pa_GetVersionText(); } void System::initialize() { ++initCount_; if (initCount_ == 1) { // Create singleton: assert(instance_ == NULL); instance_ = new System(); // Initialize the PortAudio system: { PaError err = Pa_Initialize(); if (err != paNoError) throw PaException(err); } // Create and populate device array: { int numDevices = instance().deviceCount(); devices_ = new Device*[numDevices]; for (int i = 0; i < numDevices; ++i) devices_[i] = new Device(i); } // Create and populate host api array: { int numHostApis = instance().hostApiCount(); hostApis_ = new HostApi*[numHostApis]; for (int i = 0; i < numHostApis; ++i) hostApis_[i] = new HostApi(i); } // Create null device: nullDevice_ = new Device(paNoDevice); } } void System::terminate() { PaError err = paNoError; if (initCount_ == 1) { // Destroy null device: delete nullDevice_; // Destroy host api array: { if (hostApis_ != NULL) { int numHostApis = instance().hostApiCount(); for (int i = 0; i < numHostApis; ++i) delete hostApis_[i]; delete[] hostApis_; hostApis_ = NULL; } } // Destroy device array: { if (devices_ != NULL) { int numDevices = instance().deviceCount(); for (int i = 0; i < numDevices; ++i) delete devices_[i]; delete[] devices_; devices_ = NULL; } } // Terminate the PortAudio system: assert(instance_ != NULL); err = Pa_Terminate(); // Destroy singleton: delete instance_; instance_ = NULL; } if (initCount_ > 0) --initCount_; if (err != paNoError) throw PaException(err); } System &System::instance() { assert(exists()); return *instance_; } bool System::exists() { return (instance_ != NULL); } // ----------------------------------------------------------------------------------- System::HostApiIterator System::hostApisBegin() { System::HostApiIterator tmp; tmp.ptr_ = &hostApis_[0]; // begin (first element) return tmp; } System::HostApiIterator System::hostApisEnd() { int count = hostApiCount(); System::HostApiIterator tmp; tmp.ptr_ = &hostApis_[count]; // end (one past last element) return tmp; } HostApi &System::defaultHostApi() { PaHostApiIndex defaultHostApi = Pa_GetDefaultHostApi(); if (defaultHostApi < 0) throw PaException(defaultHostApi); return *hostApis_[defaultHostApi]; } HostApi &System::hostApiByTypeId(PaHostApiTypeId type) { PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(type); if (index < 0) throw PaException(index); return *hostApis_[index]; } HostApi &System::hostApiByIndex(PaHostApiIndex index) { if (index < 0 || index >= hostApiCount()) throw PaException(paInternalError); return *hostApis_[index]; } int System::hostApiCount() { PaHostApiIndex count = Pa_GetHostApiCount(); if (count < 0) throw PaException(count); return count; } // ----------------------------------------------------------------------------------- System::DeviceIterator System::devicesBegin() { DeviceIterator tmp; tmp.ptr_ = &devices_[0]; return tmp; } System::DeviceIterator System::devicesEnd() { int count = deviceCount(); DeviceIterator tmp; tmp.ptr_ = &devices_[count]; return tmp; } ////// /// Returns the System's default input Device, or the null Device if none /// was available. ////// Device &System::defaultInputDevice() { PaDeviceIndex index = Pa_GetDefaultInputDevice(); return deviceByIndex(index); } ////// /// Returns the System's default output Device, or the null Device if none /// was available. ////// Device &System::defaultOutputDevice() { PaDeviceIndex index = Pa_GetDefaultOutputDevice(); return deviceByIndex(index); } ////// /// Returns the Device for the given index. /// Will throw a paInternalError equivalent PaException if the given index /// is out of range. ////// Device &System::deviceByIndex(PaDeviceIndex index) { if (index < -1 || index >= deviceCount()) { throw PaException(paInternalError); } if (index == -1) return System::instance().nullDevice(); return *devices_[index]; } int System::deviceCount() { PaDeviceIndex count = Pa_GetDeviceCount(); if (count < 0) throw PaException(count); return count; } Device &System::nullDevice() { return *nullDevice_; } // ----------------------------------------------------------------------------------- void System::sleep(long msec) { Pa_Sleep(msec); } int System::sizeOfSample(PaSampleFormat format) { PaError err = Pa_GetSampleSize(format); if (err < 0) { throw PaException(err); return 0; } return err; } // ----------------------------------------------------------------------------------- System::System() { // (left blank intentionally) } System::~System() { // (left blank intentionally) } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx ================================================ #include "portaudiocpp/SystemDeviceIterator.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- Device &System::DeviceIterator::operator*() const { return **ptr_; } Device *System::DeviceIterator::operator->() const { return &**this; } // ----------------------------------------------------------------------------------- System::DeviceIterator &System::DeviceIterator::operator++() { ++ptr_; return *this; } System::DeviceIterator System::DeviceIterator::operator++(int) { System::DeviceIterator prev = *this; ++*this; return prev; } System::DeviceIterator &System::DeviceIterator::operator--() { --ptr_; return *this; } System::DeviceIterator System::DeviceIterator::operator--(int) { System::DeviceIterator prev = *this; --*this; return prev; } // ----------------------------------------------------------------------------------- bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const { return (ptr_ == rhs.ptr_); } bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const { return !(*this == rhs); } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx ================================================ #include "portaudiocpp/SystemHostApiIterator.hxx" namespace portaudio { // ----------------------------------------------------------------------------------- HostApi &System::HostApiIterator::operator*() const { return **ptr_; } HostApi *System::HostApiIterator::operator->() const { return &**this; } // ----------------------------------------------------------------------------------- System::HostApiIterator &System::HostApiIterator::operator++() { ++ptr_; return *this; } System::HostApiIterator System::HostApiIterator::operator++(int) { System::HostApiIterator prev = *this; ++*this; return prev; } System::HostApiIterator &System::HostApiIterator::operator--() { --ptr_; return *this; } System::HostApiIterator System::HostApiIterator::operator--(int) { System::HostApiIterator prev = *this; --*this; return prev; } // ----------------------------------------------------------------------------------- bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const { return (ptr_ == rhs.ptr_); } bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const { return !(*this == rhs); } // ----------------------------------------------------------------------------------- } // namespace portaudio ================================================ FILE: thirdparty/portaudio/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.sln ================================================  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PortAudioJNI", "PortAudioJNI.vcxproj", "{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.ActiveCfg = Debug|Win32 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.Build.0 = Debug|Win32 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.ActiveCfg = Debug|x64 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.Build.0 = Debug|x64 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.ActiveCfg = Release|Win32 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.Build.0 = Release|Win32 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.ActiveCfg = Release|x64 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: thirdparty/portaudio/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcproj ================================================ ================================================ FILE: thirdparty/portaudio/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcxproj ================================================  Debug Win32 Debug x64 Release Win32 Release x64 {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB} PortAudioJNI Win32Proj DynamicLibrary Unicode true DynamicLibrary Unicode true DynamicLibrary Unicode DynamicLibrary Unicode <_ProjectFileVersion>10.0.30319.1 ..\..\..\..\jportaudio\ ..\..\..\..\jportaudio\ $(Configuration)\ $(Configuration)\ true true ..\..\..\..\jportaudio\ ..\..\..\..\jportaudio\ $(Configuration)\ $(Configuration)\ false false jportaudio_x64 jportaudio_x86 jportaudio_x86 jportaudio_x64 Disabled ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32 WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 EditAndContinue true Windows MachineX86 Disabled ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32 WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 ProgramDatabase true Windows MaxSpeed true WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32 true Windows true true MachineX86 MaxSpeed true WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32 true Windows true true ================================================ FILE: thirdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.c ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ #include "com_portaudio_BlockingStream.h" #include "portaudio.h" #include "jpa_tools.h" #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (!FALSE) #endif /* * Class: com_portaudio_BlockingStream * Method: getReadAvailable * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getReadAvailable (JNIEnv *env, jobject blockingStream) { PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( stream == NULL ) return 0; return Pa_GetStreamReadAvailable( stream ); } /* * Class: com_portaudio_BlockingStream * Method: getWriteAvailable * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getWriteAvailable (JNIEnv *env, jobject blockingStream) { PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( stream == NULL ) return 0; return Pa_GetStreamWriteAvailable( stream ); } /* * Class: com_portaudio_BlockingStream * Method: writeFloats * Signature: ([FI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeFloats (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames) { jfloat *carr; jint err; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( buffer == NULL ) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "null stream buffer"); return FALSE; } carr = (*env)->GetFloatArrayElements(env, buffer, NULL); if (carr == NULL) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "invalid stream buffer"); return FALSE; } err = Pa_WriteStream( stream, carr, numFrames ); (*env)->ReleaseFloatArrayElements(env, buffer, carr, 0); if( err == paOutputUnderflowed ) { return TRUE; } else { jpa_CheckError( env, err ); return FALSE; } } /* * Class: com_portaudio_BlockingStream * Method: readFloats * Signature: ([FI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readFloats (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames) { jfloat *carr; jint err; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( buffer == NULL ) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "null stream buffer"); return FALSE; } carr = (*env)->GetFloatArrayElements(env, buffer, NULL); if (carr == NULL) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "invalid stream buffer"); return FALSE; } err = Pa_ReadStream( stream, carr, numFrames ); (*env)->ReleaseFloatArrayElements(env, buffer, carr, 0); if( err == paInputOverflowed ) { return TRUE; } else { jpa_CheckError( env, err ); return FALSE; } } /* * Class: com_portaudio_BlockingStream * Method: writeShorts * Signature: ([SI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeShorts (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames) { jshort *carr; jint err; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( buffer == NULL ) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "null stream buffer"); return FALSE; } carr = (*env)->GetShortArrayElements(env, buffer, NULL); if (carr == NULL) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "invalid stream buffer"); return FALSE; } err = Pa_WriteStream( stream, carr, numFrames ); (*env)->ReleaseShortArrayElements(env, buffer, carr, 0); if( err == paOutputUnderflowed ) { return TRUE; } else { jpa_CheckError( env, err ); return FALSE; } } /* * Class: com_portaudio_BlockingStream * Method: readShorts * Signature: ([SI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readShorts (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames) { jshort *carr; jint err; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( buffer == NULL ) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "null stream buffer"); return FALSE; } carr = (*env)->GetShortArrayElements(env, buffer, NULL); if (carr == NULL) { (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"), "invalid stream buffer"); return FALSE; } err = Pa_ReadStream( stream, carr, numFrames ); (*env)->ReleaseShortArrayElements(env, buffer, carr, 0); if( err == paInputOverflowed ) { return TRUE; } else { jpa_CheckError( env, err ); return FALSE; } } /* * Class: com_portaudio_BlockingStream * Method: start * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_start (JNIEnv *env, jobject blockingStream ) { PaStream *stream = jpa_GetStreamPointer( env, blockingStream ); int err = Pa_StartStream( stream ); jpa_CheckError( env, err ); } /* * Class: com_portaudio_BlockingStream * Method: stop * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_stop (JNIEnv *env, jobject blockingStream ) { PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); int err = Pa_StopStream( stream ); jpa_CheckError( env, err ); } /* * Class: com_portaudio_BlockingStream * Method: abort * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_abort (JNIEnv *env, jobject blockingStream ) { PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); int err = Pa_AbortStream( stream ); jpa_CheckError( env, err ); } /* * Class: com_portaudio_BlockingStream * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_close (JNIEnv *env, jobject blockingStream ) { jclass cls; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( stream != NULL ) { int err = Pa_CloseStream( stream ); jpa_CheckError( env, err ); cls = (*env)->GetObjectClass(env, blockingStream); jpa_SetLongField( env, cls, blockingStream, "nativeStream", (jlong) 0 ); } } /* * Class: com_portaudio_BlockingStream * Method: isStopped * Signature: ()V */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isStopped (JNIEnv *env, jobject blockingStream ) { int err; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( stream == NULL ) return 1; err = Pa_IsStreamStopped( stream ); return (jpa_CheckError( env, err ) > 0); } /* * Class: com_portaudio_BlockingStream * Method: isActive * Signature: ()V */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isActive (JNIEnv *env, jobject blockingStream ) { int err; PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( stream == NULL ) return 0; err = Pa_IsStreamActive( stream ); return (jpa_CheckError( env, err ) > 0); } /* * Class: com_portaudio_BlockingStream * Method: getTime * Signature: ()D */ JNIEXPORT jdouble JNICALL Java_com_portaudio_BlockingStream_getTime (JNIEnv *env, jobject blockingStream ) { PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); if( stream == NULL ) return 0.0; return Pa_GetStreamTime( stream ); } /* * Class: com_portaudio_BlockingStream * Method: getInfo * Signature: ()Lcom/portaudio/StreamInfo; */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_getInfo (JNIEnv *env, jobject blockingStream, jobject streamInfo) { PaStream *stream =jpa_GetStreamPointer( env, blockingStream ); const PaStreamInfo *info = Pa_GetStreamInfo( stream ); if( streamInfo == NULL ) { jpa_ThrowError( env, "Invalid stream." ); } else { /* Get a reference to obj's class */ jclass cls = (*env)->GetObjectClass(env, streamInfo); jpa_SetIntField( env, cls, streamInfo, "structVersion", info->structVersion ); jpa_SetDoubleField( env, cls, streamInfo, "inputLatency", info->inputLatency ); jpa_SetDoubleField( env, cls, streamInfo, "outputLatency", info->outputLatency ); jpa_SetDoubleField( env, cls, streamInfo, "sampleRate", info->sampleRate ); } } ================================================ FILE: thirdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.h ================================================ /* DO NOT EDIT THIS FILE - it is machine generated */ #if defined(__APPLE__) #include #else #include #endif /* Header for class com_portaudio_BlockingStream */ #ifndef _Included_com_portaudio_BlockingStream #define _Included_com_portaudio_BlockingStream #ifdef __cplusplus extern "C" { #endif /* * Class: com_portaudio_BlockingStream * Method: getReadAvailable * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getReadAvailable (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: getWriteAvailable * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getWriteAvailable (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: readFloats * Signature: ([FI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readFloats (JNIEnv *, jobject, jfloatArray, jint); /* * Class: com_portaudio_BlockingStream * Method: writeFloats * Signature: ([FI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeFloats (JNIEnv *, jobject, jfloatArray, jint); /* * Class: com_portaudio_BlockingStream * Method: readShorts * Signature: ([SI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readShorts (JNIEnv *, jobject, jshortArray, jint); /* * Class: com_portaudio_BlockingStream * Method: writeShorts * Signature: ([SI)Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeShorts (JNIEnv *, jobject, jshortArray, jint); /* * Class: com_portaudio_BlockingStream * Method: start * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_start (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: stop * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_stop (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: abort * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_abort (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_close (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: isStopped * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isStopped (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: isActive * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isActive (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: getTime * Signature: ()D */ JNIEXPORT jdouble JNICALL Java_com_portaudio_BlockingStream_getTime (JNIEnv *, jobject); /* * Class: com_portaudio_BlockingStream * Method: getInfo * Signature: (Lcom/portaudio/StreamInfo;)V */ JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_getInfo (JNIEnv *, jobject, jobject); #ifdef __cplusplus } #endif #endif ================================================ FILE: thirdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.c ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ #include "com_portaudio_PortAudio.h" #include "portaudio.h" #include "jpa_tools.h" /* * Class: com_portaudio_PortAudio * Method: getVersion * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getVersion (JNIEnv *env, jclass clazz) { return Pa_GetVersion(); } /* * Class: com_portaudio_PortAudio * Method: getVersionText * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_com_portaudio_PortAudio_getVersionText (JNIEnv *env, jclass clazz) { return (*env)->NewStringUTF(env, Pa_GetVersionText() ); } /* * Class: com_portaudio_PortAudio * Method: initialize * Signature: ()I */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_initialize (JNIEnv *env, jclass clazz) { PaError err = Pa_Initialize(); jpa_CheckError( env, err ); } /* * Class: com_portaudio_PortAudio * Method: terminate * Signature: ()I */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_terminate (JNIEnv *env, jclass clazz) { PaError err = Pa_Terminate(); jpa_CheckError( env, err ); } /* * Class: com_portaudio_PortAudio * Method: getDeviceCount * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDeviceCount (JNIEnv *env, jclass clazz) { jint count = Pa_GetDeviceCount(); return jpa_CheckError( env, count ); } /* * Class: com_portaudio_PortAudio * Method: getDeviceInfo * Signature: (ILcom/portaudio/DeviceInfo;)I */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getDeviceInfo (JNIEnv *env, jclass clazz, jint index, jobject deviceInfo) { const PaDeviceInfo *info; /* Get a reference to obj's class */ jclass cls = (*env)->GetObjectClass(env, deviceInfo); info = Pa_GetDeviceInfo( index ); if( info == NULL ) { jpa_ThrowError( env, "Pa_GetDeviceInfo returned NULL." ); } else { jpa_SetStringField( env, cls, deviceInfo, "name", info->name ); jpa_SetIntField( env, cls, deviceInfo, "maxInputChannels", info->maxInputChannels ); jpa_SetIntField( env, cls, deviceInfo, "maxOutputChannels", info->maxOutputChannels ); jpa_SetIntField( env, cls, deviceInfo, "hostApi", info->hostApi ); jpa_SetDoubleField( env, cls, deviceInfo, "defaultSampleRate", info->defaultSampleRate ); jpa_SetDoubleField( env, cls, deviceInfo, "defaultLowInputLatency", info->defaultLowInputLatency ); jpa_SetDoubleField( env, cls, deviceInfo, "defaultLowInputLatency", info->defaultHighInputLatency ); jpa_SetDoubleField( env, cls, deviceInfo, "defaultLowOutputLatency", info->defaultLowOutputLatency ); jpa_SetDoubleField( env, cls, deviceInfo, "defaultHighOutputLatency", info->defaultHighOutputLatency ); } } /* * Class: com_portaudio_PortAudio * Method: geHostApiCount * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getHostApiCount (JNIEnv *env, jclass clazz) { jint count = Pa_GetHostApiCount(); return jpa_CheckError( env, count ); } /* * Class: com_portaudio_PortAudio * Method: hostApiTypeIdToHostApiIndex * Signature: (I)I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiTypeIdToHostApiIndex (JNIEnv *env, jclass clazz, jint hostApiType) { return Pa_HostApiTypeIdToHostApiIndex( (PaHostApiTypeId) hostApiType ); } /* * Class: com_portaudio_PortAudio * Method: hostApiDeviceIndexToDeviceIndex * Signature: (II)I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiDeviceIndexToDeviceIndex (JNIEnv *env, jclass clazz, jint hostApiIndex, jint apiDeviceIndex) { return Pa_HostApiDeviceIndexToDeviceIndex( hostApiIndex, apiDeviceIndex ); } /* * Class: com_portaudio_PortAudio * Method: getHostApiInfo * Signature: (ILcom/portaudio/HostApiInfo;)I */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getHostApiInfo (JNIEnv *env, jclass clazz, jint index, jobject hostApiInfo) { const PaHostApiInfo *info; /* Get a reference to obj's class */ jclass cls = (*env)->GetObjectClass(env, hostApiInfo); info = Pa_GetHostApiInfo( index ); if( info == NULL ) { jpa_ThrowError( env, "Pa_GetHostApiInfo returned NULL." ); } else { jpa_SetIntField( env, cls, hostApiInfo, "version", info->structVersion ); jpa_SetIntField( env, cls, hostApiInfo, "type", info->type ); jpa_SetStringField( env, cls, hostApiInfo, "name", info->name ); jpa_SetIntField( env, cls, hostApiInfo, "deviceCount", info->deviceCount ); jpa_SetIntField( env, cls, hostApiInfo, "defaultInputDevice", info->defaultInputDevice ); jpa_SetIntField( env, cls, hostApiInfo, "defaultOutputDevice", info->defaultOutputDevice ); } } /* * Class: com_portaudio_PortAudio * Method: getDefaultInputDevice * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultInputDevice (JNIEnv *env, jclass clazz) { jint deviceId = Pa_GetDefaultInputDevice(); return jpa_CheckError( env, deviceId ); } /* * Class: com_portaudio_PortAudio * Method: getDefaultOutputDevice * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultOutputDevice (JNIEnv *env, jclass clazz) { jint deviceId = Pa_GetDefaultOutputDevice(); return jpa_CheckError( env, deviceId ); } /* * Class: com_portaudio_PortAudio * Method: getDefaultHostApi * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultHostApi (JNIEnv *env, jclass clazz) { jint deviceId = Pa_GetDefaultHostApi(); return jpa_CheckError( env, deviceId ); } /* * Class: com_portaudio_PortAudio * Method: isFormatSupported * Signature: (Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;I)I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_isFormatSupported (JNIEnv *env, jclass clazz, jobject inParams, jobject outParams, jint sampleRate ) { PaStreamParameters myInParams, *paInParams; PaStreamParameters myOutParams, *paOutParams; paInParams = jpa_FillStreamParameters( env, inParams, &myInParams ); paOutParams = jpa_FillStreamParameters( env, outParams, &myOutParams ); return Pa_IsFormatSupported( paInParams, paOutParams, sampleRate ); } /* * Class: com_portaudio_PortAudio * Method: openStream * Signature: (Lcom/portaudio/BlockingStream;Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;III)I */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_openStream (JNIEnv *env, jclass clazz, jobject blockingStream, jobject inParams, jobject outParams, jint sampleRate, jint framesPerBuffer, jint flags ) { int err; PaStreamParameters myInParams, *paInParams; PaStreamParameters myOutParams, *paOutParams; PaStream *stream; paInParams = jpa_FillStreamParameters( env, inParams, &myInParams ); paOutParams = jpa_FillStreamParameters( env, outParams, &myOutParams ); err = Pa_OpenStream( &stream, paInParams, paOutParams, sampleRate, framesPerBuffer, flags, NULL, NULL ); if( jpa_CheckError( env, err ) == 0 ) { jclass cls = (*env)->GetObjectClass(env, blockingStream); jpa_SetLongField( env, cls, blockingStream, "nativeStream", (jlong) stream ); if( paInParams != NULL ) { jpa_SetIntField( env, cls, blockingStream, "inputFormat", paInParams->sampleFormat ); } if( paOutParams != NULL ) { jpa_SetIntField( env, cls, blockingStream, "outputFormat", paOutParams->sampleFormat ); } } } ================================================ FILE: thirdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.h ================================================ /* DO NOT EDIT THIS FILE - it is machine generated */ #if defined(__APPLE__) #include #else #include #endif /* Header for class com_portaudio_PortAudio */ #ifndef _Included_com_portaudio_PortAudio #define _Included_com_portaudio_PortAudio #ifdef __cplusplus extern "C" { #endif #undef com_portaudio_PortAudio_FLAG_CLIP_OFF #define com_portaudio_PortAudio_FLAG_CLIP_OFF 1L #undef com_portaudio_PortAudio_FLAG_DITHER_OFF #define com_portaudio_PortAudio_FLAG_DITHER_OFF 2L #undef com_portaudio_PortAudio_FORMAT_FLOAT_32 #define com_portaudio_PortAudio_FORMAT_FLOAT_32 1L #undef com_portaudio_PortAudio_FORMAT_INT_32 #define com_portaudio_PortAudio_FORMAT_INT_32 2L #undef com_portaudio_PortAudio_FORMAT_INT_24 #define com_portaudio_PortAudio_FORMAT_INT_24 4L #undef com_portaudio_PortAudio_FORMAT_INT_16 #define com_portaudio_PortAudio_FORMAT_INT_16 8L #undef com_portaudio_PortAudio_FORMAT_INT_8 #define com_portaudio_PortAudio_FORMAT_INT_8 16L #undef com_portaudio_PortAudio_FORMAT_UINT_8 #define com_portaudio_PortAudio_FORMAT_UINT_8 32L #undef com_portaudio_PortAudio_HOST_API_TYPE_DEV #define com_portaudio_PortAudio_HOST_API_TYPE_DEV 0L #undef com_portaudio_PortAudio_HOST_API_TYPE_DIRECTSOUND #define com_portaudio_PortAudio_HOST_API_TYPE_DIRECTSOUND 1L #undef com_portaudio_PortAudio_HOST_API_TYPE_MME #define com_portaudio_PortAudio_HOST_API_TYPE_MME 2L #undef com_portaudio_PortAudio_HOST_API_TYPE_ASIO #define com_portaudio_PortAudio_HOST_API_TYPE_ASIO 3L #undef com_portaudio_PortAudio_HOST_API_TYPE_SOUNDMANAGER #define com_portaudio_PortAudio_HOST_API_TYPE_SOUNDMANAGER 4L #undef com_portaudio_PortAudio_HOST_API_TYPE_COREAUDIO #define com_portaudio_PortAudio_HOST_API_TYPE_COREAUDIO 5L #undef com_portaudio_PortAudio_HOST_API_TYPE_OSS #define com_portaudio_PortAudio_HOST_API_TYPE_OSS 7L #undef com_portaudio_PortAudio_HOST_API_TYPE_ALSA #define com_portaudio_PortAudio_HOST_API_TYPE_ALSA 8L #undef com_portaudio_PortAudio_HOST_API_TYPE_AL #define com_portaudio_PortAudio_HOST_API_TYPE_AL 9L #undef com_portaudio_PortAudio_HOST_API_TYPE_BEOS #define com_portaudio_PortAudio_HOST_API_TYPE_BEOS 10L #undef com_portaudio_PortAudio_HOST_API_TYPE_WDMKS #define com_portaudio_PortAudio_HOST_API_TYPE_WDMKS 11L #undef com_portaudio_PortAudio_HOST_API_TYPE_JACK #define com_portaudio_PortAudio_HOST_API_TYPE_JACK 12L #undef com_portaudio_PortAudio_HOST_API_TYPE_WASAPI #define com_portaudio_PortAudio_HOST_API_TYPE_WASAPI 13L #undef com_portaudio_PortAudio_HOST_API_TYPE_AUDIOSCIENCE #define com_portaudio_PortAudio_HOST_API_TYPE_AUDIOSCIENCE 14L #undef com_portaudio_PortAudio_HOST_API_TYPE_COUNT #define com_portaudio_PortAudio_HOST_API_TYPE_COUNT 15L /* * Class: com_portaudio_PortAudio * Method: getVersion * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getVersion (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: getVersionText * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_com_portaudio_PortAudio_getVersionText (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: initialize * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_initialize (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: terminate * Signature: ()V */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_terminate (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: getDeviceCount * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDeviceCount (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: getDeviceInfo * Signature: (ILcom/portaudio/DeviceInfo;)V */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getDeviceInfo (JNIEnv *, jclass, jint, jobject); /* * Class: com_portaudio_PortAudio * Method: getHostApiCount * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getHostApiCount (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: getHostApiInfo * Signature: (ILcom/portaudio/HostApiInfo;)V */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getHostApiInfo (JNIEnv *, jclass, jint, jobject); /* * Class: com_portaudio_PortAudio * Method: hostApiTypeIdToHostApiIndex * Signature: (I)I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiTypeIdToHostApiIndex (JNIEnv *, jclass, jint); /* * Class: com_portaudio_PortAudio * Method: hostApiDeviceIndexToDeviceIndex * Signature: (II)I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiDeviceIndexToDeviceIndex (JNIEnv *, jclass, jint, jint); /* * Class: com_portaudio_PortAudio * Method: getDefaultInputDevice * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultInputDevice (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: getDefaultOutputDevice * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultOutputDevice (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: getDefaultHostApi * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultHostApi (JNIEnv *, jclass); /* * Class: com_portaudio_PortAudio * Method: isFormatSupported * Signature: (Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;I)I */ JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_isFormatSupported (JNIEnv *, jclass, jobject, jobject, jint); /* * Class: com_portaudio_PortAudio * Method: openStream * Signature: (Lcom/portaudio/BlockingStream;Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;III)V */ JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_openStream (JNIEnv *, jclass, jobject, jobject, jobject, jint, jint, jint); #ifdef __cplusplus } #endif #endif ================================================ FILE: thirdparty/portaudio/bindings/java/c/src/jpa_tools.c ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ #include "com_portaudio_PortAudio.h" #include "portaudio.h" #include "jpa_tools.h" jint jpa_GetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "I"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find integer JNI field." ); return 0; } else { return (*env)->GetIntField(env, obj, fid ); } } void jpa_SetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jint value ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "I"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find integer JNI field." ); } else { (*env)->SetIntField(env, obj, fid, value ); } } jlong jpa_GetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "J"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find long JNI field." ); return 0L; } else { return (*env)->GetLongField(env, obj, fid ); } } void jpa_SetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jlong value ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "J"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find long JNI field." ); } else { (*env)->SetLongField(env, obj, fid, value ); } } void jpa_SetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jdouble value ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "D"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find double JNI field." ); } else { (*env)->SetDoubleField(env, obj, fid, value ); } } jdouble jpa_GetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "D"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find double JNI field." ); return 0; } else { return (*env)->GetDoubleField(env, obj, fid ); } } void jpa_SetStringField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, const char *value ) { /* Look for the instance field maxInputChannels in cls */ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "Ljava/lang/String;"); if (fid == NULL) { jpa_ThrowError( env, "Cannot find String JNI field." ); } else { jstring jstr = (*env)->NewStringUTF(env, value); if (jstr == NULL) { jpa_ThrowError( env, "Cannot create new String." ); } else { (*env)->SetObjectField(env, obj, fid, jstr ); } } } PaStreamParameters *jpa_FillStreamParameters( JNIEnv *env, jobject jstreamParam, PaStreamParameters *myParams ) { jclass cls; if( jstreamParam == NULL ) return NULL; // OK, not an error cls = (*env)->GetObjectClass(env, jstreamParam); myParams->channelCount = jpa_GetIntField( env, cls, jstreamParam, "channelCount" ); myParams->device = jpa_GetIntField( env, cls, jstreamParam, "device" ); myParams->sampleFormat = jpa_GetIntField( env, cls, jstreamParam, "sampleFormat" ); myParams->suggestedLatency = jpa_GetDoubleField( env, cls, jstreamParam, "suggestedLatency" ); myParams->hostApiSpecificStreamInfo = NULL; return myParams; } // Create an exception that will be thrown when we return from the JNI call. jint jpa_ThrowError( JNIEnv *env, const char *message ) { return (*env)->ThrowNew(env, (*env)->FindClass( env, "java/lang/RuntimeException"), message ); } // Throw an exception on error. jint jpa_CheckError( JNIEnv *env, PaError err ) { if( err == -1 ) { return jpa_ThrowError( env, "-1, possibly no available default device" ); } else if( err < 0 ) { if( err == paUnanticipatedHostError ) { const PaHostErrorInfo *hostErrorInfo = Pa_GetLastHostErrorInfo(); return jpa_ThrowError( env, hostErrorInfo->errorText ); } else { return jpa_ThrowError( env, Pa_GetErrorText( err ) ); } } else { return err; } } // Get the stream pointer from a BlockingStream long field. PaStream *jpa_GetStreamPointer( JNIEnv *env, jobject blockingStream ) { jclass cls = (*env)->GetObjectClass(env, blockingStream); return (PaStream *) jpa_GetLongField( env, cls, blockingStream, "nativeStream" ); } ================================================ FILE: thirdparty/portaudio/bindings/java/c/src/jpa_tools.h ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ #include "com_portaudio_PortAudio.h" #include "portaudio.h" #ifndef JPA_TOOLS_H #define JPA_TOOLS_H jint jpa_GetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName ); void jpa_SetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jint value ); jlong jpa_GetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName ); void jpa_SetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jlong value ); jdouble jpa_GetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName ); void jpa_SetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jdouble value ); void jpa_SetStringField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, const char *value ); PaStreamParameters *jpa_FillStreamParameters( JNIEnv *env, jobject jstreamParam, PaStreamParameters *myParams ); jint jpa_CheckError( JNIEnv *env, PaError err ); jint jpa_ThrowError( JNIEnv *env, const char *message ); PaStream *jpa_GetStreamPointer( JNIEnv *env, jobject blockingStream ); #endif /* JPA_TOOLS_H */ ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/.classpath ================================================ ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/.project ================================================ JPortAudio org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/jtests/com/portaudio/PlaySine.java ================================================ /** @file @ingroup bindings_java @brief Example that shows how to play sine waves using JPortAudio. */ package com.portaudio; import com.portaudio.TestBasic.SineOscillator; public class PlaySine { /** * Write a sine wave to the stream. * @param stream * @param framesPerBuffer * @param numFrames * @param sampleRate */ private void writeSineData( BlockingStream stream, int framesPerBuffer, int numFrames, int sampleRate ) { float[] buffer = new float[framesPerBuffer * 2]; SineOscillator osc1 = new SineOscillator( 200.0, sampleRate ); SineOscillator osc2 = new SineOscillator( 300.0, sampleRate ); int framesLeft = numFrames; while( framesLeft > 0 ) { int index = 0; int framesToWrite = (framesLeft > framesPerBuffer) ? framesPerBuffer : framesLeft; for( int j = 0; j < framesToWrite; j++ ) { buffer[index++] = (float) osc1.next(); buffer[index++] = (float) osc2.next(); } stream.write( buffer, framesToWrite ); framesLeft -= framesToWrite; } } /** * Create a stream on the default device then play sine waves. */ public void play() { PortAudio.initialize(); // Get the default device and setup the stream parameters. int deviceId = PortAudio.getDefaultOutputDevice(); DeviceInfo deviceInfo = PortAudio.getDeviceInfo( deviceId ); double sampleRate = deviceInfo.defaultSampleRate; System.out.println( " deviceId = " + deviceId ); System.out.println( " sampleRate = " + sampleRate ); System.out.println( " device name = " + deviceInfo.name ); StreamParameters streamParameters = new StreamParameters(); streamParameters.channelCount = 2; streamParameters.device = deviceId; streamParameters.suggestedLatency = deviceInfo.defaultLowOutputLatency; System.out.println( " suggestedLatency = " + streamParameters.suggestedLatency ); int framesPerBuffer = 256; int flags = 0; // Open a stream for output. BlockingStream stream = PortAudio.openStream( null, streamParameters, (int) sampleRate, framesPerBuffer, flags ); int numFrames = (int) (sampleRate * 4); // enough for 4 seconds stream.start(); writeSineData( stream, framesPerBuffer, numFrames, (int) sampleRate ); stream.stop(); stream.close(); PortAudio.terminate(); System.out.println( "JPortAudio test complete." ); } public static void main( String[] args ) { PlaySine player = new PlaySine(); player.play(); } } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/jtests/com/portaudio/TestBasic.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ package com.portaudio; import junit.framework.TestCase; /** * Test the Java bindings for PortAudio. * * @author Phil Burk * */ public class TestBasic extends TestCase { public void testDeviceCount() { PortAudio.initialize(); assertTrue( "version invalid", (PortAudio.getVersion() > 0) ); System.out.println( "getVersion = " + PortAudio.getVersion() ); System.out.println( "getVersionText = " + PortAudio.getVersionText() ); System.out.println( "getDeviceCount = " + PortAudio.getDeviceCount() ); assertTrue( "getDeviceCount", (PortAudio.getDeviceCount() > 0) ); PortAudio.terminate(); } public void testListDevices() { PortAudio.initialize(); int count = PortAudio.getDeviceCount(); assertTrue( "getDeviceCount", (count > 0) ); for( int i = 0; i < count; i++ ) { DeviceInfo info = PortAudio.getDeviceInfo( i ); System.out.println( "------------------ #" + i ); System.out.println( " name = " + info.name ); System.out.println( " hostApi = " + info.hostApi ); System.out.println( " maxOutputChannels = " + info.maxOutputChannels ); System.out.println( " maxInputChannels = " + info.maxInputChannels ); System.out.println( " defaultSampleRate = " + info.defaultSampleRate ); System.out.printf( " defaultLowInputLatency = %3d msec\n", ((int) (info.defaultLowInputLatency * 1000)) ); System.out.printf( " defaultHighInputLatency = %3d msec\n", ((int) (info.defaultHighInputLatency * 1000)) ); System.out.printf( " defaultLowOutputLatency = %3d msec\n", ((int) (info.defaultLowOutputLatency * 1000)) ); System.out.printf( " defaultHighOutputLatency = %3d msec\n", ((int) (info.defaultHighOutputLatency * 1000)) ); assertTrue( "some channels", (info.maxOutputChannels + info.maxInputChannels) > 0 ); assertTrue( "not too many channels", (info.maxInputChannels < 64) ); assertTrue( "not too many channels", (info.maxOutputChannels < 64) ); } System.out.println( "defaultInput = " + PortAudio.getDefaultInputDevice() ); System.out.println( "defaultOutput = " + PortAudio.getDefaultOutputDevice() ); PortAudio.terminate(); } public void testHostApis() { PortAudio.initialize(); int validApiCount = 0; for( int hostApiType = 0; hostApiType < PortAudio.HOST_API_TYPE_COUNT; hostApiType++ ) { int hostApiIndex = PortAudio .hostApiTypeIdToHostApiIndex( hostApiType ); if( hostApiIndex >= 0 ) { HostApiInfo info = PortAudio.getHostApiInfo( hostApiIndex ); System.out.println( "Checking Host API: " + info.name ); for( int apiDeviceIndex = 0; apiDeviceIndex < info.deviceCount; apiDeviceIndex++ ) { int deviceIndex = PortAudio .hostApiDeviceIndexToDeviceIndex( hostApiIndex, apiDeviceIndex ); DeviceInfo deviceInfo = PortAudio .getDeviceInfo( deviceIndex ); assertEquals( "host api must match up", hostApiIndex, deviceInfo.hostApi ); } validApiCount++; } } assertEquals( "host api counts", PortAudio.getHostApiCount(), validApiCount ); } public void testListHostApis() { PortAudio.initialize(); int count = PortAudio.getHostApiCount(); assertTrue( "getHostApiCount", (count > 0) ); for( int i = 0; i < count; i++ ) { HostApiInfo info = PortAudio.getHostApiInfo( i ); System.out.println( "------------------ #" + i ); System.out.println( " version = " + info.version ); System.out.println( " name = " + info.name ); System.out.println( " type = " + info.type ); System.out.println( " deviceCount = " + info.deviceCount ); System.out.println( " defaultInputDevice = " + info.defaultInputDevice ); System.out.println( " defaultOutputDevice = " + info.defaultOutputDevice ); assertTrue( "some devices", info.deviceCount > 0 ); } System.out.println( "------\ndefaultHostApi = " + PortAudio.getDefaultHostApi() ); PortAudio.terminate(); } public void testCheckFormat() { PortAudio.initialize(); StreamParameters streamParameters = new StreamParameters(); streamParameters.device = PortAudio.getDefaultOutputDevice(); int result = PortAudio .isFormatSupported( null, streamParameters, 44100 ); System.out.println( "isFormatSupported returns " + result ); assertEquals( "default output format", 0, result ); // Try crazy channelCount streamParameters.channelCount = 8765; result = PortAudio.isFormatSupported( null, streamParameters, 44100 ); System.out.println( "crazy isFormatSupported returns " + result ); assertTrue( "default output format", (result < 0) ); PortAudio.terminate(); } static class SineOscillator { double phase = 0.0; double phaseIncrement = 0.01; SineOscillator(double freq, int sampleRate) { phaseIncrement = freq * Math.PI * 2.0 / sampleRate; } double next() { double value = Math.sin( phase ); phase += phaseIncrement; if( phase > Math.PI ) { phase -= Math.PI * 2.0; } return value; } } public void testStreamError() { PortAudio.initialize(); StreamParameters streamParameters = new StreamParameters(); streamParameters.sampleFormat = PortAudio.FORMAT_FLOAT_32; streamParameters.channelCount = 2; streamParameters.device = PortAudio.getDefaultOutputDevice(); int framesPerBuffer = 256; int flags = 0; BlockingStream stream = PortAudio.openStream( null, streamParameters, 44100, framesPerBuffer, flags ); // Try to write data to a stopped stream. Throwable caught = null; try { float[] buffer = new float[framesPerBuffer * streamParameters.channelCount]; stream.write( buffer, framesPerBuffer ); } catch( Throwable e ) { caught = e; e.printStackTrace(); } assertTrue( "caught no exception", (caught != null) ); assertTrue( "exception should say stream is stopped", caught .getMessage().contains( "stopped" ) ); // Try to write null data. caught = null; try { stream.write( (float[]) null, framesPerBuffer ); } catch( Throwable e ) { caught = e; e.printStackTrace(); } assertTrue( "caught no exception", (caught != null) ); assertTrue( "exception should say stream is stopped", caught .getMessage().contains( "null" ) ); // Try to write short data to a float stream. stream.start(); caught = null; try { short[] buffer = new short[framesPerBuffer * streamParameters.channelCount]; stream.write( buffer, framesPerBuffer ); } catch( Throwable e ) { caught = e; e.printStackTrace(); } assertTrue( "caught no exception", (caught != null) ); assertTrue( "exception should say tried to", caught.getMessage() .contains( "Tried to write short" ) ); stream.close(); PortAudio.terminate(); } public void checkBlockingWriteFloat( int deviceId, double sampleRate ) { StreamParameters streamParameters = new StreamParameters(); streamParameters.channelCount = 2; streamParameters.device = deviceId; streamParameters.suggestedLatency = PortAudio .getDeviceInfo( streamParameters.device ).defaultLowOutputLatency; System.out.println( "suggestedLatency = " + streamParameters.suggestedLatency ); int framesPerBuffer = 256; int flags = 0; BlockingStream stream = PortAudio.openStream( null, streamParameters, (int) sampleRate, framesPerBuffer, flags ); assertTrue( "got default stream", stream != null ); assertEquals( "stream isStopped", true, stream.isStopped() ); assertEquals( "stream isActive", false, stream.isActive() ); int numFrames = 80000; double expected = ((double)numFrames) / sampleRate; stream.start(); long startTime = System.currentTimeMillis(); double startStreamTime = stream.getTime(); assertEquals( "stream isStopped", false, stream.isStopped() ); assertEquals( "stream isActive", true, stream.isActive() ); writeSineData( stream, framesPerBuffer, numFrames, (int) sampleRate ); StreamInfo streamInfo = stream.getInfo(); System.out.println( "inputLatency of a stream = "+ streamInfo.inputLatency ); System.out.println( "outputLatency of a stream = "+streamInfo.outputLatency ); System.out.println( "sampleRate of a stream = "+ streamInfo.sampleRate ); assertEquals( "inputLatency of a stream ", 0.0, streamInfo.inputLatency, 0.000001 ); assertTrue( "outputLatency of a stream ",(streamInfo.outputLatency > 0) ); assertEquals( "sampleRate of a stream ", sampleRate, streamInfo.sampleRate, 3 ); double endStreamTime = stream.getTime(); stream.stop(); long stopTime = System.currentTimeMillis(); System.out.println( "startStreamTime = " + startStreamTime ); System.out.println( "endStreamTime = " + endStreamTime ); double elapsedStreamTime = endStreamTime - startStreamTime; System.out.println( "elapsedStreamTime = " + elapsedStreamTime ); assertTrue( "elapsedStreamTime: " + elapsedStreamTime, (elapsedStreamTime > 0.0) ); assertEquals( "elapsedStreamTime: ", expected, elapsedStreamTime, 0.10 ); assertEquals( "stream isStopped", true, stream.isStopped() ); assertEquals( "stream isActive", false, stream.isActive() ); stream.close(); double elapsed = (stopTime - startTime) / 1000.0; assertEquals( "elapsed time to play", expected, elapsed, 0.20 ); } public void testBlockingWriteFloat() { PortAudio.initialize(); checkBlockingWriteFloat( PortAudio.getDefaultOutputDevice(), 44100 ); PortAudio.terminate(); } public void ZtestWriteEachHostAPI() { PortAudio.initialize(); for( int hostApiIndex = 0; hostApiIndex < PortAudio.getHostApiCount(); hostApiIndex++ ) { HostApiInfo hostInfo = PortAudio.getHostApiInfo( hostApiIndex ); System.out.println( "-------------\nWriting using Host API: " + hostInfo.name ); int deviceId = hostInfo.defaultOutputDevice; System.out.println( " Device ID =" + deviceId ); DeviceInfo deviceInfo = PortAudio.getDeviceInfo( deviceId ); System.out.println( " sampleRate =" + deviceInfo.defaultSampleRate ); checkBlockingWriteFloat( deviceId, (int) deviceInfo.defaultSampleRate ); System.out.println( "Finished with " + hostInfo.name ); } PortAudio.terminate(); } private void writeSineData( BlockingStream stream, int framesPerBuffer, int numFrames, int sampleRate ) { float[] buffer = new float[framesPerBuffer * 2]; SineOscillator osc1 = new SineOscillator( 200.0, sampleRate ); SineOscillator osc2 = new SineOscillator( 300.0, sampleRate ); int framesLeft = numFrames; while( framesLeft > 0 ) { int index = 0; int framesToWrite = (framesLeft > framesPerBuffer) ? framesPerBuffer : framesLeft; for( int j = 0; j < framesToWrite; j++ ) { buffer[index++] = (float) osc1.next(); buffer[index++] = (float) osc2.next(); } stream.write( buffer, framesToWrite ); framesLeft -= framesToWrite; } } private void writeSineDataShort( BlockingStream stream, int framesPerBuffer, int numFrames ) { short[] buffer = new short[framesPerBuffer * 2]; SineOscillator osc1 = new SineOscillator( 200.0, 44100 ); SineOscillator osc2 = new SineOscillator( 300.0, 44100 ); int framesLeft = numFrames; while( framesLeft > 0 ) { int index = 0; int framesToWrite = (framesLeft > framesPerBuffer) ? framesPerBuffer : framesLeft; for( int j = 0; j < framesToWrite; j++ ) { buffer[index++] = (short) (osc1.next() * 32767); buffer[index++] = (short) (osc2.next() * 32767); } stream.write( buffer, framesToWrite ); framesLeft -= framesToWrite; } } public void testBlockingWriteShort() { PortAudio.initialize(); StreamParameters streamParameters = new StreamParameters(); streamParameters.sampleFormat = PortAudio.FORMAT_INT_16; streamParameters.channelCount = 2; streamParameters.device = PortAudio.getDefaultOutputDevice(); streamParameters.suggestedLatency = PortAudio .getDeviceInfo( streamParameters.device ).defaultLowOutputLatency; System.out.println( "suggestedLatency = " + streamParameters.suggestedLatency ); int framesPerBuffer = 256; int flags = 0; BlockingStream stream = PortAudio.openStream( null, streamParameters, 44100, framesPerBuffer, flags ); assertTrue( "got default stream", stream != null ); int numFrames = 80000; stream.start(); long startTime = System.currentTimeMillis(); writeSineDataShort( stream, framesPerBuffer, numFrames ); stream.stop(); long stopTime = System.currentTimeMillis(); stream.close(); double elapsed = (stopTime - startTime) / 1000.0; double expected = numFrames / 44100.0; assertEquals( "elapsed time to play", expected, elapsed, 0.20 ); PortAudio.terminate(); } public void testRecordPlayFloat() throws InterruptedException { checkRecordPlay( PortAudio.FORMAT_FLOAT_32 ); } public void testRecordPlayShort() throws InterruptedException { checkRecordPlay( PortAudio.FORMAT_INT_16 ); } public void checkRecordPlay( int sampleFormat ) throws InterruptedException { int framesPerBuffer = 256; int flags = 0; int sampleRate = 44100; int numFrames = sampleRate * 3; float[] floatBuffer = null; short[] shortBuffer = null; PortAudio.initialize(); StreamParameters inParameters = new StreamParameters(); inParameters.sampleFormat = sampleFormat; inParameters.device = PortAudio.getDefaultInputDevice(); DeviceInfo info = PortAudio.getDeviceInfo( inParameters.device ); inParameters.channelCount = (info.maxInputChannels > 2) ? 2 : info.maxInputChannels; System.out.println( "channelCount = " + inParameters.channelCount ); inParameters.suggestedLatency = PortAudio .getDeviceInfo( inParameters.device ).defaultLowInputLatency; if( sampleFormat == PortAudio.FORMAT_FLOAT_32 ) { floatBuffer = new float[numFrames * inParameters.channelCount]; } else if( sampleFormat == PortAudio.FORMAT_INT_16 ) { shortBuffer = new short[numFrames * inParameters.channelCount]; } // Record a few seconds of audio. BlockingStream inStream = PortAudio.openStream( inParameters, null, sampleRate, framesPerBuffer, flags ); System.out.println( "RECORDING - say something like testing 1,2,3..." ); inStream.start(); if( sampleFormat == PortAudio.FORMAT_FLOAT_32 ) { inStream.read( floatBuffer, numFrames ); } else if( sampleFormat == PortAudio.FORMAT_INT_16 ) { inStream.read( shortBuffer, numFrames ); } Thread.sleep( 100 ); int availableToRead = inStream.getReadAvailable(); System.out.println( "availableToRead = " + availableToRead ); assertTrue( "getReadAvailable ", availableToRead > 0 ); inStream.stop(); inStream.close(); System.out.println( "Finished recording. Begin Playback." ); // Play back what we recorded. StreamParameters outParameters = new StreamParameters(); outParameters.sampleFormat = sampleFormat; outParameters.channelCount = inParameters.channelCount; outParameters.device = PortAudio.getDefaultOutputDevice(); outParameters.suggestedLatency = PortAudio .getDeviceInfo( outParameters.device ).defaultLowOutputLatency; BlockingStream outStream = PortAudio.openStream( null, outParameters, sampleRate, framesPerBuffer, flags ); assertTrue( "got default stream", outStream != null ); assertEquals( "inStream isActive", false, inStream.isActive() ); outStream.start(); Thread.sleep( 100 ); int availableToWrite = outStream.getWriteAvailable(); System.out.println( "availableToWrite = " + availableToWrite ); assertTrue( "getWriteAvailable ", availableToWrite > 0 ); System.out.println( "inStream = " + inStream ); System.out.println( "outStream = " + outStream ); assertEquals( "inStream isActive", false, inStream.isActive() ); assertEquals( "outStream isActive", true, outStream.isActive() ); if( sampleFormat == PortAudio.FORMAT_FLOAT_32 ) { outStream.write( floatBuffer, numFrames ); } else if( sampleFormat == PortAudio.FORMAT_INT_16 ) { outStream.write( shortBuffer, numFrames ); } outStream.stop(); outStream.close(); PortAudio.terminate(); } } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/src/com/portaudio/BlockingStream.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup bindings_java @brief A blocking read/write stream. */ package com.portaudio; /** * Represents a stream for blocking read/write I/O. * * This Java object contains the pointer to a PortAudio stream stored as a long. * It is passed to PortAudio when calling stream related functions. * * To create one of these, call PortAudio.openStream(). * * @see PortAudio * * @author Phil Burk * */ public class BlockingStream { // nativeStream is only accessed by the native code. It contains a pointer // to a PaStream. private long nativeStream; private int inputFormat = -1; private int outputFormat = -1; protected BlockingStream() { } /** * @return number of frames that can be read without blocking. */ public native int getReadAvailable(); /** * @return number of frames that can be written without blocking. */ public native int getWriteAvailable(); private native boolean readFloats( float[] buffer, int numFrames ); private native boolean writeFloats( float[] buffer, int numFrames ); /** * Read 32-bit floating point data from the stream into the array. * * @param buffer * @param numFrames * number of frames to read * @return true if an input overflow occurred */ public boolean read( float[] buffer, int numFrames ) { if( inputFormat != PortAudio.FORMAT_FLOAT_32 ) { throw new RuntimeException( "Tried to read float samples from a non float stream." ); } return readFloats( buffer, numFrames ); } /** * Write 32-bit floating point data to the stream from the array. The data * should be in the range -1.0 to +1.0. * * @param buffer * @param numFrames * number of frames to write * @return true if an output underflow occurred */ public boolean write( float[] buffer, int numFrames ) { if( outputFormat != PortAudio.FORMAT_FLOAT_32 ) { throw new RuntimeException( "Tried to write float samples to a non float stream." ); } return writeFloats( buffer, numFrames ); } private native boolean readShorts( short[] buffer, int numFrames ); private native boolean writeShorts( short[] buffer, int numFrames ); /** * Read 16-bit integer data to the stream from the array. * * @param buffer * @param numFrames * number of frames to write * @return true if an input overflow occurred */ public boolean read( short[] buffer, int numFrames ) { if( inputFormat != PortAudio.FORMAT_INT_16 ) { throw new RuntimeException( "Tried to read short samples from a non short stream." ); } return readShorts( buffer, numFrames ); } /** * Write 16-bit integer data to the stream from the array. * * @param buffer * @param numFrames * number of frames to write * @return true if an output underflow occurred */ public boolean write( short[] buffer, int numFrames ) { if( outputFormat != PortAudio.FORMAT_INT_16 ) { throw new RuntimeException( "Tried to write short samples from a non short stream." ); } return writeShorts( buffer, numFrames ); } /** * Atart audio I/O. */ public native void start(); /** * Wait for the stream to play all of the data that has been written then * stop. */ public native void stop(); /** * Stop immediately and lose any data that was written but not played. */ public native void abort(); /** * Close the stream and zero out the pointer. Do not reference the stream * after this. */ public native void close(); public native boolean isStopped(); public native boolean isActive(); public String toString() { return "BlockingStream: streamPtr = " + Long.toHexString( nativeStream ) + ", inFormat = " + inputFormat + ", outFormat = " + outputFormat; } /** * Get audio time related to this stream. Note that it may not start at 0.0. */ public native double getTime(); private native void getInfo( StreamInfo streamInfo ); public StreamInfo getInfo() { StreamInfo streamInfo = new StreamInfo(); getInfo( streamInfo ); return streamInfo; } } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/src/com/portaudio/DeviceInfo.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup bindings_java @brief Information about a JPortAudio device. */ package com.portaudio; /** * Equivalent to PaDeviceInfo * @see PortAudio * @see HostApiInfo * @author Phil Burk * */ public class DeviceInfo { public int version; public String name; public int hostApi; public int maxInputChannels; public int maxOutputChannels; public double defaultLowInputLatency; public double defaultHighInputLatency; public double defaultLowOutputLatency; public double defaultHighOutputLatency; public double defaultSampleRate; } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/src/com/portaudio/HostApiInfo.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup bindings_java @brief Information about a JPortAudio Host API. */ package com.portaudio; /** * Equivalent to PaHostApiInfo * @see PortAudio * @see DeviceInfo * @author Phil Burk * */ public class HostApiInfo { public int version; public int type; public String name; public int deviceCount; public int defaultInputDevice; public int defaultOutputDevice; } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/src/com/portaudio/PortAudio.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup bindings_java @brief Java wrapper for the PortAudio API. */ package com.portaudio; /** * Java methods that call PortAudio via JNI. This is a portable audio I/O * library that can be used as an alternative to JavaSound. * * Please see the PortAudio documentation for a full explanation. * * http://portaudio.com/docs/ * http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html * * This Java binding does not support audio callbacks because an audio callback * should never block. Calling into a Java virtual machine might block for * garbage collection or synchronization. So only the blocking read/write mode * is supported. * * @see BlockingStream * @see DeviceInfo * @see HostApiInfo * @see StreamInfo * @see StreamParameters * * @author Phil Burk * */ public class PortAudio { public final static int FLAG_CLIP_OFF = (1 << 0); public final static int FLAG_DITHER_OFF = (1 << 1); /** Sample Formats */ public final static int FORMAT_FLOAT_32 = (1 << 0); public final static int FORMAT_INT_32 = (1 << 1); // not supported public final static int FORMAT_INT_24 = (1 << 2); // not supported public final static int FORMAT_INT_16 = (1 << 3); public final static int FORMAT_INT_8 = (1 << 4); // not supported public final static int FORMAT_UINT_8 = (1 << 5); // not supported /** These HOST_API_TYPES will not change in the future. */ public final static int HOST_API_TYPE_DEV = 0; public final static int HOST_API_TYPE_DIRECTSOUND = 1; public final static int HOST_API_TYPE_MME = 2; public final static int HOST_API_TYPE_ASIO = 3; /** Apple Sound Manager. Obsolete. */ public final static int HOST_API_TYPE_SOUNDMANAGER = 4; public final static int HOST_API_TYPE_COREAUDIO = 5; public final static int HOST_API_TYPE_OSS = 7; public final static int HOST_API_TYPE_ALSA = 8; public final static int HOST_API_TYPE_AL = 9; public final static int HOST_API_TYPE_BEOS = 10; public final static int HOST_API_TYPE_WDMKS = 11; public final static int HOST_API_TYPE_JACK = 12; public final static int HOST_API_TYPE_WASAPI = 13; public final static int HOST_API_TYPE_AUDIOSCIENCE = 14; public final static int HOST_API_TYPE_COUNT = 15; static { String os = System.getProperty( "os.name" ).toLowerCase(); // On Windows we have separate libraries for 32 and 64-bit JVMs. if( os.indexOf( "win" ) >= 0 ) { if( System.getProperty( "os.arch" ).contains( "64" ) ) { System.loadLibrary( "jportaudio_x64" ); } else { System.loadLibrary( "jportaudio_x86" ); } } else { System.loadLibrary( "jportaudio" ); } System.out.println( "---- JPortAudio version " + getVersion() + ", " + getVersionText() ); } /** * @return the release number of the currently running PortAudio build, eg * 1900. */ public native static int getVersion(); /** * @return a textual description of the current PortAudio build, eg * "PortAudio V19-devel 13 October 2002". */ public native static String getVersionText(); /** * Library initialization function - call this before using PortAudio. This * function initializes internal data structures and prepares underlying * host APIs for use. With the exception of getVersion(), getVersionText(), * and getErrorText(), this function MUST be called before using any other * PortAudio API functions. */ public native static void initialize(); /** * Library termination function - call this when finished using PortAudio. * This function deallocates all resources allocated by PortAudio since it * was initialized by a call to initialize(). In cases where Pa_Initialise() * has been called multiple times, each call must be matched with a * corresponding call to terminate(). The final matching call to terminate() * will automatically close any PortAudio streams that are still open. */ public native static void terminate(); /** * @return the number of available devices. The number of available devices * may be zero. */ public native static int getDeviceCount(); private native static void getDeviceInfo( int index, DeviceInfo deviceInfo ); /** * @param index * A valid device index in the range 0 to (getDeviceCount()-1) * @return An DeviceInfo structure. * @throws RuntimeException * if the device parameter is out of range. */ public static DeviceInfo getDeviceInfo( int index ) { DeviceInfo deviceInfo = new DeviceInfo(); getDeviceInfo( index, deviceInfo ); return deviceInfo; } /** * @return the number of available host APIs. */ public native static int getHostApiCount(); private native static void getHostApiInfo( int index, HostApiInfo hostApiInfo ); /** * @param index * @return information about the Host API */ public static HostApiInfo getHostApiInfo( int index ) { HostApiInfo hostApiInfo = new HostApiInfo(); getHostApiInfo( index, hostApiInfo ); return hostApiInfo; } /** * @param hostApiType * A unique host API identifier, for example * HOST_API_TYPE_COREAUDIO. * @return a runtime host API index */ public native static int hostApiTypeIdToHostApiIndex( int hostApiType ); /** * @param hostApiIndex * A valid host API index ranging from 0 to (getHostApiCount()-1) * @param apiDeviceIndex * A valid per-host device index in the range 0 to * (getHostApiInfo(hostApi).deviceCount-1) * @return standard PortAudio device index */ public native static int hostApiDeviceIndexToDeviceIndex( int hostApiIndex, int apiDeviceIndex ); public native static int getDefaultInputDevice(); public native static int getDefaultOutputDevice(); public native static int getDefaultHostApi(); /** * @param inputStreamParameters * input description, may be null * @param outputStreamParameters * output description, may be null * @param sampleRate * typically 44100 or 48000, or maybe 22050, 16000, 8000, 96000 * @return 0 if supported or a negative error */ public native static int isFormatSupported( StreamParameters inputStreamParameters, StreamParameters outputStreamParameters, int sampleRate ); private native static void openStream( BlockingStream blockingStream, StreamParameters inputStreamParameters, StreamParameters outputStreamParameters, int sampleRate, int framesPerBuffer, int flags ); /** * * @param inputStreamParameters * input description, may be null * @param outputStreamParameters * output description, may be null * @param sampleRate * typically 44100 or 48000, or maybe 22050, 16000, 8000, 96000 * @param framesPerBuffer * @param flags * @return */ public static BlockingStream openStream( StreamParameters inputStreamParameters, StreamParameters outputStreamParameters, int sampleRate, int framesPerBuffer, int flags ) { BlockingStream blockingStream = new BlockingStream(); openStream( blockingStream, inputStreamParameters, outputStreamParameters, sampleRate, framesPerBuffer, flags ); return blockingStream; } } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamInfo.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup bindings_java @brief Information about a JPortAudio Stream. */ package com.portaudio; /** * Equivalent to PaStreamInfo * @see PortAudio * @author Phil Burk * */ public class StreamInfo { public int structVersion; public double outputLatency; public double inputLatency; public double sampleRate; } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamParameters.java ================================================ /* * Portable Audio I/O Library * Java Binding for PortAudio * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 2008 Ross Bencina * * 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. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup bindings_java @brief Options to use when opening a stream. */ package com.portaudio; /** * Equivalent to PaStreamParameters * @see PortAudio * @author Phil Burk * */ public class StreamParameters { public int device = 0; public int channelCount = 2; public int sampleFormat = PortAudio.FORMAT_FLOAT_32; public double suggestedLatency = 0.050; } ================================================ FILE: thirdparty/portaudio/bindings/java/jportaudio.dox ================================================ /** @page java_binding JPortAudio Java Binding @ingroup jportaudio Note: this page has not been reviewed, and may contain errors. @section java_draft DRAFT - IN PROGRESS 9/4/12 JPortAudio is very new and should be considered an "alpha" release. The building of JPortAudio will eventually be integrated into the Makefile as an optional build. Currently JPortAudio is only supported for Windows and Macintosh. Please contact us if you want to help with porting Linux. For reference documentation of the JPortAudio API see: com.portaudio.PortAudio For an example see: PlaySine.java @section java_comp_windows Building JPortAudio on Windows Build the Java code using the Eclipse project in "jportaudio". Export as "jportaudio.jar". If you modify the JNI API then you will need to regenerate the JNI .h files using: @code cd bindings/java/scripts make_header.bat @endcode Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI". @section java_use_windows Using JPortAudio on Windows Put the "jportaudio.jar" in the classpath for your application. Place the following libraries where they can be found, typically in the same folder as your application. - portaudio_x86.dll - portaudio_x64.dll - jportaudio_x86.dll - jportaudio_x64.dll @section java_comp_max Building JPortAudio on Mac These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4. I created a target of type 'C' library. I added the regular PortAudio frameworks plus the JavaVM framework. I modified com_portaudio_PortAudio.h and com_portaudio_BlockingStream.h so that jni.h could found. @code #if defined(__APPLE__) #include #else #include #endif @endcode This is bad because those header files are autogenerated and will be overwritten. We need a better solution for this. I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions". On the Mac we can create a universal library for both 32 and 64-bit JVMs. So in the JAR file I will open "jportaudio" on Apple. ON WIndows I will continue to open "jportaudio_x64" and "jportaudio_x86". */ ================================================ FILE: thirdparty/portaudio/bindings/java/scripts/make_header.bat ================================================ REM Generate the JNI header file from the Java code for JPortAudio REM by Phil Burk javah -classpath ../jportaudio/bin -d ../c/src com.portaudio.PortAudio com.portaudio.BlockingStream ================================================ FILE: thirdparty/portaudio/build/msvc/portaudio.def ================================================ EXPORTS ; Pa_GetVersion @1 Pa_GetVersionText @2 Pa_GetErrorText @3 Pa_Initialize @4 Pa_Terminate @5 Pa_GetHostApiCount @6 Pa_GetDefaultHostApi @7 Pa_GetHostApiInfo @8 Pa_HostApiTypeIdToHostApiIndex @9 Pa_HostApiDeviceIndexToDeviceIndex @10 Pa_GetLastHostErrorInfo @11 Pa_GetDeviceCount @12 Pa_GetDefaultInputDevice @13 Pa_GetDefaultOutputDevice @14 Pa_GetDeviceInfo @15 Pa_IsFormatSupported @16 Pa_OpenStream @17 Pa_OpenDefaultStream @18 Pa_CloseStream @19 Pa_SetStreamFinishedCallback @20 Pa_StartStream @21 Pa_StopStream @22 Pa_AbortStream @23 Pa_IsStreamStopped @24 Pa_IsStreamActive @25 Pa_GetStreamInfo @26 Pa_GetStreamTime @27 Pa_GetStreamCpuLoad @28 Pa_ReadStream @29 Pa_WriteStream @30 Pa_GetStreamReadAvailable @31 Pa_GetStreamWriteAvailable @32 Pa_GetSampleSize @33 Pa_Sleep @34 PaAsio_GetAvailableBufferSizes @50 PaAsio_ShowControlPanel @51 PaUtil_InitializeX86PlainConverters @52 PaAsio_GetInputChannelName @53 PaAsio_GetOutputChannelName @54 PaUtil_SetDebugPrintFunction @55 PaWasapi_GetAudioClient @56 PaWasapi_UpdateDeviceList @57 PaWasapi_GetDeviceCurrentFormat @58 PaWasapi_GetDeviceDefaultFormat @59 PaWasapi_GetDeviceMixFormat @60 PaWasapi_GetDeviceRole @61 PaWasapi_ThreadPriorityBoost @62 PaWasapi_ThreadPriorityRevert @63 PaWasapi_GetFramesPerHostBuffer @64 PaWasapi_GetJackCount @65 PaWasapi_GetJackDescription @66 PaWasapi_SetStreamStateHandler @68 PaWasapiWinrt_SetDefaultDeviceId @67 PaWasapiWinrt_PopulateDeviceList @69 PaWasapi_GetIMMDevice @70 ================================================ FILE: thirdparty/portaudio/build/msvc/portaudio.dsp ================================================ # Microsoft Developer Studio Project File - Name="portaudio" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=portaudio - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "portaudio.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "portaudio.mak" CFG="portaudio - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "portaudio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "portaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "portaudio - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_x86" # PROP BASE Intermediate_Dir "Release_x86" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release_x86" # PROP Intermediate_Dir "Release_x86" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /machine:I386 /out:"./Release_x86/portaudio_x86.dll" !ELSEIF "$(CFG)" == "portaudio - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug_x86" # PROP BASE Intermediate_Dir "Debug_x86" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug_x86" # PROP Intermediate_Dir "Debug_x86" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "_DEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"./Debug_x86/portaudio_x86.dll" /pdbtype:sept !ENDIF # Begin Target # Name "portaudio - Win32 Release" # Name "portaudio - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Group "common" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\common\pa_allocation.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_converters.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_cpuload.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_debugprint.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_dither.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_front.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_process.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_ringbuffer.c # End Source File # Begin Source File SOURCE=..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c # End Source File # Begin Source File SOURCE=..\..\src\common\pa_stream.c # End Source File # End Group # Begin Group "hostapi" # PROP Default_Filter "" # Begin Group "ASIO" # PROP Default_Filter "" # Begin Group "ASIOSDK" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\asio.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\ASIOConvertSamples.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\asiodrivers.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\combase.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\debugmessage.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # Begin Source File SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\register.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # End Group # Begin Source File SOURCE=..\..\src\hostapi\asio\pa_asio.cpp # ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common" # End Source File # End Group # Begin Group "dsound" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\hostapi\dsound\pa_win_ds.c # End Source File # Begin Source File SOURCE=..\..\src\hostapi\dsound\pa_win_ds_dynlink.c # End Source File # End Group # Begin Group "wmme" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\hostapi\wmme\pa_win_wmme.c # End Source File # End Group # Begin Group "wasapi" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\hostapi\wasapi\pa_win_wasapi.cpp # End Source File # End Group # Begin Group "wdm-ks" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\hostapi\wdmks\pa_win_wdmks.c # End Source File # End Group # End Group # Begin Group "os" # PROP Default_Filter "" # Begin Group "win" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\src\os\win\pa_win_hostapis.c # End Source File # Begin Source File SOURCE=..\..\src\os\win\pa_win_util.c # End Source File # Begin Source File SOURCE=..\..\src\os\win\pa_win_waveformat.c # End Source File # Begin Source File SOURCE=..\..\src\os\win\pa_win_wdmks_utils.c # End Source File # Begin Source File SOURCE=..\..\src\os\win\pa_x86_plain_converters.c # End Source File # End Group # End Group # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # Begin Source File SOURCE=.\portaudio.def # End Source File # End Group # End Target # End Project ================================================ FILE: thirdparty/portaudio/build/msvc/portaudio.dsw ================================================ Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "portaudio"=".\portaudio.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### ================================================ FILE: thirdparty/portaudio/build/msvc/portaudio.sln ================================================  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 ReleaseMinDependency|Win32 = ReleaseMinDependency|Win32 ReleaseMinDependency|x64 = ReleaseMinDependency|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.ActiveCfg = ReleaseMinDependency|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.Build.0 = ReleaseMinDependency|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.ActiveCfg = ReleaseMinDependency|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.Build.0 = ReleaseMinDependency|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: thirdparty/portaudio/build/msvc/portaudio.vcproj ================================================ ================================================ FILE: thirdparty/portaudio/build/msvc/readme.txt ================================================ Hello This is a small list of steps in order to build portaudio (Currently v19-devel) into a VS2005 DLL and lib file. This DLL contains all 5 current Win32 PA APIS (MME/DS/ASIO/WASAPI/WDMKS) 1)Copy the source dirs that comes with the ASIO SDK inside src\hostapi\asio\ASIOSDK so you should now have example: portaudio19svn\src\hostapi\asio\ASIOSDK\common portaudio19svn\src\hostapi\asio\ASIOSDK\host portaudio19svn\src\hostapi\asio\ASIOSDK\host\sample portaudio19svn\src\hostapi\asio\ASIOSDK\host\pc portaudio19svn\src\hostapi\asio\ASIOSDK\host\mac (not needed) You dont need "driver" To build without ASIO (or another Host API) see the "Building without ASIO support" section below. 2) *If you have Visual Studio 6.0*, please make sure you have it updated with the latest (and final) microsoft libraries for it, namely: Service pack 5: Latest known URL: http://msdn2.microsoft.com/en-us/vstudio/aa718363.aspx Yes there EXISTS a service pack 6 , but the processor pack (below) isn't compatible with it. Processor Pack(only works with above SP5) Latest known URL: http://msdn2.microsoft.com/en-us/vstudio/Aa718349.aspx This isn't absolutely required for portaudio, but if you plan on using SSE intrinsics and similar things. Up to you to decide upon Service pack 5 or 6 depending on your need for intrinsics. Platform SDK (Feb 2003) : Latest known URL: http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm (This will allow your code base to be x64 friendly, with correct defines for LONG_PTR and such) NOTE A) Yes you have to use IE activex scripts to install that - wont work in Firefox, you may have to temporarily change tyour default browser(aint life unfair) NOTE B) Dont forget to hit "Register PSDK Directories with Visual Studio". you can make sure its right in VC6 if you open tools/options/directories/include files and you see SDK 2003 as the FIRST entry (it must be the same for libs) DirectX 9.0 SDK Update - (Summer 2003) Latest known URL: http://www.microsoft.com/downloads/details.aspx?familyid=9216652f-51e0-402e-b7b5-feb68d00f298&displaylang=en Again register the links in VC6, and check inside vc6 if headers are in second place right after SDk 2003 *If you have 7.0(VC.NET/2001) or 7.1(VC.2003) * then I suggest you open portaudio.dsp (and convert if needed) *If you have Visual Studio 2005 * (or later), I suggest you open the portaudio.sln file which contains 2 projects (portaudio & portaudio_static) each with 6 configurations: Win32/x64 in both Debug, Release and ReleaseMinDependency, last of which removes dependency of all but basic OS system DLLs. hit compile and hope for the best. 3)Now in any project, in which you require portaudio, you can just link with portaudio_x86.lib, (or _x64) and of course include the relevant headers (portaudio.h, and/or pa_asio.h , pa_x86_plain_converters.h) See (*) 4) Your new exe should now use portaudio_xXX.dll. Have fun! (*): you may want to add/remove some DLL entry points. Right now those 6 entries are _not_ from portaudio.h (from portaudio.def) (...) PaAsio_GetAvailableLatencyValues @50 PaAsio_ShowControlPanel @51 PaUtil_InitializeX86PlainConverters @52 PaAsio_GetInputChannelName @53 PaAsio_GetOutputChannelName @54 PaUtil_SetLogPrintFunction @55 *** Building without ASIO support *** To build PortAudio without ASIO support you need to: A. Make sure your project doesn't try to build any ASIO SDK files. If you're using one of the shipped projects, remove the ASIO related files from the project. B. Make sure your project doesn't try to build the PortAudio ASIO implementation files: src/hostapi/pa_asio.cpp src/hostapi/iasiothiscallresolver.cpp If you're using one of the shipped projects remove them from the project. C. Set the PA_USE_ASIO preprocessor symbol to zero (i.e. PA_USE_ASIO=0) in the project properties. In VS2005 this can be added under Project Properties > Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions Setting PA_USE_ASIO=0 stops src/os/win/pa_win_hostapis.c from trying to initialize the PA ASIO implementation. D. Remove PaAsio_* entry points from portaudio.def, or comment them out with ; A similar procedure can be used to omit any of the other host APIs from the build. The relevant preprocessor symbols used by pa_win_hostapis.c are: PA_USE_WMME, PA_USE_DSOUND, PA_USE_ASIO, PA_USE_WASAPI and PA_USE_WDMKS ----- David Viens, davidv@plogue.com Robert Bielik, robert@xponaut.se ================================================ FILE: thirdparty/portaudio/build/scons/SConscript_common ================================================ import os.path, sys class ConfigurationError(Exception): def __init__(self, reason): Exception.__init__(self, "Configuration failed: %s" % reason) env = Environment() # sunos, aix, hpux, irix, sunos appear to be platforms known by SCons, assuming they're POSIX compliant Posix = ("linux", "darwin", "sunos", "aix", "hpux", "irix", "sunos", "netbsd") Windows = ("win32", "cygwin") if env["PLATFORM"] == "posix": if sys.platform[:5] == "linux": Platform = "linux" elif sys.platform[:6] == "netbsd": Platform = "netbsd" else: raise ConfigurationError("Unknown platform %s" % sys.platform) else: if not env["PLATFORM"] in ("win32", "cygwin") + Posix: raise ConfigurationError("Unknown platform %s" % env["PLATFORM"]) Platform = env["PLATFORM"] # Inspired by the versioning scheme followed by Qt, it seems sensible enough. There are three components: major, minor # and micro. Major changes with each subtraction from the API (backward-incompatible, i.e. V19 vs. V18), minor changes # with each addition to the API (backward-compatible), micro changes with each revision of the source code. ApiVer = "2.0.0" Export("Platform", "Posix", "ConfigurationError", "ApiVer") ================================================ FILE: thirdparty/portaudio/build/scons/SConscript_opts ================================================ import os.path, sys def _PackageOption(pkgName, default=1): """ Allow user to choose whether a package should be used if available. This results in a commandline option use, where Pkgname is the name of the package with a capitalized first letter. @param pkgName: Name of package. @param default: The default value for this option ("yes"/"no"). """ return BoolOption("use%s" % pkgName[0].upper() + pkgName[1:], "use %s if available" % (pkgName), default) def _BoolOption(opt, explanation, default=1): """ Allow user to enable/disable a certain option. This results in a commandline option enable