Full Code of fdb/frequensea for AI

master 403e92a181a9 cached
480 files
61.9 MB
2.8M tokens
3835 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (11,395K chars total). Download the full file to get everything.
Repository: fdb/frequensea
Branch: master
Commit: 403e92a181a9
Files: 480
Total size: 61.9 MB

Directory structure:
gitextract_qzmky3ty/

├── .gitignore
├── API.md
├── AUTHORS
├── CMakeLists.txt
├── LICENSE
├── NOTES
├── README.md
├── c/
│   ├── Makefile
│   ├── README.md
│   ├── _export/
│   │   └── .gitkeep
│   ├── add-all-markers.sh
│   ├── add-markers.c
│   ├── batch.c
│   ├── demod-fm-streaming.c
│   ├── demod-fm.c
│   ├── easypng.h
│   ├── fft-batch-broad.c
│   ├── fft-batch.c
│   ├── fft-stitch-broad.c
│   ├── fft-stitch.c
│   ├── fft.c
│   ├── gradual-noise.c
│   ├── gridvis.c
│   ├── iq-lines.c
│   ├── iqvis-rtl.c
│   ├── iqvis.c
│   ├── osc-server.c
│   ├── piqvis.c
│   ├── play.c
│   ├── reader-all.sh
│   ├── reader.c
│   ├── render-text.c
│   ├── rfcap.c
│   ├── sender.c
│   ├── single-sample.c
│   ├── tv-sender.c
│   └── vis.c
├── data-wrangling/
│   ├── bipt_freqs.csv
│   └── csv2lua.py
├── externals/
│   ├── lua/
│   │   ├── CMakeLists.txt
│   │   └── src/
│   │       ├── Makefile
│   │       ├── lapi.c
│   │       ├── lapi.h
│   │       ├── lauxlib.c
│   │       ├── lauxlib.h
│   │       ├── lbaselib.c
│   │       ├── lbitlib.c
│   │       ├── lcode.c
│   │       ├── lcode.h
│   │       ├── lcorolib.c
│   │       ├── lctype.c
│   │       ├── lctype.h
│   │       ├── ldblib.c
│   │       ├── ldebug.c
│   │       ├── ldebug.h
│   │       ├── ldo.c
│   │       ├── ldo.h
│   │       ├── ldump.c
│   │       ├── lfunc.c
│   │       ├── lfunc.h
│   │       ├── lgc.c
│   │       ├── lgc.h
│   │       ├── linit.c
│   │       ├── liolib.c
│   │       ├── llex.c
│   │       ├── llex.h
│   │       ├── llimits.h
│   │       ├── lmathlib.c
│   │       ├── lmem.c
│   │       ├── lmem.h
│   │       ├── loadlib.c
│   │       ├── lobject.c
│   │       ├── lobject.h
│   │       ├── lopcodes.c
│   │       ├── lopcodes.h
│   │       ├── loslib.c
│   │       ├── lparser.c
│   │       ├── lparser.h
│   │       ├── lprefix.h
│   │       ├── lstate.c
│   │       ├── lstate.h
│   │       ├── lstring.c
│   │       ├── lstring.h
│   │       ├── lstrlib.c
│   │       ├── ltable.c
│   │       ├── ltable.h
│   │       ├── ltablib.c
│   │       ├── ltm.c
│   │       ├── ltm.h
│   │       ├── lua.c
│   │       ├── lua.h
│   │       ├── lua.hpp
│   │       ├── luac.c
│   │       ├── luaconf.h
│   │       ├── lualib.h
│   │       ├── lundump.c
│   │       ├── lundump.h
│   │       ├── lutf8lib.c
│   │       ├── lvm.c
│   │       ├── lvm.h
│   │       ├── lzio.c
│   │       └── lzio.h
│   ├── ovr/
│   │   ├── Include/
│   │   │   ├── OVR.h
│   │   │   ├── OVR_Kernel.h
│   │   │   └── OVR_Version.h
│   │   ├── Lib/
│   │   │   └── Mac/
│   │   │       ├── Debug/
│   │   │       │   └── libovr.a
│   │   │       └── Release/
│   │   │           └── libovr.a
│   │   └── Src/
│   │       ├── CAPI/
│   │       │   ├── CAPI_DistortionRenderer.cpp
│   │       │   ├── CAPI_DistortionRenderer.h
│   │       │   ├── CAPI_FrameTimeManager.cpp
│   │       │   ├── CAPI_FrameTimeManager.h
│   │       │   ├── CAPI_HMDRenderState.cpp
│   │       │   ├── CAPI_HMDRenderState.h
│   │       │   ├── CAPI_HMDState.cpp
│   │       │   ├── CAPI_HMDState.h
│   │       │   ├── CAPI_HSWDisplay.cpp
│   │       │   ├── CAPI_HSWDisplay.h
│   │       │   ├── CAPI_LatencyStatistics.cpp
│   │       │   ├── CAPI_LatencyStatistics.h
│   │       │   ├── GL/
│   │       │   │   ├── CAPI_GLE.cpp
│   │       │   │   ├── CAPI_GLE.h
│   │       │   │   ├── CAPI_GLE_GL.h
│   │       │   │   ├── CAPI_GL_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_GL_DistortionRenderer.h
│   │       │   │   ├── CAPI_GL_DistortionShaders.h
│   │       │   │   ├── CAPI_GL_HSWDisplay.cpp
│   │       │   │   ├── CAPI_GL_HSWDisplay.h
│   │       │   │   ├── CAPI_GL_Util.cpp
│   │       │   │   └── CAPI_GL_Util.h
│   │       │   └── Textures/
│   │       │       └── healthAndSafety.tga.h
│   │       ├── Displays/
│   │       │   ├── OVR_Display.cpp
│   │       │   ├── OVR_Display.h
│   │       │   ├── OVR_OSX_Display.cpp
│   │       │   ├── OVR_OSX_Display.h
│   │       │   ├── OVR_OSX_FocusObserver.h
│   │       │   ├── OVR_OSX_FocusObserver.mm
│   │       │   ├── OVR_OSX_FocusReader.h
│   │       │   └── OVR_OSX_FocusReader.mm
│   │       ├── Kernel/
│   │       │   ├── OVR_Alg.cpp
│   │       │   ├── OVR_Alg.h
│   │       │   ├── OVR_Allocator.cpp
│   │       │   ├── OVR_Allocator.h
│   │       │   ├── OVR_Array.h
│   │       │   ├── OVR_Atomic.cpp
│   │       │   ├── OVR_Atomic.h
│   │       │   ├── OVR_CRC32.cpp
│   │       │   ├── OVR_CRC32.h
│   │       │   ├── OVR_Color.h
│   │       │   ├── OVR_Compiler.h
│   │       │   ├── OVR_ContainerAllocator.h
│   │       │   ├── OVR_DebugHelp.cpp
│   │       │   ├── OVR_DebugHelp.h
│   │       │   ├── OVR_Delegates.h
│   │       │   ├── OVR_Deque.h
│   │       │   ├── OVR_File.cpp
│   │       │   ├── OVR_File.h
│   │       │   ├── OVR_FileFILE.cpp
│   │       │   ├── OVR_Hash.h
│   │       │   ├── OVR_KeyCodes.h
│   │       │   ├── OVR_List.h
│   │       │   ├── OVR_Lockless.cpp
│   │       │   ├── OVR_Lockless.h
│   │       │   ├── OVR_Log.cpp
│   │       │   ├── OVR_Log.h
│   │       │   ├── OVR_Math.cpp
│   │       │   ├── OVR_Math.h
│   │       │   ├── OVR_Nullptr.h
│   │       │   ├── OVR_Observer.h
│   │       │   ├── OVR_RefCount.cpp
│   │       │   ├── OVR_RefCount.h
│   │       │   ├── OVR_SharedMemory.cpp
│   │       │   ├── OVR_SharedMemory.h
│   │       │   ├── OVR_Std.cpp
│   │       │   ├── OVR_Std.h
│   │       │   ├── OVR_String.cpp
│   │       │   ├── OVR_String.h
│   │       │   ├── OVR_StringHash.h
│   │       │   ├── OVR_String_FormatUtil.cpp
│   │       │   ├── OVR_String_PathUtil.cpp
│   │       │   ├── OVR_SysFile.cpp
│   │       │   ├── OVR_SysFile.h
│   │       │   ├── OVR_System.cpp
│   │       │   ├── OVR_System.h
│   │       │   ├── OVR_ThreadCommandQueue.cpp
│   │       │   ├── OVR_ThreadCommandQueue.h
│   │       │   ├── OVR_Threads.h
│   │       │   ├── OVR_ThreadsPthread.cpp
│   │       │   ├── OVR_Timer.cpp
│   │       │   ├── OVR_Timer.h
│   │       │   ├── OVR_Types.h
│   │       │   ├── OVR_UTF8Util.cpp
│   │       │   ├── OVR_UTF8Util.h
│   │       │   ├── OVR_mach_exc_OSX.c
│   │       │   └── OVR_mach_exc_OSX.h
│   │       ├── Net/
│   │       │   ├── OVR_BitStream.cpp
│   │       │   ├── OVR_BitStream.h
│   │       │   ├── OVR_MessageIDTypes.h
│   │       │   ├── OVR_NetworkPlugin.cpp
│   │       │   ├── OVR_NetworkPlugin.h
│   │       │   ├── OVR_NetworkTypes.h
│   │       │   ├── OVR_PacketizedTCPSocket.cpp
│   │       │   ├── OVR_PacketizedTCPSocket.h
│   │       │   ├── OVR_RPC1.cpp
│   │       │   ├── OVR_RPC1.h
│   │       │   ├── OVR_Session.cpp
│   │       │   ├── OVR_Session.h
│   │       │   ├── OVR_Socket.cpp
│   │       │   ├── OVR_Socket.h
│   │       │   ├── OVR_Unix_Socket.cpp
│   │       │   └── OVR_Unix_Socket.h
│   │       ├── OVR_CAPI.cpp
│   │       ├── OVR_CAPI.h
│   │       ├── OVR_CAPI_GL.h
│   │       ├── OVR_CAPI_Keys.h
│   │       ├── OVR_JSON.cpp
│   │       ├── OVR_JSON.h
│   │       ├── OVR_Profile.cpp
│   │       ├── OVR_Profile.h
│   │       ├── OVR_SerialFormat.cpp
│   │       ├── OVR_SerialFormat.h
│   │       ├── OVR_Stereo.cpp
│   │       ├── OVR_Stereo.h
│   │       ├── Sensors/
│   │       │   └── OVR_DeviceConstants.h
│   │       ├── Service/
│   │       │   ├── Service_NetClient.cpp
│   │       │   ├── Service_NetClient.h
│   │       │   ├── Service_NetSessionCommon.cpp
│   │       │   └── Service_NetSessionCommon.h
│   │       ├── Tracking/
│   │       │   ├── Tracking_PoseState.h
│   │       │   ├── Tracking_SensorState.h
│   │       │   ├── Tracking_SensorStateReader.cpp
│   │       │   └── Tracking_SensorStateReader.h
│   │       └── Util/
│   │           ├── Util_ImageWindow.cpp
│   │           ├── Util_ImageWindow.h
│   │           ├── Util_Interface.cpp
│   │           ├── Util_Interface.h
│   │           ├── Util_LatencyTest2Reader.cpp
│   │           ├── Util_LatencyTest2Reader.h
│   │           ├── Util_LatencyTest2State.h
│   │           ├── Util_Render_Stereo.cpp
│   │           ├── Util_Render_Stereo.h
│   │           ├── Util_SystemGUI.cpp
│   │           ├── Util_SystemGUI.h
│   │           ├── Util_SystemGUI_OSX.mm
│   │           ├── Util_SystemInfo.cpp
│   │           ├── Util_SystemInfo.h
│   │           └── Util_SystemInfo_OSX.mm
│   ├── ovr-0.5.0.1/
│   │   └── Src/
│   │       ├── CAPI/
│   │       │   ├── CAPI_DistortionRenderer.cpp
│   │       │   ├── CAPI_DistortionRenderer.h
│   │       │   ├── CAPI_DistortionTiming.cpp
│   │       │   ├── CAPI_DistortionTiming.h
│   │       │   ├── CAPI_FrameLatencyTracker.cpp
│   │       │   ├── CAPI_FrameLatencyTracker.h
│   │       │   ├── CAPI_FrameTimeManager3.cpp
│   │       │   ├── CAPI_FrameTimeManager3.h
│   │       │   ├── CAPI_HMDRenderState.cpp
│   │       │   ├── CAPI_HMDRenderState.h
│   │       │   ├── CAPI_HMDState.cpp
│   │       │   ├── CAPI_HMDState.h
│   │       │   ├── CAPI_HSWDisplay.cpp
│   │       │   ├── CAPI_HSWDisplay.h
│   │       │   ├── D3D1X/
│   │       │   │   ├── CAPI_D3D11_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_D3D11_DistortionRenderer.h
│   │       │   │   ├── CAPI_D3D11_HSWDisplay.cpp
│   │       │   │   ├── CAPI_D3D11_HSWDisplay.h
│   │       │   │   ├── CAPI_D3D11_Util.cpp
│   │       │   │   ├── CAPI_D3D11_Util.h
│   │       │   │   └── Shaders/
│   │       │   │       ├── DistortionCS2x2.csh
│   │       │   │       ├── DistortionChroma_ps.psh
│   │       │   │       ├── DistortionChroma_vs.vsh
│   │       │   │       ├── DistortionTimewarpChroma_vs.vsh
│   │       │   │       ├── Distortion_ps.psh
│   │       │   │       ├── SimpleQuad_ps.psh
│   │       │   │       ├── SimpleQuad_vs.vsh
│   │       │   │       ├── SimpleTexturedQuad_ps.psh
│   │       │   │       ├── SimpleTexturedQuad_vs.vsh
│   │       │   │       ├── genComputeShaderHeader.bat
│   │       │   │       ├── genPixelShaderHeader.bat
│   │       │   │       └── genVertexShaderHeader.bat
│   │       │   ├── D3D9/
│   │       │   │   ├── CAPI_D3D9_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_D3D9_DistortionRenderer.h
│   │       │   │   ├── CAPI_D3D9_HSWDisplay.cpp
│   │       │   │   ├── CAPI_D3D9_HSWDisplay.h
│   │       │   │   └── CAPI_D3D9_Util.cpp
│   │       │   ├── GL/
│   │       │   │   ├── CAPI_GL_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_GL_DistortionRenderer.h
│   │       │   │   ├── CAPI_GL_DistortionShaders.h
│   │       │   │   ├── CAPI_GL_HSWDisplay.cpp
│   │       │   │   ├── CAPI_GL_HSWDisplay.h
│   │       │   │   ├── CAPI_GL_Util.cpp
│   │       │   │   └── CAPI_GL_Util.h
│   │       │   └── Textures/
│   │       │       ├── healthAndSafety.tga
│   │       │       ├── healthAndSafety.tga.h
│   │       │       ├── overdriveLut_dk2.h
│   │       │       └── overdriveLut_dk2_2.h
│   │       ├── Displays/
│   │       │   ├── OVR_Display.cpp
│   │       │   ├── OVR_Display.h
│   │       │   ├── OVR_OSX_Display.cpp
│   │       │   ├── OVR_OSX_Display.h
│   │       │   ├── OVR_Win32_Display.cpp
│   │       │   ├── OVR_Win32_Display.h
│   │       │   ├── OVR_Win32_Dxgi_Display.h
│   │       │   ├── OVR_Win32_FocusReader.cpp
│   │       │   ├── OVR_Win32_FocusReader.h
│   │       │   ├── OVR_Win32_RenderShim.cpp
│   │       │   ├── OVR_Win32_ShimFunctions.cpp
│   │       │   ├── OVR_Win32_ShimFunctions.h
│   │       │   └── OVR_Win32_ShimVersion.h
│   │       ├── Net/
│   │       │   ├── OVR_BitStream.cpp
│   │       │   ├── OVR_BitStream.h
│   │       │   ├── OVR_MessageIDTypes.h
│   │       │   ├── OVR_NetworkPlugin.cpp
│   │       │   ├── OVR_NetworkPlugin.h
│   │       │   ├── OVR_NetworkTypes.h
│   │       │   ├── OVR_PacketizedTCPSocket.cpp
│   │       │   ├── OVR_PacketizedTCPSocket.h
│   │       │   ├── OVR_RPC1.cpp
│   │       │   ├── OVR_RPC1.h
│   │       │   ├── OVR_Session.cpp
│   │       │   ├── OVR_Session.h
│   │       │   ├── OVR_Socket.cpp
│   │       │   ├── OVR_Socket.h
│   │       │   ├── OVR_Unix_Socket.cpp
│   │       │   ├── OVR_Unix_Socket.h
│   │       │   ├── OVR_Win32_Socket.cpp
│   │       │   └── OVR_Win32_Socket.h
│   │       ├── OVR_CAPI.cpp
│   │       ├── OVR_Profile.cpp
│   │       ├── OVR_Profile.h
│   │       ├── OVR_SerialFormat.cpp
│   │       ├── OVR_SerialFormat.h
│   │       ├── OVR_Stereo.cpp
│   │       ├── OVR_Stereo.h
│   │       ├── Sensors/
│   │       │   └── OVR_DeviceConstants.h
│   │       ├── Service/
│   │       │   ├── Service_NetClient.cpp
│   │       │   ├── Service_NetClient.h
│   │       │   ├── Service_NetSessionCommon.cpp
│   │       │   ├── Service_NetSessionCommon.h
│   │       │   ├── Service_Win32_FastIPC_Client.cpp
│   │       │   └── Service_Win32_FastIPC_Client.h
│   │       ├── Util/
│   │       │   ├── Util_Interface.cpp
│   │       │   ├── Util_Interface.h
│   │       │   ├── Util_LatencyTest2Reader.cpp
│   │       │   ├── Util_LatencyTest2Reader.h
│   │       │   ├── Util_LatencyTest2State.h
│   │       │   ├── Util_MatFile.cpp
│   │       │   ├── Util_MatFile.h
│   │       │   ├── Util_Render_Stereo.cpp
│   │       │   └── Util_Render_Stereo.h
│   │       └── Vision/
│   │           ├── SensorFusion/
│   │           │   ├── Vision_SensorState.h
│   │           │   ├── Vision_SensorStateReader.cpp
│   │           │   └── Vision_SensorStateReader.h
│   │           └── Vision_Common.h
│   └── stb/
│       ├── stb_image.h
│       └── stb_truetype.h
├── frequensea-osculator-config.oscd
├── houdini/
│   └── surface.hipnc
├── lua/
│   ├── _frequencies.lua
│   ├── _keys.lua
│   ├── animate-camera.lua
│   ├── capture-model.lua
│   ├── diffuse.lua
│   ├── draw-text.lua
│   ├── dvbt-animate-one.lua
│   ├── dvbt.lua
│   ├── empty.lua
│   ├── fft-sea-auto.lua
│   ├── fft-sea-sick.lua
│   ├── fft-sea.lua
│   ├── fft-shifted.lua
│   ├── fft.lua
│   ├── fm-player.lua
│   ├── grid-ripple.lua
│   ├── grid.lua
│   ├── iq-lines-animate-freq.lua
│   ├── iq-lines-animate-one.lua
│   ├── iq-lines-buffer.lua
│   ├── iq-lines.lua
│   ├── iq-tex-3d-filtered.lua
│   ├── iq-tex-3d.lua
│   ├── iq-tex-audio.lua
│   ├── iq-tex-filtered.lua
│   ├── iq-tex-steps.lua
│   ├── iq-tex.lua
│   ├── keys.lua
│   ├── model-sea.lua
│   ├── noise-grid-triangles.lua
│   ├── noise-grid-wave.lua
│   ├── noise-grid.lua
│   ├── osc-rotate.lua
│   ├── osc-server.lua
│   ├── psychedelic-noise.lua
│   ├── samples-and-model.lua
│   ├── samples-tex-3d-filtered.lua
│   ├── samples-tex-3d.lua
│   ├── samples-tex-shaded.lua
│   ├── samples-tex-slow.lua
│   ├── samples-tex.lua
│   ├── sea-grid.lua
│   ├── signal-detector.lua
│   ├── skybox.lua
│   ├── slinky-points.lua
│   ├── slinky-slow.lua
│   ├── slinky-two-point-five.lua
│   ├── slinky-vr.lua
│   ├── slinky.lua
│   ├── static-gradient.lua
│   ├── static.lua
│   └── texture-image.lua
├── obj/
│   ├── c004.obj
│   ├── cubes.obj
│   ├── grid.obj
│   └── monkey.obj
├── rfdata/
│   ├── rf-100.900-1.raw
│   ├── rf-100.900-2.raw
│   ├── rf-100.900-3.raw
│   ├── rf-1278.000-1.raw
│   ├── rf-1574.182-1.raw
│   ├── rf-1574.182-2.raw
│   ├── rf-1574.182-3.raw
│   ├── rf-2.500-1.raw
│   ├── rf-2.500-2.raw
│   ├── rf-2.500-3.raw
│   ├── rf-200.500-big.raw
│   ├── rf-2003.800-1.raw
│   ├── rf-2003.800-2.raw
│   ├── rf-2003.800-3.raw
│   ├── rf-202.500-1.raw
│   ├── rf-202.500-2.raw
│   ├── rf-202.500-3.raw
│   ├── rf-2040.200-1.raw
│   ├── rf-2040.200-2.raw
│   ├── rf-2040.200-3.raw
│   ├── rf-2072.300-1.raw
│   ├── rf-2072.300-2.raw
│   ├── rf-2072.300-3.raw
│   ├── rf-2104.800-1.raw
│   ├── rf-2104.800-2.raw
│   ├── rf-2104.800-3.raw
│   ├── rf-394.855-1.raw
│   ├── rf-4.000-1.raw
│   ├── rf-4.000-2.raw
│   ├── rf-4.000-3.raw
│   ├── rf-433.000-short.raw
│   ├── rf-433.000.raw
│   ├── rf-612.004-1.raw
│   ├── rf-612.004-2.raw
│   ├── rf-612.004-3.raw
│   ├── rf-862.000-1.raw
│   └── rf-887.000-1.raw
├── rpi-fdb/
│   ├── Makefile
│   ├── README
│   ├── iqvis.c
│   └── iqvis_lines.c
├── rust/
│   ├── Cargo.toml
│   └── src/
│       └── main.rs
├── shaders/
│   ├── skybox.frag
│   └── skybox.vert
└── src/
    ├── main.cpp
    ├── nfile.c
    ├── nfile.h
    ├── ngl.c
    ├── ngl.h
    ├── nim.c
    ├── nim.h
    ├── noise.c
    ├── noise.h
    ├── nosc.c
    ├── nosc.h
    ├── nrf.c
    ├── nrf.h
    ├── nut.c
    ├── nut.h
    ├── nvr.cpp
    ├── nvr.h
    ├── nwm.c
    ├── nwm.h
    ├── obj.c
    ├── obj.h
    ├── vec.c
    └── vec.h

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*.dSYM
/build/*.png
/c/**/*.png
/build
/c/add-markers
/c/batch
/c/demod-fm
/c/demod-fm-streaming
/c/export
/c/fft
/c/fft-batch
/c/fft-batch-broad
/c/fft-stitch
/c/fft-stitch-broad
/c/gradual-noise
/c/gridvis
/c/iq-lines
/c/iqvis
/c/iqvis-rtl
/c/osc-server
/c/piqvis
/c/play
/c/reader
/c/rfcap
/c/sender
/c/single-sample
/c/tv-sender
/c/vis
/c/render-text
/rpi-fdb/iqvis
/rpi-fdb/iqvis_lines
/rust/target
/rftmp


================================================
FILE: API.md
================================================
## Introduction

Here's a typical example of a script:

    function setup()
        -- Load the model, shaders, camera, ...
    end

    function draw()
        ngl_clear(0.2, 0.2, 0.2, 1)
        -- Draw your scene
    end

The Frequensea API uses a consistent naming scheme. Each call starts with the name of the module (nut, nwm, ngl, nosc or nrf), then the name of the object, then the action on that object. To illustrate, here's how you create a camera object:

    camera = ngl_camera_new()

To call a method on that object, use the object as the first argument:

    ngl_camera_rotate_x(camera, 45)

## NWM -- Window Manager

Currently you can't create, move or resize windows in Lua. You can call the "frequensea" binary with the `--width` and `--height` flags to change the size, e.g.:

    ./frequensea --width 1920 --height 1080 ../lua/static.lua

## nwm_get_time()
Get the current time, in seconds. This is a floating-point number, so the
fractional part contains greater precision.

## NGL -- OpenGL API

The API that loads models, shaders, initializes the camera and can draw things on screen.

### ngl_clear(red, green, blue, alpha)

Clear the screen and the depth buffer. The alpha component doesn't do anything at the moment, I don't know why.

### ngl_clear_depth()

Only clear the depth buffer; the screen is not cleared.

### ngl_camera

The `ngl_camera` object contains the current view and projection transforms. The projection is currently fixed: only the view transform (the position of the camera) can be modified.

### ngl_camera_new()

Create a new camera positioned at (0,0,0). Use `ngl_camera_translate` to move the camera. Returns a `ngl_camera` object that can be used with `ngl_draw_model`.

### ngl_camera_new_look_at(x, y, z)

Create a camera object that is positioned at the given x/y/z values and looks at
the origin (0,0,0) of the scene. Returns a camera object that can be used with `ngl_draw_model`.

### ngl_camera_translate(camera, x, y, z)

Translate (or move) the camera by the given x, y, z values. This changes the camera in-place, no new camera object is created.

### ngl_camera_rotate_x(camera, degrees) / ngl_camera_rotate_y(camera, degrees) / ngl_camera_rotate_z(camera, degrees)

Rotate the camera over the given axis by degrees. This changes the camera in-place, no new camera object is created.

### ngl_shader

The `ngl_shader` object contains the vertex and fragment shaders necessary for drawing objects on screen. It also contains the draw mode: an OpenGL constant that specifies whether you want to draw lines (`GL_LINES`, `GL_LINE_STRIP`, `GL_LINE_LOOP`) or triangles (`GL_TRIANGLES`, `GL_TRIANGLE_STRIP`, `GL_TRIANGLE_FAN`).

### ngl_shader_new(draw_mode, vertex_shader, fragment_shader)

Create a new shader using the given vertex shader and fragment shader source.
Note that you can use Lua's multi-line strings:

    VERTEX_SHADER = [[
        #version 400
        <Rest of the shader code goes here>
    ]]

The first argument is a OpenGL draw mode. For a scene loaded using `ngl_model_load_obj`
this should probably be GL_TRIANGLES.

Other modes are `GL_POINTS`, `GL_LINE_STRIP`, `GL_LINE_LOOP`, `GL_LINES`, `GL_TRIANGLE_STRIP`, `GL_TRIANGLE_FAN`, `GL_TRIANGLES`. See [glDrawArrays](https://www.opengl.org/sdk/docs/man3/xhtml/glDrawArrays.xml) for more info on drawing modes.

### ngl_shader_new_from_file(draw_mode, vertex_file, fragment_file)

Create a new shader by loading the vertex and fragment file. The first argument is a OpenGL draw mode;
for a scene loaded using `ngl_model_load_obj` this should probably be GL_TRIANGLES.

Other modes are `GL_POINTS`, `GL_LINE_STRIP`, `GL_LINE_LOOP`, `GL_LINES`, `GL_TRIANGLE_STRIP`, `GL_TRIANGLE_FAN`, `GL_TRIANGLES`. See [glDrawArrays](https://www.opengl.org/sdk/docs/man3/xhtml/glDrawArrays.xml) for more info on drawing modes.

### ngl_shader_uniform_set_float(shader, uniform_name, value)

Set the uniform in GLSL to the given value. This is useful to change a running shader on the fly.


### ngl_texture

Textures are images that are sent to the shader. These images can be loaded from a file (using `ngl_texture_new_from_file`) or updated on-the-fly, with data from a buffer (using `ngl_texture_update`).

### ngl_texture_new(shader, uniform_name)

Create an empty texture object. The name refers to the texture uniform name in the shader. Returns a `ngl_texture` object that can be used with `ngl_texture_update`.

### ngl_texture_new_from_file(file_name, shader, uniform_name)

Create a texture object from an image file. The name refers to the texture uniform name in the shader. Returns a `ngl_texture` object.

## ngl_texture_update(texture, buffer, width, height)

Set the texture data. `texture` is the texture object returned by `ngl_texture_new.` `buffer` is a `nut_buffer`, such as returned from `nrf_device_get_samples_buffer`. Since buffers are one-dimensional, `width` and `height` are needed to change this into a two-dimensional texture. Note that width * height needs to match the size of the buffer. If the sizes are incorrect, the program will crash.

### ngl_model_new_with_buffer(buffer)

Create a new model by initializing it with a list of points. The model will have as many channels as the buffer, that is 2D for 2 channels, 3D for 3 channels. The points will not have normals or texture coordinates.

This function returns a `ngl_model` object that can be used in `ngl_draw_model`.

### ngl_model_new_grid_points(row_count, column_count, row_height, column_width)

Create a new model that contains a two-dimensional grids with one point per grid position. The grid will have row_count * column_count points. `row_height` and `column_width` specify the distance between each row and column. This model won't have any normals.

### ngl_model_new_grid_triangles(row_count, column_count, row_height, column_width)

Initialize a grid that can be used to draw triangles. Point positions are in the X and Z components. The grid will have (row_count-1) * (column_count -1) * 6 points (two triangles per grid "square"). `row_height` and `column_width` specify the distance between each row and column. This model has normals.

## ngl_model_load_obj(file)
Load an OBJ file from disk. The OBJ file should only use triangles, and should have normals exported.

This function returns a model object that can be used in `ngl_draw_model`.

## ngl_model_translate(model, tx, ty, tz)
Translate the model. The model is transformed in-place; no data is returned.

## ngl_draw_model(camera, model, shader)
Draw the model with the given shader. Use the same camera object if you want consistent views of the scene.

## ngl_capture_model(camera, model, shader, file_name)
Save the model to an OBJ file called `file_name`. This will use the [OpenGL Transform Feedback](https://www.opengl.org/wiki/Transform_Feedback) feature to save the output of the vertex shader. Currently, only gl_Position is saved. This call is very slow, so best is to trigger it on a key press. See `save-model.lua` for an example.

## NRF -- NDBX Radio Frequency
Functions for reading data from a software defined radio (SDR) device.

Here's a basic example:

    device = nrf_device_new(204.0)
    while true do
        -- Do something with device.samples
    end
    nrf_device_free(device)

## nrf_device_new(freq_mhz, data_file)
Tune the SDR device to the given frequency (in MHz) and start receiving data. We can receive data from RTL-SDR, HackRF, or fall back to a data file. The function returns a device object. The device object has a member, `samples`, that contains a list of NRF_SAMPLES_LENGTH three-component floating-point values, containing (i, q, t) where t is a value between 0.0 (beginning of the sample data) to 1.0 (end of the sample data).

### nrf_device_set_frequency(device, freq_mhz)
Change the frequency device to the given frequency (in MHz). The `device` is a device object as returned by `nrf_device_new`.

### nrf_device_set_paused(device, paused)
If `paused` is 1, stop receiving new blocks; instead just keep working on the current block. This currently only works for dummy devices.

### nrf_device_step(device)
Advance one block. This is only works if the device is paused using `nrf_device_set_paused(device, true)`

### nrf_device_get_samples_buffer(device)
Get the raw samples buffer. This returns a buffer object that can be used with ngl_texture_update, e.g.:

    buffer = nrf_device_get_samples_buffer(device)
    ngl_texture_update(texture, buffer.width, buffer.height, buffer.channels, buffer.data)

### nrf_device_get_iq_buffer(device)
Get the IQ values plotted as points. This returns a buffer object that can be used with ngl_texture_update.

### nrf_device_get_iq_lines(device, int size_multiplier, float line_percentage)
Get the IQ values plotted as lines. This returns a buffer object that can be used with ngl_texture_update. `size_multiplier` specifies the multiplication factor with regards to the IQ data resolution (so 256 * size_multiplier). The line_percentage is a value between 0-1 that specifies how much of the sample buffer to draw.

The buffer will have one color channel, which maps to the red channel in the fragment shader.

Note that lines can overlap, and the buffer values can be higher than 1.0. It is a good idea to scale the colors down in the shader.

### nrf_device_get_fft_buffer(device)
Get the FFT data as a buffer. This returns a buffer object that can be used with ngl_texture_update. The size is controlled by fft_size (the buffer width) and fft_history_size (the buffer_height). Both can be set when initializing the device, for example:

    device = nrf_device_new_with_config({freq_mhz=100.0, fft_width=1024, fft_history_size=2048})

## NUT -- Utilities

### nut_buffer

A number of functions, such as nrf_device_get_samples_buffer, return a `nut_buffer`. There are two types of nut_buffers: one that contain unsigned bytes (`NUT_BUFFER_U8`) and one that contains double-precision floating point values (`NUT_BUFFER_F64`).

You can't create new buffers in Lua, but you can modify them using the following commands:

### nut_buffer_append(dst, src)

Append the `src` buffer to the `dst` buffer. Both buffers need to be of the same type. The destination buffer is enlarged to fit the contents of both buffers. The `src` buffer is not modified.

### nut_buffer_reduce(buffer, percentage)

Return a new buffer that's a given percentage of the original buffer's size. Percentage is a value between 0.0-1.0. The returned buffer will have the same type as the input buffer.

### nut_buffer_clip(buffer, offset, length)

Return a new buffer that's a subset of the original buffer. The returned buffer will have the same type as the input buffer.

### nut_buffer_convert(buffer, new_type)

Return a new buffer that's converted from the original type. `new_type` can be `NUT_BUFFER_U8` for unsigned bytes or `NUT_BUFFER_F64` for double-precision floating point values. Converting to the same type just creates a copy of the buffer.

### nut_buffer_save(buffer, file_name)

Save the contents of the buffer to the given file. The buffer data is saved "as-is", that is, no conversion is performed.


================================================
FILE: AUTHORS
================================================
# Primary Author
Frederik De Bleser <frederik@debleser.be>

# Contributors
Lieven Menschaert <lieven.menschaert@gmail.com>
Pieter Heremans <pieter.heremans@gmail.com>



================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 2.8.4)
project(frequensea)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99 -g -Wall -Werror -pedantic")

add_subdirectory(externals/lua)

include_directories(src)
include_directories(externals/ovr/Include)
include_directories(externals/ovr/Src)
include_directories(externals/lua/src)
include_directories(externals/stb)

find_library(LIBRARY_MATH m)
find_library(LIBRARY_PTHREAD pthread)
find_library(LIBRARY_FFTW fftw3)
find_library(LIBRARY_HACKRF hackrf)
find_library(LIBRARY_PNG png)
find_library(LIBRARY_RTLSDR rtlsdr)

find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
include_directories(${GLFW_INCLUDE_DIRS})

find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)

include(FindOpenAL)
set(CORE_LIBS ${LIBRARY_MATH} ${LIBRARY_PTHREAD} ${LIBRARY_FFTW} ${LIBRARY_HACKRF} ${LIBRARY_PNG} ${LIBRARY_RTLSDR} ${OPENGL_LIBRARY})
include_directories(${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR})

if (APPLE)
    include_directories(/System/Library/Frameworks /usr/local/include)
    #find_library(LIBRARY_OVR ovr PATHS externals/ovr/Lib/Mac/Debug)
    find_library(FRAMEWORK_COCOA Cocoa)
    find_library(FRAMEWORK_OPENGL OpenGL)
    find_library(FRAMEWORK_OPENAL OpenAL)
    find_library(FRAMEWORK_CORE_VIDEO CoreVideo)
    find_library(FRAMEWORK_IO_KIT IOKit)
    set(PLATFORM_LIBS ${LIBRARY_OVR} ${FRAMEWORK_COCOA} ${FRAMEWORK_OPENGL} ${FRAMEWORK_OPENAL} ${FRAMEWORK_CORE_VIDEO} ${FRAMEWORK_IO_KIT})
    #add_definitions(-DWITH_NVR)
    #set(WITH_NVR 1)
endif (APPLE)

if (LINUX)
    find_package(X11 REQUIRED)
    set(PLATFORM_LIBS ${X11_X11_LIB} ${RT_LIBRARY} ${X11_Xrandr_LIB})
endif (LINUX)

set(SOURCE_FILES
    src/main.cpp
    src/nfile.c
    src/ngl.c
    src/nim.c
    src/noise.c
    src/nosc.c
    src/nrf.c
    src/nut.c
    src/nwm.c
    src/obj.c
    src/vec.c)

if (WITH_NVR)
    set(SOURCE_FILES ${SOURCE_FILES} src/nvr.cpp)
endif (WITH_NVR)

add_executable(frequensea ${SOURCE_FILES})
target_link_libraries(frequensea ${CORE_LIBS} ${PLATFORM_LIBS} stdc++ lua ${GLEW_LIBRARIES} ${OPENAL_LIBRARY} ${GLFW_LDFLAGS})


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 Frederik De Bleser

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.

================================================
FILE: NOTES
================================================
## hackrf public header

https://github.com/mossmann/hackrf/blob/master/host/libhackrf/src/hackrf.h

================================================
FILE: README.md
================================================
## Frequensea

Frequensea is an open-source toolkit for visualizing the electromagnetic spectrum.

![A sea of FFT data](https://raw.github.com/fdb/frequensea/master/screenshots/fft-sea.png)

Watch the [Frequensea video introduction](https://youtu.be/u6H1DatxLAc).

## Features
- Fast core written in C, with Lua scripting on top.
- Support for RTL-SDR and HackRF devices.
- Support for Oculus Rift for viewing the spectrum in virtual reality.
- Support for OSC to communicate with other applications or devices.
- Basic building blocks for sampling, filtering and visualizing RF data.

## Installing dependencies (OS X)

    brew update
    brew install cmake glew fftw librtlsdr hackrf libpng libsndfile pkgconfig homebrew/versions/glfw3

## Installing dependencies (Ubuntu 14.04 LTS)

    sudo apt-get install -y git cmake gcc g++ make libfftw3-dev libpng-dev libusb-1.0.0-dev pkg-config xorg-dev libglu1-mesa-dev libopenal-dev libglew-dev libhackrf-dev librtlsdr-dev pkg-config

    # There is no GLFW3 package so install from source
    wget https://github.com/glfw/glfw/releases/download/3.1.1/glfw-3.1.1.zip
    unzip 3.1.1.zip
    cd glfw-3.1.1
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
    sudo ldconfig

## Installing dependencies (Raspberry Pi - Raspbian Jessie)

    sudo apt-get install -y git cmake gcc g++ make libfftw3-dev libpng-dev libusb-1.0.0-dev pkg-config xorg-dev libglu1-mesa-dev libopenal-dev libglew-dev libhackrf-dev librtlsdr-dev libglfw3-dev

    # Raspberry Pi doesn't support GLX, so until that's supported,
    # we'll use the software rendering packages.
    # Note that I found that installing mesa can *remove* libglfw3-dev,
    # which we need, so if you get errors against that make sure
    # it's installed.
    sudo apt-get install -y libgl1-mesa-swx11 libglu1-mesa-dev libglew-dev

    # Disable default kernel driver
    sudo modprobe -r dvb_usb_rtl28xxu

Note that you might need to run as root to claim the graphics driver, especially if you don't use the default "pi" user.

## Building

    mkdir build
    cd build/
    cmake ..
    make

## Running

    ./frequensea ../lua/static.lua

With the Oculus:

    ./frequensea --vr ../lua/static.lua

Save the output to a PNG sequence:

    ./frequensea --capture ../lua/animate-camera.lua

## Build and Run

    make && ./frequensea ../lua/static.lua

## Documentation

- API.md contains all available Frequensea calls.
- Examples are in the "lua" folder.


================================================
FILE: c/Makefile
================================================
add-markers: add-markers.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o add-markers add-markers.c -lpng

reader: reader.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l hackrf -o reader reader.c

sender: sender.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l hackrf -o sender sender.c

tv-sender: tv-sender.c
	gcc -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l hackrf -o tv-sender tv-sender.c

vis: vis.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o vis vis.c -l glfw -l hackrf -lpng -framework OpenGL

gradual-noise: gradual-noise.c
	gcc -O3 --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o gradual-noise gradual-noise.c -lpng

gridvis: gridvis.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o gridvis gridvis.c -l glfw -l hackrf -lpng -framework OpenGL

rfcap: rfcap.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l hackrf -o rfcap rfcap.c

batch: batch.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o batch batch.c -l hackrf -lpng

fft: fft.c
	gcc -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o fft fft.c -l hackrf -lpng -lfftw3 -lm -l glfw -framework OpenGL

fft-batch: fft-batch.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o fft-batch fft-batch.c -lhackrf -lpng -lfftw3

fft-batch-broad: fft-batch-broad.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o fft-batch-broad fft-batch-broad.c -lhackrf -lpng -lfftw3

fft-stitch: fft-stitch.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o fft-stitch fft-stitch.c -lpng

fft-stitch-broad: fft-stitch-broad.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -o fft-stitch-broad fft-stitch-broad.c -lpng

iq-lines: iq-lines.c
	gcc --std=c99 -g -Wall -Werror -pedantic `pkg-config --cflags --libs --static libpng libhackrf glfw3` -o iq-lines iq-lines.c

iqvis: iqvis.c
	gcc -I /opt/homebrew/include -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -L /opt/homebrew/lib -o iqvis iqvis.c -l glfw -l hackrf -lpng -framework OpenGL

iqvis-rtl: iqvis-rtl.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I/usr/local/include `pkg-config --cflags libpng librtlsdr glfw3 glew` -o iqvis-rtl iqvis-rtl.c -L/usr/local/lib `pkg-config --libs --static libpng librtlsdr glfw3 glew`

demod-fm: demod-fm.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l hackrf -framework OpenAL -o demod-fm demod-fm.c

demod-fm-streaming: demod-fm-streaming.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l hackrf -framework OpenAL -o demod-fm-streaming demod-fm-streaming.c

osc-server: osc-server.c
	gcc --std=c99 -g -Wall -Werror -pedantic -o osc-server osc-server.c

play: play.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /usr/local/lib -L /opt/homebrew/lib -l sndfile -framework OpenAL -o play play.c

piqvis: piqvis.c
	gcc --std=c99 -g -Wall -Werror -pedantic -I/usr/local/include `pkg-config --cflags librtlsdr glfw3 glew` -o piqvis piqvis.c -L/usr/local/lib `pkg-config --libs --static librtlsdr glfw3 glew`

single-sample: single-sample.c
	gcc -O3 --std=c99 -g -Wall -Werror -pedantic `pkg-config --cflags --libs libpng` -o single-sample single-sample.c

render-text: render-text.c
	gcc --std=c99 -g -Wall -Werror -pedantic `pkg-config --cflags --libs libpng` -o render-text render-text.c


================================================
FILE: c/README.md
================================================
Mac OS X
========
To install on OS X:

    sudo port install hackrf glfw libpng fftw
    make vis && ./vis


================================================
FILE: c/_export/.gitkeep
================================================


================================================
FILE: c/add-all-markers.sh
================================================
#!/bin/sh
make add-markers
./add-markers 10 465
./add-markers 470 925
./add-markers 930 1385
./add-markers 1390 1845
./add-markers 1850 2305
./add-markers 2310 2765
./add-markers 2770 3225
./add-markers 3230 3685
./add-markers 3690 4145
./add-markers 4150 4605


================================================
FILE: c/add-markers.c
================================================
// Add markers

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#define STB_IMAGE_IMPLEMENTATION
#include "../externals/stb/stb_image.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "../externals/stb/stb_truetype.h"

#include "easypng.h"

// Utility //////////////////////////////////////////////////////////////////

uint8_t max_u8(uint8_t a, uint8_t b) {
    return a > b ? a : b;
}

// Image operations /////////////////////////////////////////////////////////

void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t dst_stride, uint32_t src_stride) {
    for (uint32_t i = 0; i < height; i++) {
        for (uint32_t j = 0; j < width; j++) {
            uint32_t dst_offset = (dst_y + i) * dst_stride + dst_x + j;
            uint32_t src_offset = (src_y + i) * src_stride + src_x + j;
            dst[dst_offset] = max_u8(dst[dst_offset], src[src_offset]);
        }
    }
}

void img_pixel_put(uint8_t *buffer, uint32_t stride, uint32_t x, uint32_t y, uint8_t v) {
    if (x > 0 && y > 0) {
        buffer[(y * stride) + x] = v;
    }
}

void img_vline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y1, uint32_t y2, uint8_t v) {
    if (x1 > stride) return;
    for (int y = y1; y < y2; y++) {
        img_pixel_put(buffer, stride, x1, y, v);
    }
}

void img_hline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y1, uint32_t x2, uint8_t v) {
    for (int x = x1; x < x2; x++) {
        img_pixel_put(buffer, stride, x, y1, v);
    }
}

// Font operations //////////////////////////////////////////////////////////

typedef struct {
    stbtt_fontinfo font;
    uint8_t *buffer;
} ntt_font;

ntt_font *ntt_font_load(const char *font_file) {
    ntt_font *font = calloc(1, sizeof(ntt_font));

    FILE *fp = fopen(font_file, "rb");
    fseek(fp, 0L, SEEK_END);
    long size = ftell(fp);
    rewind(fp);
    font->buffer = calloc(size, 1);
    fread(font->buffer, size, 1, fp);
    fclose(fp);

    stbtt_InitFont(&font->font, font->buffer, stbtt_GetFontOffsetForIndex(font->buffer, 0));
    return font;
}

void ntt_font_measure(const ntt_font *font, const char *text, const int x, const int y, const int font_size, int *width, int *height) {
    float font_scale = stbtt_ScaleForPixelHeight(&font->font, font_size);
    int ascent, descent;
    stbtt_GetFontVMetrics(&font->font, &ascent, &descent, 0);
    int baseline = (int) (ascent * font_scale);
    int descent_scaled = (int) (descent * font_scale);
    //printf("Baseline %d descent %d\n", baseline, descent_scaled);

    *width = x;
    // The glyph height is constant for the font.
    // Descent_scaled is negative.
    *height = y + (baseline - descent_scaled);

    int ch = 0;
    while (text[ch]) {
        int x0, y0, x1, y1;
        int advance, lsb;
        char c = text[ch];
        stbtt_GetCodepointBitmapBox(&font->font, c, font_scale, font_scale, &x0, &y0, &x1, &y1);
        stbtt_GetCodepointHMetrics(&font->font, c, &advance, &lsb);
        int glyph_width = advance * font_scale;
        *width += glyph_width;
        if (text[ch + 1]) {
            *width += font_scale * stbtt_GetCodepointKernAdvance(&font->font, c, text[ch + 1]);
        }
        ch++;
    }
}

void ntt_font_draw(const ntt_font *font, uint8_t *img, const uint32_t img_stride, const char *text, const int x, const int y, const int font_size) {
    int text_width, text_height;
    ntt_font_measure(font, text, 0, 0, font_size, &text_width, &text_height);
    int start_x = x - text_width / 2;
    if (start_x < 0) return;

    float font_scale = stbtt_ScaleForPixelHeight(&font->font, font_size);
    int ascent;
    stbtt_GetFontVMetrics(&font->font, &ascent, 0, 0);
    int baseline = (int) (ascent * font_scale);

    int ch = 0;
    int _x = 0;
    while (text[ch]) {
        int w, h, dx, dy;
        int advance, lsb;
        char c = text[ch];
        stbtt_GetCodepointHMetrics(&font->font, c, &advance, &lsb);
        uint8_t *glyph_bitmap = stbtt_GetCodepointBitmap(&font->font, font_scale, font_scale, c, &w, &h, &dx, &dy);
        //printf("Offset %d %d\n", dx, baseline + dy);
        img_gray_copy(img, glyph_bitmap, start_x + _x + dx, y + baseline + dy, 0, 0, w, h, img_stride, w);
        //x += w;
        _x += (advance * font_scale);

        if (text[ch + 1]) {
            _x += font_scale * stbtt_GetCodepointKernAdvance(&font->font, c, text[ch + 1]);
        }

        ch++;
    }
}

// Main /////////////////////////////////////////////////////////////////////

int frequency_to_x(const int image_width, const uint64_t frequency_real_start, const uint64_t frequency_real_range, const uint64_t freq) {
    const uint64_t real_freq = freq - frequency_real_start;
    return round(real_freq / (double) frequency_real_range * image_width);
}

int main(int argc, char **argv) {
    assert(argc == 3);

    const uint32_t HEADER_HEIGHT = 300;
    const uint32_t FOOTER_HEIGHT = 300;
    const uint32_t FOOTER_BLEED = 35;

    const uint32_t TARGET_WIDTH = 23693;
    const uint32_t TARGET_HEIGHT = 7157;

    const uint32_t SOURCE_WIDTH = TARGET_WIDTH;
    const uint32_t SOURCE_HEIGHT = TARGET_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT;

    const uint64_t FREQUENCY_START = atoi(argv[1]) * 1e6;
    const uint64_t FREQUENCY_END = atoi(argv[2]) * 1e6;
    const uint32_t SAMPLE_RATE = 5e6;

    // The FREQUENCY_START is the center frequency of each file. The real start of the file is the start - sample_rate / 2.
    const uint64_t FREQUENCY_REAL_START = FREQUENCY_START - (SAMPLE_RATE / 2);
    const uint64_t FREQUENCY_REAL_END = FREQUENCY_END + (SAMPLE_RATE / 2);
    const uint64_t FREQUENCY_REAL_RANGE = FREQUENCY_REAL_END - FREQUENCY_REAL_START;

    const uint32_t MINOR_TICK_RATE = 1e6;
    const uint32_t MINOR_TICK_HEIGHT = 30;
    const uint32_t MAJOR_TICK_RATE = 50e6;
    const uint32_t MAJOR_TICK_HEIGHT = 60;
    const uint8_t LINE_COLOR = 255;
    const char* FONT_FILE = "../fonts/RobotoCondensed-Bold.ttf";
    const uint16_t FONT_SIZE_PX = 64;

    printf("Frequency range: %.0f MHz - %.0f MHz\n", FREQUENCY_START / 1e6, FREQUENCY_END / 1e6);

    ntt_font *font = ntt_font_load(FONT_FILE);

    char in_file_name[100];
    snprintf(in_file_name, 100, "broad-stitched-%.0f-%.0f.png", FREQUENCY_START / 1e6, FREQUENCY_END / 1e6);
    char out_file_name[100];
    snprintf(out_file_name, 100, "broad-stitched-%.0f-%.0f-markers.png", FREQUENCY_START / 1e6, FREQUENCY_END / 1e6);

    int width, height, n;
    printf("Reading %s...\n", in_file_name);
    uint8_t *in_buffer = stbi_load(in_file_name, &width, &height, &n, 1);
    assert(width == SOURCE_WIDTH);
    assert(height == SOURCE_HEIGHT);
    int out_width = width;
    int out_height = height + HEADER_HEIGHT + FOOTER_HEIGHT;
    assert(out_width == TARGET_WIDTH);
    assert(out_height == TARGET_HEIGHT);
    uint8_t *out_buffer = calloc(out_width * out_height, sizeof(uint8_t));

    printf("Composing...\n");
    img_gray_copy(out_buffer, in_buffer, 0, HEADER_HEIGHT, 0, 0, width, height, out_width, width);

    printf("Adding markers...\n");

    int header_bottom = HEADER_HEIGHT;
    int footer_top = HEADER_HEIGHT + height;
    int footer_bottom = out_height - 1;

    // Add white lines at header bottom + footer top/bottom.
    const int border_height = 10;
    for (int i = 0; i < border_height; i++) {
        img_hline(out_buffer, out_width, 0, header_bottom - i, out_width, LINE_COLOR);
        img_hline(out_buffer, out_width, 0, footer_top + i, out_width, LINE_COLOR);
    }
    footer_top += border_height;

    // Add minor ticks.
    for (uint64_t freq = 0; freq < FREQUENCY_REAL_END; freq += MINOR_TICK_RATE) {
        int x = frequency_to_x(out_width, FREQUENCY_REAL_START, FREQUENCY_REAL_RANGE, freq);
        if (x > 0 && x < out_width) {
            for (int dx = -1; dx <= 1; dx += 1) {
                img_vline(out_buffer, out_width, x + dx, footer_top, footer_top + MINOR_TICK_HEIGHT, LINE_COLOR);
                img_vline(out_buffer, out_width, x + dx, footer_bottom - MINOR_TICK_HEIGHT - FOOTER_BLEED, footer_bottom + 1, LINE_COLOR);
            }
        }
    }

    // Add major ticks + text.
    const uint32_t labels_y = height + HEADER_HEIGHT + (FOOTER_HEIGHT / 2 - FONT_SIZE_PX / 2 - FOOTER_BLEED / 2);
    for (uint64_t freq = 0; freq < FREQUENCY_REAL_END; freq += MAJOR_TICK_RATE) {
        int x = frequency_to_x(out_width, FREQUENCY_REAL_START, FREQUENCY_REAL_RANGE, freq);
        if (x > 0 && x < out_width) {
            for (int dx = -2; dx <= 2; dx += 1) {
                img_vline(out_buffer, out_width, x + dx, footer_top, footer_top + MAJOR_TICK_HEIGHT, LINE_COLOR);
                img_vline(out_buffer, out_width, x + dx, footer_bottom - MAJOR_TICK_HEIGHT - FOOTER_BLEED, footer_bottom + 1, LINE_COLOR);
            }
            if (freq > FREQUENCY_REAL_START && freq < FREQUENCY_REAL_END) {
                char text[200];
                snprintf(text, 200, "%.2f", (freq / (double) 1e6));
                ntt_font_draw(font, out_buffer, out_width, text, x, labels_y, FONT_SIZE_PX);
            }
        }
    }

    printf("Writing %s...\n", out_file_name);
    write_gray_png(out_file_name, out_width, out_height, out_buffer);

    exit(0);
}



================================================
FILE: c/batch.c
================================================
// Process frequency range in batch.

#include <libhackrf/hackrf.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "easypng.h"

#define WIDTH 512
#define HEIGHT 512

const double start_freq = 1;
const double end_freq = 6000;
const double freq_step = 1;
double current_freq = start_freq;

hackrf_device *device;
int receive_count = 0;
int paused = 0;
uint8_t buffer[WIDTH * HEIGHT];

#define HACKRF_CHECK_STATUS(status, message) \
    if (status != 0) { \
        printf("FAIL: %s\n", message); \
        hackrf_close(device); \
        hackrf_exit(); \
        exit(EXIT_FAILURE); \
    } \

void export_buffer() {
    paused = 1;
    char fname[100];
    snprintf(fname, 100, "export/img-%.3f.png", current_freq);
    write_gray_png(fname, WIDTH, HEIGHT, buffer);
    paused = 0;
}

void next_frequency() {
    receive_count = 0;
    current_freq += freq_step;
    if (current_freq <= end_freq) {
        printf("Frequency: %.3f MHz\n", current_freq);
        int status = hackrf_set_freq(device, current_freq * 1e6);
        HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
    } else {
        printf("Done.\n");
        exit(0);
    }
}

int receive_sample_block(hackrf_transfer *transfer) {
    if (paused) return 0;
    receive_count += 1;
    // memcpy(buffer, transfer->buffer, transfer->valid_length);
    for (int i = 0; i < transfer->valid_length; i+= 2) {
        buffer[i] = transfer->buffer[i + 1];
        buffer[i + 1] = transfer->buffer[i + 1];
    }
    return 0;
}

int main(int argc, char **argv) {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, current_freq * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, 10e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");

    while (1) {
        if (receive_count < 10) {
            usleep(100);
        } else {
            export_buffer();
            next_frequency();
        }
    }

    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
    return 0;
}


================================================
FILE: c/demod-fm-streaming.c
================================================
// Demodulate FM stream, continuously.

#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <OpenAL/al.h>
#include <OpenAL/alc.h>

#include <libhackrf/hackrf.h>

const double TAU = M_PI * 2;
const int IN_SAMPLE_RATE = 10e6;
const int OUT_SAMPLE_RATE = 48000;
const int DESIRED_FREQ = 100900000;
const int FREQ_OFFSET = 50000;
const int CENTER_FREQ = DESIRED_FREQ + FREQ_OFFSET;
const int SECONDS = 3;
const int DESIRED_OUT_SAMPLES = SECONDS * OUT_SAMPLE_RATE;
const ALenum AL_BUFFER_FORMAT = AL_FORMAT_MONO16;

ALCcontext *ctx;
ALCdevice *device;
ALuint audio_source;
hackrf_device *hrf = NULL;
int is_playing = 0;
int shutting_down = 0;
double deemphasis_val;

#define HACKRF_CHECK_STATUS(device, status, message) \
if (status != 0) { \
    fprintf(stderr, "HackRF error: %s\n", message); \
    if (device != NULL) hackrf_close(device); \
    hackrf_exit(); \
    exit(EXIT_FAILURE); \
} \

void nal_check_error(const char *file, int line) {
    ALenum err = alGetError();
    int has_error = 0;
    while (err != AL_NO_ERROR) {
        has_error = 1;
        char *msg = NULL;
        switch (err) {
            case AL_INVALID_NAME:
                msg = "AL_INVALID_NAME";
                break;
            case AL_INVALID_ENUM:
                msg = "AL_INVALID_ENUM";
                break;
            case AL_INVALID_VALUE:
                msg = "AL_INVALID_VALUE";
                break;
            case AL_INVALID_OPERATION:
                msg = "AL_INVALID_OPERATION";
                break;
            case AL_OUT_OF_MEMORY:
                msg = "AL_OUT_OF_MEMORY";
                break;
        }
        fprintf(stderr, "OpenAL error: %s - %s:%d\n", msg, file, line);
        err = alGetError();
    }
    if (has_error) {
        exit(EXIT_FAILURE);
    }
}

#define NAL_CHECK_ERROR() nal_check_error(__FILE__, __LINE__)



typedef struct {
    int size;
    int capacity;
    ALuint *values;
} queue;

queue *queue_new(int capacity) {
    queue *q = calloc(1, sizeof(queue));
    q->size = 0;
    q->capacity = capacity;
    q->values = calloc(capacity, sizeof(int));
    return q;
}

void queue_push(queue *q, ALuint v) {
    if (q->size + 1 > q->capacity) {
        fprintf(stderr, "Queue is too small (capacity: %d)\n", q->capacity);
    }
    q->values[q->size] = v;
    q->size++;
}

ALuint queue_pop(queue *q) {
    if (q->size == 0) {
        fprintf(stderr, "No more items to pop.\n");
    }
    int v = q->values[0];
    // Shift all items.
    for (int i = 1; i < q->size; i++) {
        q->values[i-1] = q->values[i];
    }
    q->size--;
    return v;
}

queue *audio_buffer_queue;

// Generates coefficients for a FIR low-pass filter with the given
// half-amplitude frequency and kernel length at the given sample rate.
//
// sample_rate    - The signal's sample rate.
// half_ampl_freq - The half-amplitude frequency in Hz.
// length         - The filter kernel's length. Should be an odd number.
//
// Returns the FIR coefficients for the filter.
double *get_low_pass_fir_coefficients(int sample_rate, int half_ampl_freq, int length) {
    length += (length + 1) % 2;
    double freq = half_ampl_freq / (double) sample_rate;
    double *coefs = calloc(length, sizeof(double));
    int center = floor(length / 2);
    double sum = 0;
    for (int i = 0; i < length; i++) {
        double val;
        if (i == center) {
            val = TAU * freq;
        } else {
            double angle = TAU * (i + 1) / (double) (length + 1);
            val = sin(TAU * freq * (i - center)) / (double) (i - center);
            val *= 0.42 - 0.5 * cos(angle) + 0.08 * cos(2 * angle);
        }
        sum += val;
        coefs[i] = val;
    }
    for (int i = 0; i < length; i++) {
        coefs[i] /= sum;
    }
    return coefs;
}

typedef struct {
    int length;
    double *coefficients;
    int offset;
    int center;
    int samples_length;
    double *samples;
} fir_filter;

fir_filter *fir_filter_new(int sample_rate, int half_ampl_freq, int length) {
    fir_filter *filter = calloc(1, sizeof(fir_filter));
    filter->length = length;
    filter->coefficients = get_low_pass_fir_coefficients(sample_rate, half_ampl_freq, length);
    filter->offset = length - 1;
    filter->center = floor(length / 2);
    filter->samples_length = filter->offset;
    filter->samples = calloc(filter->samples_length, sizeof(double));
    return filter;
}

void fir_filter_load(fir_filter *filter, double *samples, int length) {
    int should_free = 0;
    int new_length = length + filter->offset;
    double *new_samples;
    if (filter->samples_length != new_length) {
        should_free = 1;
        new_samples = calloc(new_length, sizeof(double));
    } else {
        new_samples = filter->samples;
    }

    // Copy the last `offset` samples to the new buffer.
    memcpy(new_samples, filter->samples + filter->samples_length - filter->offset, filter->offset * sizeof(double));
    memcpy(new_samples + filter->offset, samples, length * sizeof(double));

    if (should_free) {
        free(filter->samples);
    }
    filter->samples = new_samples;
    filter->samples_length = new_length;
}

double fir_filter_get(fir_filter *filter, int index) {
    double v = 0;
    for (int i = 0; i < filter->length; i++) {
        v += filter->coefficients[i] * filter->samples[index + i];
    }
    return v;
}

void fir_filter_free(fir_filter *filter) {
    free(filter->coefficients);
    free(filter->samples);
    free(filter);
}

typedef struct {
    int in_rate;
    int out_rate;
    fir_filter *filter;
    double rate_mul;
    int out_length;
    double *out_samples;
} downsampler;

downsampler *downsampler_new(int in_rate, int out_rate, int filter_freq, int kernel_length) {
    downsampler *d = calloc(1, sizeof(downsampler));
    d->in_rate = in_rate;
    d->out_rate = out_rate;
    d->filter = fir_filter_new(in_rate, filter_freq, kernel_length);
    d->rate_mul = in_rate / (double) out_rate;
    d->out_length = 0;
    d->out_samples = NULL;
    return d;
}

void downsampler_process(downsampler *d, double *samples, int length) {
    fir_filter_load(d->filter, samples, length);

    free(d->out_samples);
    d->out_length = floor(length / d->rate_mul);
    d->out_samples = calloc(d->out_length, sizeof(double));

    double t = 0;
    for (int i = 0; i < d->out_length; i++) {
        d->out_samples[i] = fir_filter_get(d->filter, floor(t));
        t += d->rate_mul;
    }
}

void downsampler_free(downsampler *d) {
    fir_filter_free(d->filter);
    free(d->out_samples);
    free(d);
}


double cosine = 1;
double sine = 0;

downsampler *downsampler_i;
downsampler *downsampler_q;
downsampler *downsampler_audio;

double l_i = 0;
double l_q = 0;

double average(double *values, int length) {
    double sum = 0;
    for (int i = 0; i < length; i++) {
        sum += values[i];
    }
    return sum / length;
}

void shift_frequency(double *samples_i, double *samples_q, int length, int freq_offset, int sample_rate, double *cosine_ptr, double *sine_ptr) {
    double delta_cos = cos(TAU * freq_offset / (double) sample_rate);
    double delta_sin = sin(TAU * freq_offset / (double) sample_rate);
    double cosine = *cosine_ptr;
    double sine = *sine_ptr;
    for (int i = 0; i < length; i++) {
        double vi = samples_i[i];
        double vq = samples_q[i];
        samples_i[i] = vi * cosine - vq * sine;
        samples_q[i] = vi * sine + vq * cosine;
        double new_sine = cosine * delta_sin + sine * delta_cos;
        double new_cosine = cosine * delta_cos - sine * delta_sin;
        sine = new_sine;
        cosine = new_cosine;
    }
    *cosine_ptr = cosine;
    *sine_ptr = sine;
}

void process_sample_block(uint8_t *buffer, size_t length) {
    if (shutting_down) return;

    double *samples_i = calloc(length, sizeof(double));
    double *samples_q = calloc(length, sizeof(double));

    // Convert to doubles
    for (int i = 0; i < length; i++) {
        unsigned int vi = buffer[i * 2];
        unsigned int vq = buffer[i * 2 + 1];
        samples_i[i] = vi / 128.0 - 0.995;
        samples_q[i] = vq / 128.0 - 0.995;
        //samples_i[i] = (vi - 128.0) / 256.0;
        //samples_q[i] = (vq - 128.0) / 256.0;
    }

    // Shift frequency
    shift_frequency(samples_i, samples_q, length, FREQ_OFFSET, IN_SAMPLE_RATE, &cosine, &sine);

    // Downsample
    downsampler_process(downsampler_i, samples_i, length);
    downsampler_process(downsampler_q, samples_q, length);

    // Demodulate
    int out_length = downsampler_i->out_length;
    double *demodulated = calloc(out_length, sizeof(double));

    double prev = 0;
    double difSqrSum = 0;

    double AMPL_CONV = 336000 / (2 * M_PI * 75000);

    for (int i = 0; i < out_length; i++) {
        double real = l_i * downsampler_i->out_samples[i] + l_q * downsampler_q->out_samples[i];
        double imag = l_i * downsampler_q->out_samples[i] - downsampler_i->out_samples[i] * l_q;
        double sgn = 1;
        if (imag < 0) {
            sgn *= -1;
            imag *= -1;
        }
        double ang = 0;
        double div;
        if (real == imag) {
            div = 1;
        } else if (real > imag) {
            div = imag / real;
        } else {
            ang = -M_PI / 2;
            div = real / imag;
            sgn *= -1;
        }
        demodulated[i] = sgn *
            (ang + div
                / (0.98419158358617365
                    + div * (0.093485702629671305
                        + div * 0.19556307900617517))) * AMPL_CONV;
        l_i = downsampler_i->out_samples[i];
        l_q = downsampler_q->out_samples[i];
        double dif = prev - demodulated[i];
        difSqrSum += dif * dif;
        prev = demodulated[i];
    }

    // Downsample again, for audio
    downsampler_process(downsampler_audio, demodulated, out_length);
    double *audio_samples = downsampler_audio->out_samples;
    int audio_length = downsampler_audio->out_length;

    // De-emphasize samples
    double alpha = 1.0 / (1.0 + OUT_SAMPLE_RATE * 50.0 / 1e6);
    for (int i = 0; i < audio_length; i++) {
        deemphasis_val = deemphasis_val + alpha * (audio_samples[i] - deemphasis_val);
        audio_samples[i] = deemphasis_val;
    }

    // Convert to signed 16-bit integers.
    int16_t *pcm_samples = calloc(audio_length, sizeof(int16_t));
    for (int i = 0; i < audio_length; i++) {
        pcm_samples[i] = audio_samples[i] * 32000;
    }

    // Since the signal processing takes a while, we check again if we are shutting down.
    if (shutting_down) return;

    // Check if there are processed buffers we need to unqueue
    int processed_buffers;
    alGetSourceiv(audio_source, AL_BUFFERS_PROCESSED, &processed_buffers);
    NAL_CHECK_ERROR();
    assert (processed_buffers <= audio_buffer_queue->size);
    while (processed_buffers > 0) {
        ALuint buffer_id = queue_pop(audio_buffer_queue);
        alSourceUnqueueBuffers(audio_source, 1, &buffer_id);
        NAL_CHECK_ERROR();
        alDeleteBuffers(1, &buffer_id);
        processed_buffers--;
    }

    // Initialize an audio buffer
    ALuint buffer_id;
    alGenBuffers(1, &buffer_id);
    NAL_CHECK_ERROR();
    queue_push(audio_buffer_queue, buffer_id);

    // Set the data for the buffer
    alBufferData(buffer_id, AL_BUFFER_FORMAT, pcm_samples, audio_length * sizeof(int16_t), OUT_SAMPLE_RATE);
    NAL_CHECK_ERROR();

    alSourceQueueBuffers(audio_source, 1, &buffer_id);
    NAL_CHECK_ERROR();

    if (!is_playing && audio_buffer_queue->size > 2) {
        alSourcePlay(audio_source);
        NAL_CHECK_ERROR();
        is_playing = 1;
    }


    // The data is now stored in OpenAL, delete our PCM sample buffer.
    free(pcm_samples);

    free(samples_i);
    free(samples_q);
}

int receive_sample_block(hackrf_transfer *transfer) {
    process_sample_block(transfer->buffer, transfer->valid_length / 2);
    return 0;
}


void cleanup() {
    shutting_down = 1;

    hackrf_stop_rx(hrf);
    hackrf_close(hrf);
    hackrf_exit();

    alcMakeContextCurrent(NULL);
    alcDestroyContext(ctx);
    alcCloseDevice(device);
}

int main(int argc, char **argv) {
    int status;

    // Initialize the audio context
    device = alcOpenDevice(NULL);
    if (!device) {
        fprintf(stderr, "Could not open audio device.\n");
        return 1;
    }
    ctx = alcCreateContext(device, NULL);
    alcMakeContextCurrent(ctx);
    NAL_CHECK_ERROR();

    const int INTER_RATE = 336000;
    const int  MAX_F = 75000;
    const double FILTER = MAX_F * 0.8;

    int filter_freq = FILTER * 0.8;
    downsampler_i = downsampler_new(IN_SAMPLE_RATE, INTER_RATE, filter_freq, 51);
    downsampler_q = downsampler_new(IN_SAMPLE_RATE, INTER_RATE, filter_freq, 51);

    downsampler_audio = downsampler_new(INTER_RATE, OUT_SAMPLE_RATE, 10000, 41);

    // Initialize an audio source.
    alGenSources(1, &audio_source);
    NAL_CHECK_ERROR();

    // Turn off looping.
    alSourcei(audio_source, AL_LOOPING, AL_FALSE);
    NAL_CHECK_ERROR();

    // Create a queue holding the list of audio buffers.
    audio_buffer_queue = queue_new(20);

    // Initialize HackRF and start receiving.
    status = hackrf_init();
    HACKRF_CHECK_STATUS(NULL, status, "hackrf_init");

    status = hackrf_open(&hrf);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_open");

    status = hackrf_set_freq(hrf, CENTER_FREQ);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(hrf, IN_SAMPLE_RATE);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(hrf, 0);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(hrf, 32);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(hrf, 30);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(hrf, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(hrf, status, "hackrf_start_rx");

    signal(SIGINT, cleanup);

    printf("Press Ctrl-C to exit.\n");

    // Playing is asynchronous so pause the main thread
    sleep(1000000);

    return 0;
}


================================================
FILE: c/demod-fm.c
================================================
// Play random noise as audio

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <OpenAL/al.h>
#include <OpenAL/alc.h>

#include <libhackrf/hackrf.h>

const double TAU = M_PI * 2;
const int IN_SAMPLE_RATE = 10e6;
const int OUT_SAMPLE_RATE = 48000;
const int DESIRED_FREQ = 100900000;
const int FREQ_OFFSET = 50000;
const int CENTER_FREQ = DESIRED_FREQ + FREQ_OFFSET;
const int SECONDS = 3;
const int DESIRED_OUT_SAMPLES = SECONDS * OUT_SAMPLE_RATE;
const ALenum AL_BUFFER_FORMAT = AL_FORMAT_MONO16;

#define HACKRF_CHECK_STATUS(device, status, message) \
if (status != 0) { \
    fprintf(stderr, "HackRF error: %s\n", message); \
    if (device != NULL) hackrf_close(device); \
    hackrf_exit(); \
    exit(EXIT_FAILURE); \
} \

void nal_check_error(const char *file, int line) {
    ALenum err = alGetError();
    int has_error = 0;
    while (err != AL_NO_ERROR) {
        has_error = 1;
        char *msg = NULL;
        switch (err) {
            case AL_INVALID_NAME:
                msg = "AL_INVALID_NAME";
                break;
            case AL_INVALID_ENUM:
                msg = "AL_INVALID_ENUM";
                break;
            case AL_INVALID_VALUE:
                msg = "AL_INVALID_VALUE";
                break;
            case AL_INVALID_OPERATION:
                msg = "AL_INVALID_OPERATION";
                break;
            case AL_OUT_OF_MEMORY:
                msg = "AL_OUT_OF_MEMORY";
                break;
        }
        fprintf(stderr, "OpenAL error: %s - %s:%d\n", msg, file, line);
        err = alGetError();
    }
    if (has_error) {
        exit(EXIT_FAILURE);
    }
}

#define NAL_CHECK_ERROR() nal_check_error(__FILE__, __LINE__)

ALuint audio_buffer = -1;

ALuint source;

ALshort *audio_buffer_samples;
int has_received = 0;

int received_samples = 0;


// Generates coefficients for a FIR low-pass filter with the given
// half-amplitude frequency and kernel length at the given sample rate.
//
// sample_rate    - The signal's sample rate.
// half_ampl_freq - The half-amplitude frequency in Hz.
// length         - The filter kernel's length. Should be an odd number.
//
// Returns the FIR coefficients for the filter.
double *get_low_pass_fir_coefficients(int sample_rate, int half_ampl_freq, int length) {
    length += (length + 1) % 2;
    double freq = half_ampl_freq / (double) sample_rate;
    double *coefs = calloc(length, sizeof(double));
    int center = floor(length / 2);
    double sum = 0;
    for (int i = 0; i < length; i++) {
        double val;
        if (i == center) {
            val = TAU * freq;
        } else {
            double angle = TAU * (i + 1) / (double) (length + 1);
            val = sin(TAU * freq * (i - center)) / (double) (i - center);
            val *= 0.42 - 0.5 * cos(angle) + 0.08 * cos(2 * angle);
        }
        sum += val;
        coefs[i] = val;
    }
    for (int i = 0; i < length; i++) {
        coefs[i] /= sum;
    }
    return coefs;
}

typedef struct {
    int length;
    double *coefficients;
    int offset;
    int center;
    int samples_length;
    double *samples;
} fir_filter;

fir_filter *fir_filter_new(int sample_rate, int half_ampl_freq, int length) {
    fir_filter *filter = calloc(1, sizeof(fir_filter));
    filter->length = length;
    filter->coefficients = get_low_pass_fir_coefficients(sample_rate, half_ampl_freq, length);
    filter->offset = length - 1;
    filter->center = floor(length / 2);
    filter->samples_length = filter->offset;
    filter->samples = calloc(filter->samples_length, sizeof(double));
    return filter;
}

void fir_filter_load(fir_filter *filter, double *samples, int length) {
    int should_free = 0;
    int new_length = length + filter->offset;
    double *new_samples;
    if (filter->samples_length != new_length) {
        should_free = 1;
        new_samples = calloc(new_length, sizeof(double));
    } else {
        new_samples = filter->samples;
    }

    // Copy the last `offset` samples to the new buffer.
    memcpy(new_samples, filter->samples + filter->samples_length - filter->offset, filter->offset * sizeof(double));
    memcpy(new_samples + filter->offset, samples, length * sizeof(double));

    if (should_free) {
        free(filter->samples);
    }
    filter->samples = new_samples;
    filter->samples_length = new_length;
}

double fir_filter_get(fir_filter *filter, int index) {
    double v = 0;
    for (int i = 0; i < filter->length; i++) {
        v += filter->coefficients[i] * filter->samples[index + i];
    }
    return v;
}

void fir_filter_free(fir_filter *filter) {
    free(filter->coefficients);
    free(filter->samples);
    free(filter);
}

typedef struct {
    int in_rate;
    int out_rate;
    fir_filter *filter;
    double rate_mul;
    int out_length;
    double *out_samples;
} downsampler;

downsampler *downsampler_new(int in_rate, int out_rate, int filter_freq, int kernel_length) {
    downsampler *d = calloc(1, sizeof(downsampler));
    d->in_rate = in_rate;
    d->out_rate = out_rate;
    d->filter = fir_filter_new(in_rate, filter_freq, kernel_length);
    d->rate_mul = in_rate / (double) out_rate;
    d->out_length = 0;
    d->out_samples = NULL;
    return d;
}

void downsampler_process(downsampler *d, double *samples, int length) {
    fir_filter_load(d->filter, samples, length);

    free(d->out_samples);
    d->out_length = floor(length / d->rate_mul);
    d->out_samples = calloc(d->out_length, sizeof(double));

    double t = 0;
    for (int i = 0; i < d->out_length; i++) {
        d->out_samples[i] = fir_filter_get(d->filter, floor(t));
        t += d->rate_mul;
    }
}

void downsampler_free(downsampler *d) {
    fir_filter_free(d->filter);
    free(d->out_samples);
    free(d);
}


double cosine = 1;
double sine = 0;

downsampler *downsampler_i;
downsampler *downsampler_q;
downsampler *downsampler_audio;

double l_i = 0;
double l_q = 0;

double average(double *values, int length) {
    double sum = 0;
    for (int i = 0; i < length; i++) {
        sum += values[i];
    }
    return sum / length;
}

void shift_frequency(double *samples_i, double *samples_q, int length, int freq_offset, int sample_rate, double *cosine_ptr, double *sine_ptr) {
    double delta_cos = cos(TAU * freq_offset / (double) sample_rate);
    double delta_sin = sin(TAU * freq_offset / (double) sample_rate);
    double cosine = *cosine_ptr;
    double sine = *sine_ptr;
    for (int i = 0; i < length; i++) {
        double vi = samples_i[i];
        double vq = samples_q[i];
        samples_i[i] = vi * cosine - vq * sine;
        samples_q[i] = vi * sine + vq * cosine;
        double new_sine = cosine * delta_sin + sine * delta_cos;
        double new_cosine = cosine * delta_cos - sine * delta_sin;
        sine = new_sine;
        cosine = new_cosine;
    }
    *cosine_ptr = cosine;
    *sine_ptr = sine;
}

void process_sample_block(uint8_t *buffer, size_t length) {
    if (received_samples > DESIRED_OUT_SAMPLES) {
        return;
    }

    double *samples_i = calloc(length, sizeof(double));
    double *samples_q = calloc(length, sizeof(double));

    // Convert to doubles
    for (int i = 0; i < length; i++) {
        unsigned int vi = buffer[i * 2];
        unsigned int vq = buffer[i * 2 + 1];
        samples_i[i] = vi / 128.0 - 0.995;
        samples_q[i] = vq / 128.0 - 0.995;
        //samples_i[i] = (vi - 128.0) / 256.0;
        //samples_q[i] = (vq - 128.0) / 256.0;
    }

    // Shift frequency
    shift_frequency(samples_i, samples_q, length, FREQ_OFFSET, IN_SAMPLE_RATE, &cosine, &sine);

    // Downsample
    downsampler_process(downsampler_i, samples_i, length);
    downsampler_process(downsampler_q, samples_q, length);

    // Demodulate
    int out_length = downsampler_i->out_length;
    double *demodulated = calloc(out_length, sizeof(double));

    double prev = 0;
    double difSqrSum = 0;

    double AMPL_CONV = 336000 / (2 * M_PI * 75000);

    for (int i = 0; i < out_length; i++) {
        double real = l_i * downsampler_i->out_samples[i] + l_q * downsampler_q->out_samples[i];
        double imag = l_i * downsampler_q->out_samples[i] - downsampler_i->out_samples[i] * l_q;
        double sgn = 1;
        if (imag < 0) {
            sgn *= -1;
            imag *= -1;
        }
        double ang = 0;
        double div;
        if (real == imag) {
            div = 1;
        } else if (real > imag) {
            div = imag / real;
        } else {
            ang = -M_PI / 2;
            div = real / imag;
            sgn *= -1;
        }
        demodulated[i] = sgn *
            (ang + div
                / (0.98419158358617365
                    + div * (0.093485702629671305
                        + div * 0.19556307900617517))) * AMPL_CONV;
        l_i = downsampler_i->out_samples[i];
        l_q = downsampler_q->out_samples[i];
        double dif = prev - demodulated[i];
        difSqrSum += dif * dif;
        prev = demodulated[i];
    }

    // Downsample again, for audio
    downsampler_process(downsampler_audio, demodulated, out_length);

    // Convert to signed 16-bit integers.
    for (int i = 0; i < downsampler_audio->out_length; i++) {
        if (received_samples > DESIRED_OUT_SAMPLES) {
            break;
        }
        double f_sample = downsampler_audio->out_samples[i];
        int16_t i_sample = f_sample * 32000;
        audio_buffer_samples[received_samples++] = i_sample;
    }

    printf("Received %.1f%%\n", received_samples / (double) DESIRED_OUT_SAMPLES * 100);

    if (received_samples > DESIRED_OUT_SAMPLES) {
        // Write out the final sound as 16-bit signed PCM samples at 48000 Hz
        // FILE *fp = fopen("out-out.raw", "w");
        // fwrite(audio_buffer_samples, sizeof(int16_t), received_samples * sizeof(ALshort), fp);
        // fclose(fp);

        alBufferData(audio_buffer, AL_BUFFER_FORMAT, audio_buffer_samples, received_samples * sizeof(ALshort), OUT_SAMPLE_RATE);
        NAL_CHECK_ERROR();
        alSourcei(source, AL_BUFFER, audio_buffer);
        NAL_CHECK_ERROR();
        alSourcePlay(source);
        NAL_CHECK_ERROR();
    }

    free(samples_i);
    free(samples_q);

}

int receive_sample_block(hackrf_transfer *transfer) {
    process_sample_block(transfer->buffer, transfer->valid_length / 2);
    return 0;
}

int main(int argc, char **argv) {
    int status;
    hackrf_device *hrf = NULL;

    audio_buffer_samples = calloc(DESIRED_OUT_SAMPLES, sizeof(ALshort)); // We need a bit of extra data because we go over the buffer size.

    // Initialize the audio context
    ALCdevice *device = alcOpenDevice(NULL);
    if (!device) {
        fprintf(stderr, "Could not open audio device.\n");
        return 1;
    }
    ALCcontext *ctx = alcCreateContext(device, NULL);
    alcMakeContextCurrent(ctx);

    // Initialize an audio buffer
    alGetError(); // clear error code
    alGenBuffers(1, &audio_buffer);
    NAL_CHECK_ERROR();

    const int INTER_RATE = 336000;
    const int  MAX_F = 75000;
    const double FILTER = MAX_F * 0.8;

    int filter_freq = FILTER * 0.8;
    downsampler_i = downsampler_new(IN_SAMPLE_RATE, INTER_RATE, filter_freq, 51);
    downsampler_q = downsampler_new(IN_SAMPLE_RATE, INTER_RATE, filter_freq, 51);

    downsampler_audio = downsampler_new(INTER_RATE, OUT_SAMPLE_RATE, 10000, 41);

    // Fill buffer with random data
    //arc4random_buf(data, size);

    // Initialize a source
    alGenSources(1, &source);
    NAL_CHECK_ERROR();

    // Attach buffer to source
    //alSourcei(source, AL_BUFFER, buffer);
    //NAL_CHECK_ERROR();

    // Play
    //alSourcePlay(source);
    //NAL_CHECK_ERROR();

    char *fname = NULL;
    if (argc == 2) {
        fname = argv[1];
    }

    if (fname == NULL) {
        // Live data
        status = hackrf_init();
        HACKRF_CHECK_STATUS(NULL, status, "hackrf_init");

        status = hackrf_open(&hrf);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_open");

        status = hackrf_set_freq(hrf, CENTER_FREQ);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_freq");

        status = hackrf_set_sample_rate(hrf, IN_SAMPLE_RATE);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_sample_rate");

        status = hackrf_set_amp_enable(hrf, 0);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_amp_enable");

        status = hackrf_set_lna_gain(hrf, 32);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_lna_gain");

        status = hackrf_set_vga_gain(hrf, 30);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_set_lna_gain");

        status = hackrf_start_rx(hrf, receive_sample_block, NULL);
        HACKRF_CHECK_STATUS(hrf, status, "hackrf_start_rx");

        // Wait to receive data.
        sleep(SECONDS);

    } else {
        FILE *fp = fopen(fname, "r");
        fseek(fp, 0L, SEEK_END);
        long size = ftell(fp);
        rewind(fp);
        uint8_t *file_buffer = calloc(size, 1);
        fread(file_buffer, size, 1, fp);
        fclose(fp);
        process_sample_block(file_buffer, size / 2);
    }

    // Playing is asynchronous so wait a while
    sleep(SECONDS);

    // Cleanup
    if (audio_buffer != -1) {
        alDeleteBuffers(1, &audio_buffer);
    }
    alcMakeContextCurrent(NULL);
    alcDestroyContext(ctx);
    alcCloseDevice(device);

    if (fname == NULL) {
        hackrf_stop_rx(hrf);
        hackrf_close(hrf);
        hackrf_exit();
    }
    return 0;
}


================================================
FILE: c/easypng.h
================================================
#include <stdlib.h>
#include <stdio.h>
#include <png.h>

// Write a grayscale PNG image.
static void write_gray_png(const char *fname, const int width, const int height, uint8_t *buffer) {
    png_structp png_ptr = NULL;
    png_infop info_ptr = NULL;
    png_bytepp row_pointers;

    FILE *fp = fopen(fname, "wb");
    if (!fp) {
        printf("ERROR: Could not write open file %s for writing.\n", fname);
        return;
    }

    // Init PNG writer.
    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    if (png_ptr == NULL) {
        printf("ERROR: png_create_write_struct.\n");
        return;
    }

    info_ptr = png_create_info_struct(png_ptr);
    if (info_ptr == NULL) {
        printf("ERROR: png_create_info_struct.\n");
        png_destroy_write_struct(&png_ptr, NULL);
        return;
    }

    png_set_IHDR(png_ptr, info_ptr,
                 width, height,
                 8,
                 PNG_COLOR_TYPE_GRAY,
                 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);

    // PNG expects a list of pointers. We just calculate offsets into our buffer.
    row_pointers = (png_bytepp) png_malloc(png_ptr, height * sizeof(png_bytep));
    for (int y = 0; y < height; y++) {
       row_pointers[y] = buffer + y * width;
   }

    // Write out the image data.
    png_init_io(png_ptr, fp);
    png_set_rows(png_ptr, info_ptr, row_pointers);
    png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);

    // Cleanup.
    png_free(png_ptr, row_pointers);
    png_destroy_write_struct(&png_ptr, &info_ptr);
    fclose(fp);
    printf("Written %s.\n", fname);
}


================================================
FILE: c/fft-batch-broad.c
================================================
// Batch export of FFT data as images.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#include <libhackrf/hackrf.h>
#include <fftw3.h>

#include "easypng.h"

const uint32_t FFT_SIZE = 256;
const uint32_t FFT_HISTORY_SIZE = 4096;
const uint32_t SAMPLES_SIZE = 131072;
const uint64_t FREQUENCY_START = 660.00001e6;
const uint64_t FREQUENCY_END = 3010.00001e6;
const uint32_t FREQUENCY_STEP = 5e6;
const uint32_t SAMPLE_RATE = 5e6;
const uint32_t SAMPLE_BLOCKS_TO_SKIP = 10;
const uint32_t EVALUATE_ROWS = 100;

uint64_t frequency = FREQUENCY_START;

fftw_complex *fft_in;
fftw_complex *fft_out;
fftw_complex *fft_history;
int history_rows = 0;
fftw_plan fft_plan;
hackrf_device *device;
int skip = SAMPLE_BLOCKS_TO_SKIP;
time_t start_time, end_time;

// Utility ////////////////////////////////////////////////////////////////////

uint8_t clamp_u8(int v, uint8_t min, uint8_t max) {
    return (uint8_t) (v < min ? min : v > max ? max : v);
}

// HackRF /////////////////////////////////////////////////////////////////////

static void hackrf_check_status(int status, const char *message, const char *file, int line) {
    if (status != 0) {
        fprintf(stderr, "NRF HackRF fatal error: %s\n", message);
        if (device != NULL) {
            hackrf_close(device);
        }
        hackrf_exit();
        exit(EXIT_FAILURE);
    }
}

#define HACKRF_CHECK_STATUS(status, message) hackrf_check_status(status, message, __FILE__, __LINE__)

int receive_sample_block(hackrf_transfer *transfer) {
    uint64_t local_frequency = frequency;
    if (skip > 0) {
        skip--;
        return 0;
    }
    if (history_rows >= FFT_HISTORY_SIZE) return 0;
    int ii = 0;
    for (int i = 0; i < SAMPLES_SIZE; i += 2) {
        int vi = (transfer->buffer[i] + 128) % 256;
        int vq = (transfer->buffer[i + 1] + 128) % 256;
        fft_in[ii][0] = powf(-1, ii) * vi / 256.0;
        fft_in[ii][1] = powf(-1, ii) * vq / 256.0;
        ii++;
    }
    fftw_execute(fft_plan);

    // Move one line down.
    memcpy(fft_history + FFT_SIZE, fft_history, FFT_SIZE * (FFT_HISTORY_SIZE - 1) * sizeof(fftw_complex));
    // Set the first line.
    memcpy(fft_history, fft_out, FFT_SIZE * sizeof(fftw_complex));

    history_rows++;

    // Verify that there actually is some data before continuing.
    if (history_rows == EVALUATE_ROWS) {
        double total = 0;
        int size = history_rows * FFT_SIZE;
        for (int i = 0; i < size; i ++) {
            double ci = fft_history[i][0];
            double cq = fft_history[i][1];
            double pwr = sqrt(ci * ci + cq * cq);
            total += pwr;
        }
        double avg_pwr = total / (double) size;
        printf("\n(Average power: %.2f)\n", avg_pwr);
        if (avg_pwr < 1.1) {
            printf("Not interesting. Skipping...\n");
            // Trigger exit condition.
            history_rows = FFT_HISTORY_SIZE;
            return 0;
        }
    }

    printf("\r%.f%%", history_rows / (float)FFT_HISTORY_SIZE * 100);
    fflush(stdout);
    if (history_rows >= FFT_HISTORY_SIZE) {
        printf("\n");
        // Write image.
        uint8_t *buffer = calloc(FFT_SIZE * FFT_HISTORY_SIZE, sizeof(uint8_t));
        for (int y = 0; y < FFT_HISTORY_SIZE; y++) {
            for (int x = 0; x < FFT_SIZE; x++) {
                double ci = fft_history[y * FFT_SIZE + x][0];
                double cq = fft_history[y * FFT_SIZE + x][1];
                double pwr = ci * ci + cq * cq;
                //double pwr_dbfs = 10.0 * log2(pwr + 1.0e-20) / log2(2.7182818284);
                double pwr_dbfs = 10.0 * log10(pwr + 1.0e-20);
                pwr_dbfs = pwr_dbfs * 5;
                uint8_t v = clamp_u8(pwr_dbfs, 0, 255);
                if (x == FFT_SIZE / 2) {
                    v = buffer[y * FFT_SIZE + x - 1];
                }
                buffer[y * FFT_SIZE + x] = v;
            }
        }
        char file_name[100];
        snprintf(file_name, 100, "broad-%.0f.png", local_frequency / 1.0e6);
        write_gray_png(file_name, FFT_SIZE, FFT_HISTORY_SIZE, buffer);

        free(buffer);
    }

    return 0;
}

static void setup_hackrf() {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, frequency);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, SAMPLE_RATE);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 40);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");
}

static void teardown_hackrf() {
    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
}

// FFTW /////////////////////////////////////////////////////////////////////

static void setup_fftw() {
    fft_in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * SAMPLES_SIZE);
    fft_out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * SAMPLES_SIZE);
    fft_history = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * FFT_SIZE * FFT_HISTORY_SIZE);
    fft_plan = fftw_plan_dft_1d(FFT_SIZE, fft_in, fft_out, FFTW_FORWARD, FFTW_ESTIMATE);
}

static void teardown_fftw() {
    fftw_destroy_plan(fft_plan);
    fftw_free(fft_in);
    fftw_free(fft_out);
    fftw_free(fft_history);
}

// Main /////////////////////////////////////////////////////////////////////

int main(int argc, char **argv) {
    setup_fftw();
    setup_hackrf();
    printf("Frequency: %.4f MHz\n", frequency / 1.0e6);
    time(&start_time);

    while (frequency <= FREQUENCY_END) {
        while (history_rows < FFT_HISTORY_SIZE) {
            sleep(1);
        }

        time(&end_time);
        printf("Elapsed: %.0f seconds.\n", difftime(end_time, start_time));

        frequency = frequency + FREQUENCY_STEP;
        if (frequency > FREQUENCY_END) {
            exit(0);
        }

        int status = hackrf_set_freq(device, frequency);
        HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

        skip = SAMPLE_BLOCKS_TO_SKIP;
        history_rows = 0;
        printf("Frequency: %.4f MHz\n", frequency / 1.0e6);
        time(&start_time);
    }

    teardown_hackrf();
    teardown_fftw();

    return 0;
}


================================================
FILE: c/fft-batch.c
================================================
// Batch export of FFT data as images.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#include <libhackrf/hackrf.h>
#include <fftw3.h>

#include "easypng.h"

const uint32_t FFT_SIZE = 1024;
const uint32_t FFT_HISTORY_SIZE = 16384;
const uint32_t SAMPLES_SIZE = 131072;
const uint64_t FREQUENCY_START = 2e6;
const uint64_t FREQUENCY_END = 148e6;
const uint32_t FREQUENCY_STEP = 2e6;
const uint32_t SAMPLE_RATE = 5e6;
const uint32_t SAMPLE_BLOCKS_TO_SKIP = 10;

uint64_t frequency = FREQUENCY_START;

fftw_complex *fft_in;
fftw_complex *fft_out;
fftw_complex *fft_history;
int history_rows = 0;
fftw_plan fft_plan;
hackrf_device *device;
int skip = SAMPLE_BLOCKS_TO_SKIP;

// Utility ////////////////////////////////////////////////////////////////////

uint8_t clamp_u8(int v, uint8_t min, uint8_t max) {
    return (uint8_t) (v < min ? min : v > max ? max : v);
}

// HackRF /////////////////////////////////////////////////////////////////////

static void hackrf_check_status(int status, const char *message, const char *file, int line) {
    if (status != 0) {
        fprintf(stderr, "NRF HackRF fatal error: %s\n", message);
        if (device != NULL) {
            hackrf_close(device);
        }
        hackrf_exit();
        exit(EXIT_FAILURE);
    }
}

#define HACKRF_CHECK_STATUS(status, message) hackrf_check_status(status, message, __FILE__, __LINE__)

int receive_sample_block(hackrf_transfer *transfer) {
    uint64_t local_frequency = frequency;
    if (skip > 0) {
        skip--;
        return 0;
    }
    if (history_rows >= FFT_HISTORY_SIZE) return 0;
    int ii = 0;
    for (int i = 0; i < SAMPLES_SIZE; i += 2) {
        int vi = (transfer->buffer[i] + 128) % 256;
        int vq = (transfer->buffer[i + 1] + 128) % 256;
        fft_in[ii][0] = powf(-1, ii) * vi / 256.0;
        fft_in[ii][1] = powf(-1, ii) * vq / 256.0;
        ii++;
    }
    fftw_execute(fft_plan);

    // Move one line down.
    memcpy(fft_history + FFT_SIZE, fft_history, FFT_SIZE * (FFT_HISTORY_SIZE - 1) * sizeof(fftw_complex));
    // Set the first line.
    memcpy(fft_history, fft_out, FFT_SIZE * sizeof(fftw_complex));

    history_rows++;
    printf("\r%.f%%", history_rows / (float)FFT_HISTORY_SIZE * 100);
    fflush(stdout);
    if (history_rows >= FFT_HISTORY_SIZE) {
        printf("\n");
        // Write image.
        uint8_t *buffer = calloc(FFT_SIZE * FFT_HISTORY_SIZE, sizeof(uint8_t));
        for (int y = 0; y < FFT_HISTORY_SIZE; y++) {
            for (int x = 0; x < FFT_SIZE; x++) {
                double ci = fft_history[y * FFT_SIZE + x][0];
                double cq = fft_history[y * FFT_SIZE + x][1];
                double pwr = ci * ci + cq * cq;
                //double pwr_dbfs = 10.0 * log2(pwr + 1.0e-20) / log2(2.7182818284);
                double pwr_dbfs = 10.0 * log10(pwr + 1.0e-20);
                pwr_dbfs = pwr_dbfs * 10;
                uint8_t v = clamp_u8(pwr_dbfs, 0, 255);
                buffer[y * FFT_SIZE + x] = v;
            }
        }
        char file_name[100];
        snprintf(file_name, 100, "fft-%.4f.png", local_frequency / 1.0e6);
        write_gray_png(file_name, FFT_SIZE, FFT_HISTORY_SIZE, buffer);
        free(buffer);
    }

    return 0;
}

static void setup_hackrf() {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, frequency);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, SAMPLE_RATE);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");
}

static void teardown_hackrf() {
    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
}

// FFTW /////////////////////////////////////////////////////////////////////

static void setup_fftw() {
    fft_in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * SAMPLES_SIZE);
    fft_out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * SAMPLES_SIZE);
    fft_history = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * FFT_SIZE * FFT_HISTORY_SIZE);
    fft_plan = fftw_plan_dft_1d(FFT_SIZE, fft_in, fft_out, FFTW_FORWARD, FFTW_ESTIMATE);
}

static void teardown_fftw() {
    fftw_destroy_plan(fft_plan);
    fftw_free(fft_in);
    fftw_free(fft_out);
    fftw_free(fft_history);
}

// Main /////////////////////////////////////////////////////////////////////

int main(int argc, char **argv) {
    setup_fftw();
    setup_hackrf();
    printf("Frequency: %.4f MHz\n", frequency / 1.0e6);

    while (frequency <= FREQUENCY_END) {
        while (history_rows < FFT_HISTORY_SIZE) {
            sleep(1);
        }

        frequency = frequency + FREQUENCY_STEP;
        if (frequency > FREQUENCY_END) {
            exit(0);
        }

        int status = hackrf_set_freq(device, frequency);
        HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

        skip = SAMPLE_BLOCKS_TO_SKIP;
        history_rows = 0;
        printf("Frequency: %.4f MHz\n", frequency / 1.0e6);
    }

    teardown_hackrf();
    teardown_fftw();

    return 0;
}


================================================
FILE: c/fft-stitch-broad.c
================================================
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#define STB_IMAGE_IMPLEMENTATION
#include "../externals/stb/stb_image.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "../externals/stb/stb_truetype.h"

#include "easypng.h"

// Stitch FFT sweeps PNG




// Utility //////////////////////////////////////////////////////////////////

uint8_t max_u8(uint8_t a, uint8_t b) {
    return a > b ? a : b;
}

// Image operations /////////////////////////////////////////////////////////

void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t dst_stride, uint32_t src_stride) {
    for (uint32_t i = 0; i < height; i++) {
        for (uint32_t j = 0; j < width; j++) {
            uint32_t dst_offset = (dst_y + i) * dst_stride + dst_x + j;
            uint32_t src_offset = (src_y + i) * src_stride + src_x + j;
            dst[dst_offset] = max_u8(dst[dst_offset], src[src_offset]);
        }
    }
}

void img_pixel_put(uint8_t *buffer, uint32_t stride, uint32_t x, uint32_t y, uint8_t v) {
    if (x > 0 && y > 0) {
        buffer[(y * stride) + x] = v;
    }
}

// Main /////////////////////////////////////////////////////////////////////

int main(int argc, char **argv) {
    assert(argc == 3);

    const uint32_t FFT_SIZE = 256;
    const uint32_t FFT_HISTORY_SIZE = 4096;
    const uint64_t FREQUENCY_START = atoi(argv[1]) * 1e6;
    const uint64_t FREQUENCY_END = atoi(argv[2]) * 1e6;
    const uint32_t FREQUENCY_STEP = 5e6;
    const uint32_t SAMPLE_RATE = 5e6;

    const uint32_t FREQUENCY_RANGE = (FREQUENCY_END - FREQUENCY_START) / FREQUENCY_STEP;
    const uint32_t WIDTH_STEP = FFT_SIZE / (SAMPLE_RATE / FREQUENCY_STEP);
    const uint32_t IMAGE_WIDTH = FFT_SIZE + (FREQUENCY_RANGE) * WIDTH_STEP;
    const uint32_t IMAGE_HEIGHT = FFT_HISTORY_SIZE;

    uint32_t image_height = IMAGE_HEIGHT;
    printf("Frequency range: %.0f MHz - %.0f MHz\n", FREQUENCY_START / 1e6, FREQUENCY_END / 1e6);
    printf("Image size: %d x %d\n", IMAGE_WIDTH, image_height);
    uint8_t *buffer = calloc(IMAGE_WIDTH * image_height, sizeof(uint8_t));
    uint32_t x = 0;
    for (uint64_t frequency = FREQUENCY_START; frequency <= FREQUENCY_END; frequency += FREQUENCY_STEP) {
        char file_name[100];
        snprintf(file_name, 100, "broad-%.0f.png", frequency / 1.0e6);
        printf("Composing %s...\n", file_name);

        int width, height, n;
        unsigned char *image_data = stbi_load(file_name, &width, &height, &n, 1);
        if (!image_data) {
            fprintf (stderr, "ERROR: could not load %s\n", file_name);
            exit(1);
        }
        if (width != FFT_SIZE || height < FFT_HISTORY_SIZE) {
            fprintf (stderr, "ERROR: bad image size %s\n", file_name);
            exit(1);
        }

        // Compose image into buffer
        img_gray_copy(buffer, image_data, x, 0, 0, 0, FFT_SIZE, FFT_HISTORY_SIZE, IMAGE_WIDTH, FFT_SIZE);

        stbi_image_free(image_data);

        x += WIDTH_STEP;
    }

    char out_file_name[100];
    snprintf(out_file_name, 100, "broad-stitched-%.0f-%.0f.png", FREQUENCY_START / 1e6, FREQUENCY_END / 1e6);
    printf("Saving %s...\n", out_file_name);

    write_gray_png(out_file_name, IMAGE_WIDTH, image_height, buffer);
    exit(0);
}



================================================
FILE: c/fft-stitch.c
================================================
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#define STB_IMAGE_IMPLEMENTATION
#include "../externals/stb/stb_image.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "../externals/stb/stb_truetype.h"

#include "easypng.h"

// Stitch FFT sweeps PNG

const uint32_t IMAGE_HEIGHT = 11811;
const uint32_t FOOTER_HEIGHT = 600;
const uint32_t FFT_SIZE = 1024;
const uint32_t FFT_HISTORY_SIZE = IMAGE_HEIGHT - FOOTER_HEIGHT;
const uint64_t FREQUENCY_START = 1802e6;
const uint64_t FREQUENCY_END = 2400e6;
const uint32_t FREQUENCY_STEP = 2e6;

const uint32_t SAMPLE_RATE = 5e6;
const uint32_t WIDTH_STEP = FFT_SIZE / (SAMPLE_RATE / FREQUENCY_STEP);
const uint32_t FREQUENCY_RANGE = (FREQUENCY_END - FREQUENCY_START) / FREQUENCY_STEP;
const uint32_t IMAGE_WIDTH = FFT_SIZE + (FREQUENCY_RANGE) * WIDTH_STEP;
const uint32_t MINOR_TICK_RATE = 0.1e6;
const double MINOR_TICK_SIZE = (FFT_SIZE / (double) FREQUENCY_STEP / 2) * MINOR_TICK_RATE;
const uint32_t MAJOR_TICK_RATE = 1e6;
const double MAJOR_TICK_SIZE = (FFT_SIZE / (double) FREQUENCY_STEP / 2) * MAJOR_TICK_RATE;
const uint8_t LINE_COLOR = 255;
const char* FONT_FILE = "../fonts/RobotoCondensed-Regular.ttf";
const uint16_t FONT_SIZE_PX = 48;
const uint32_t MARKERS_Y = FFT_HISTORY_SIZE + (FOOTER_HEIGHT / 2 - FONT_SIZE_PX / 2);
const uint32_t MARKERS_X = FFT_SIZE-SAMPLE_RATE / 2;

// Utility //////////////////////////////////////////////////////////////////

uint8_t max_u8(uint8_t a, uint8_t b) {
    return a > b ? a : b;
}

// Image operations /////////////////////////////////////////////////////////

void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t dst_stride, uint32_t src_stride) {
    for (uint32_t i = 0; i < height; i++) {
        for (uint32_t j = 0; j < width; j++) {
            uint32_t dst_offset = (dst_y + i) * dst_stride + dst_x + j;
            uint32_t src_offset = (src_y + i) * src_stride + src_x + j;
            dst[dst_offset] = max_u8(dst[dst_offset], src[src_offset]);
        }
    }
}

void img_pixel_put(uint8_t *buffer, uint32_t stride, uint32_t x, uint32_t y, uint8_t v) {
    if (x > 0 && y > 0) {
        buffer[(y * stride) + x] = v;
    }
}

void img_vline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y1, uint32_t y2, uint8_t v) {
    for (int y = y1; y < y2; y++) {
        img_pixel_put(buffer, stride, x1, y, v);
    }
}

void img_hline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y1, uint32_t x2, uint8_t v) {
    for (int x = x1; x < x2; x++) {
        img_pixel_put(buffer, stride, x, y1, v);
    }
}

// Font operations //////////////////////////////////////////////////////////

typedef struct {
    stbtt_fontinfo font;
    uint8_t *buffer;
} ntt_font;

ntt_font *ntt_font_load(const char *font_file) {
    ntt_font *font = calloc(1, sizeof(ntt_font));

    FILE *fp = fopen(font_file, "rb");
    fseek(fp, 0L, SEEK_END);
    long size = ftell(fp);
    rewind(fp);
    font->buffer = calloc(size, 1);
    fread(font->buffer, size, 1, fp);
    fclose(fp);

    stbtt_InitFont(&font->font, font->buffer, stbtt_GetFontOffsetForIndex(font->buffer, 0));
    return font;
}


void ntt_font_measure(const ntt_font *font, const char *text, const int x, const int y, const int font_size, int *width, int *height) {
    float font_scale = stbtt_ScaleForPixelHeight(&font->font, font_size);
    int ascent, descent;
    stbtt_GetFontVMetrics(&font->font, &ascent, &descent, 0);
    int baseline = (int) (ascent * font_scale);
    int descent_scaled = (int) (descent * font_scale);
    //printf("Baseline %d descent %d\n", baseline, descent_scaled);

    *width = x;
    // The glyph height is constant for the font.
    // Descent_scaled is negative.
    *height = y + (baseline - descent_scaled);

    int ch = 0;
    while (text[ch]) {
        int x0, y0, x1, y1;
        int advance, lsb;
        char c = text[ch];
        stbtt_GetCodepointBitmapBox(&font->font, c, font_scale, font_scale, &x0, &y0, &x1, &y1);
        stbtt_GetCodepointHMetrics(&font->font, c, &advance, &lsb);
        int glyph_width = advance * font_scale;
        *width += glyph_width;
        if (text[ch + 1]) {
            *width += font_scale * stbtt_GetCodepointKernAdvance(&font->font, c, text[ch + 1]);
        }
        ch++;
    }
}

void ntt_font_draw(const ntt_font *font, uint8_t *img, const uint32_t img_stride, const char *text, const int x, const int y, const int font_size) {
    int text_width, text_height;
    ntt_font_measure(font, text, 0, 0, font_size, &text_width, &text_height);
    int start_x = x - text_width / 2;
    if (start_x < 0) return;

    float font_scale = stbtt_ScaleForPixelHeight(&font->font, font_size);
    int ascent;
    stbtt_GetFontVMetrics(&font->font, &ascent, 0, 0);
    int baseline = (int) (ascent * font_scale);

    int ch = 0;
    int _x = 0;
    while (text[ch]) {
        int w, h, dx, dy;
        int advance, lsb;
        char c = text[ch];
        stbtt_GetCodepointHMetrics(&font->font, c, &advance, &lsb);
        uint8_t *glyph_bitmap = stbtt_GetCodepointBitmap(&font->font, font_scale, font_scale, c, &w, &h, &dx, &dy);
        //printf("Offset %d %d\n", dx, baseline + dy);
        img_gray_copy(img, glyph_bitmap, start_x + _x + dx, y + baseline + dy, 0, 0, w, h, img_stride, w);
        //x += w;
        _x += (advance * font_scale);

        if (text[ch + 1]) {
            _x += font_scale * stbtt_GetCodepointKernAdvance(&font->font, c, text[ch + 1]);
        }

        ch++;
    }
}

// Main /////////////////////////////////////////////////////////////////////

int main() {
    ntt_font *font = ntt_font_load(FONT_FILE);
    uint32_t image_height = IMAGE_HEIGHT;
    printf("Image size: %d x %d\n", IMAGE_WIDTH, image_height);
    uint8_t *buffer = calloc(IMAGE_WIDTH * image_height, sizeof(uint8_t));
    //memset(buffer, 128, IMAGE_WIDTH * image_height);
    uint32_t x = 0;
    for (uint32_t frequency = FREQUENCY_START; frequency <= FREQUENCY_END; frequency += FREQUENCY_STEP) {
        char file_name[100];
        snprintf(file_name, 100, "fft-%.4f.png", frequency / 1.0e6);
        printf("Composing %s...\n", file_name);

        int width, height, n;
        unsigned char *image_data = stbi_load(file_name, &width, &height, &n, 1);
        if (!image_data) {
            fprintf (stderr, "ERROR: could not load %s\n", file_name);
            exit(1);
        }
        if (width != FFT_SIZE || height < FFT_HISTORY_SIZE) {
            fprintf (stderr, "ERROR: bad image size %s\n", file_name);
            exit(1);
        }

        // Compose image into buffer
        img_gray_copy(buffer, image_data, x, 0, 0, 0, FFT_SIZE, FFT_HISTORY_SIZE, IMAGE_WIDTH, FFT_SIZE);

        stbi_image_free(image_data);

        x += WIDTH_STEP;
    }

    printf("Adding markers...\n");

    int banner_y = FFT_HISTORY_SIZE;
    int banner_bottom = image_height;
    for (int i = 0; i < 10; i++) {
        img_hline(buffer, IMAGE_WIDTH, 0, banner_y++, IMAGE_WIDTH, LINE_COLOR);
        img_hline(buffer, IMAGE_WIDTH, 0, banner_bottom--, IMAGE_WIDTH, LINE_COLOR);
    }
    banner_bottom++;

    for (double x = 0; x < IMAGE_WIDTH; x += MINOR_TICK_SIZE) {
        img_vline(buffer, IMAGE_WIDTH, x, banner_y, banner_y + 50, LINE_COLOR);
        img_vline(buffer, IMAGE_WIDTH, x, banner_bottom - 50, banner_bottom, LINE_COLOR);
    }

    int freq = FREQUENCY_START - (SAMPLE_RATE / 2) + (MAJOR_TICK_RATE / 2);
    double start_x = FFT_SIZE / (double) SAMPLE_RATE * (MAJOR_TICK_RATE / 2);
    for (double x = start_x; x < IMAGE_WIDTH; x += MAJOR_TICK_SIZE) {
        img_vline(buffer, IMAGE_WIDTH, x, banner_y, banner_y + 100, LINE_COLOR);
        img_vline(buffer, IMAGE_WIDTH, x, banner_bottom - 100, banner_bottom, LINE_COLOR);
        if (freq >= 0 && freq < FREQUENCY_END + (SAMPLE_RATE / 2)) {
            char text[200];
            snprintf(text, 200, "%.2f", (freq / (double) 1e6));
            ntt_font_draw(font, buffer, IMAGE_WIDTH, text, x, MARKERS_Y, FONT_SIZE_PX);
        }
        freq += MAJOR_TICK_RATE;
    }


    char out_file_name[100];
    snprintf(out_file_name, 100, "fft-stitched-%.4f-%.4f.png", FREQUENCY_START / 1e6, FREQUENCY_END / 1e6);
    printf("Saving %s...\n", out_file_name);

    write_gray_png(out_file_name, IMAGE_WIDTH, image_height, buffer);
    exit(0);
}



================================================
FILE: c/fft.c
================================================
// Perform FFT analysis on HackRF data.

#include <GLFW/glfw3.h>
#include <libhackrf/hackrf.h>
#include <fftw3.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#define WIDTH 1024
#define HEIGHT 1024
#define BUFFER_SIZE (WIDTH * HEIGHT)
#define FFT_SIZE 512

fftw_complex *fft_in;
fftw_complex *fft_out;
fftw_plan fft_plan;
GLfloat fft_real_buffer[FFT_SIZE];
GLfloat buffer[WIDTH * HEIGHT];
// byte_to_double_lut[256];
hackrf_device *device;
double freq_mhz = 88;
GLFWwindow* window;
GLuint texture_id;
GLuint program;
int paused = 0;
int n_samples = 0;
float intensity = 10.0;
double freq_shift = 0.2;
double intensity_shift = 0.5;

// HackRF ///////////////////////////////////////////////////////////////////

#define HACKRF_CHECK_STATUS(status, message) \
    if (status != 0) { \
        printf("FAIL: %s\n", message); \
        hackrf_close(device); \
        hackrf_exit(); \
        exit(EXIT_FAILURE); \
    } \

int receive_sample_block(hackrf_transfer *transfer) {
    if (paused) return 0;
    fftw_complex *p = fft_in;
    int ii = 0;
    for (int i = 0; i < 512 * 512; i += 2) {
        fft_in[ii][0] = transfer->buffer[i] / 255.0;
        fft_in[ii][1] = transfer->buffer[i + 1] / 255.0;
        ii++;
    }
    fftw_execute(fft_plan);
    return 0;
}

static void setup_hackrf() {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, 10e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");
}

static void teardown_hackrf() {
    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
}

static void set_frequency() {
    freq_mhz = round(freq_mhz * 10.0) / 10.0;
    printf("Seting freq to %f MHz.\n", freq_mhz);
    int status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
}

// FFTW /////////////////////////////////////////////////////////////////////

static void setup_fftw() {
    fft_in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * BUFFER_SIZE);
    fft_out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * BUFFER_SIZE);
    fft_plan = fftw_plan_dft_1d(FFT_SIZE, fft_in, fft_out, FFTW_FORWARD, FFTW_MEASURE);
}

static void teardown_fftw() {
    fftw_destroy_plan(fft_plan);
    fftw_free(fft_in);
    fftw_free(fft_out);
}

// OpenGL ///////////////////////////////////////////////////////////////////

static void check_shader_error(GLuint shader) {
    int length = 0;
    int charsWritten  = 0;
    char *infoLog;

    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

    if (length > 0) {
        char message[length];
        glGetShaderInfoLog(shader, length, NULL, message);
        printf("%s\n", message);
    }
}

static void setup_gl() {
    glGenTextures(1, &texture_id);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    const char *vertex_shader_source =
        "void main(void) {"
        "  gl_TexCoord[0] = gl_MultiTexCoord0;"
        "  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
        "}";

    const char *fragment_shader_source =
        "uniform sampler2D texture;"
        "void main(void) {"
        "  vec4 c = texture2D(texture, gl_TexCoord[0].st);"
        "  float v = c.r;"
        "  gl_FragColor = vec4(v, v, v, 1);"
        "}";

    GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &vertex_shader_source, NULL);
    glCompileShader(vertex_shader);
    check_shader_error(vertex_shader);

    GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &fragment_shader_source, NULL);
    glCompileShader(fragment_shader);
    check_shader_error(fragment_shader);

    program = glCreateProgram();
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    glLinkProgram(program);

    glActiveTexture(0);
    GLuint u_texture = glGetUniformLocation(program, "texture");
    glUniform1i(u_texture, texture_id);
}

static void prepare() {
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WIDTH, 0, HEIGHT, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

static void update() {
    if (paused) return;

    for (int i = 0; i < FFT_SIZE; i++) {
        fftw_complex *pt;
        if (i < FFT_SIZE / 2) {
            pt = &fft_out[FFT_SIZE / 2 + i];
        } else {
            pt = &fft_out[i - FFT_SIZE / 2];
        }
        *pt[0] /= (double) FFT_SIZE;
        *pt[1] /= (double) FFT_SIZE;


        double power = *pt[0] * *pt[0] + *pt[1] * *pt[1];
        fft_real_buffer[i] = intensity * log10(power + 1.0e-20);
    }

    memset(buffer, 0, sizeof(GLfloat) * WIDTH * HEIGHT);

    for (int i = 0; i < FFT_SIZE; i += 1) {
        int ix = i;
        double y = fft_real_buffer[i];
        int iy = (int)(y  + HEIGHT / 2);
        ix = ix < 0 ? 0 : ix > 512 ? 512 : ix;
        iy = iy < 0 ? 0 : iy > 512 ? 512 : iy;
        // Draw a line
        for (int y = 0; y < iy; y++) {
            int d = (y * 512) + ix;
            buffer[d] = 255;
        }
    }
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, WIDTH, HEIGHT, 0, GL_RED, GL_FLOAT, buffer);
}

static void draw() {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_SRC_COLOR);

    glUseProgram(program);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex2f(0, 0);
    glTexCoord2f(1.0, 0.0);
    glVertex2f(WIDTH, 0);
    glTexCoord2f(1.0, 1.0);
    glVertex2f(WIDTH, HEIGHT);
    glTexCoord2f(0.0, 1.0);
    glVertex2f(0, HEIGHT);
    glEnd();
    glUseProgram(0);
}

static void teardown_gl() {
}

// GLFW /////////////////////////////////////////////////////////////////////

static void export() {
    FILE *fp = fopen("out.raw", "wb");
    if (fp) {
        fwrite(fft_out, BUFFER_SIZE, 1, fp);
        fclose(fp);
        printf("Written file.\n");
    }
}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
        glfwSetWindowShouldClose(window, GL_TRUE);
    } else if (key == GLFW_KEY_RIGHT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        freq_mhz += freq_shift;
        set_frequency();
    } else if (key == GLFW_KEY_LEFT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        freq_mhz -= freq_shift;
        set_frequency();
    } else if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {
        paused = !paused;
    } else if (key == GLFW_KEY_E && action == GLFW_PRESS) {
        export();
    } else if (key == GLFW_KEY_EQUAL && action == GLFW_PRESS) {
        intensity += intensity_shift;
        printf("Intensity: %.2f\n", intensity);
    } else if (key == GLFW_KEY_MINUS && action == GLFW_PRESS) {
        intensity -= intensity_shift;
        printf("Intensity: %.2f\n", intensity);
    }
}

static void setup_glfw() {
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }
    window = glfwCreateWindow(WIDTH, HEIGHT, "HackRF", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
}

static void teardown_glfw() {
    glfwDestroyWindow(window);
    glfwTerminate();
}

// Main /////////////////////////////////////////////////////////////////////

int main(int argc, char **argv) {
    setup_glfw();
    setup_fftw();
    setup_hackrf();
    setup_gl();

    while (!glfwWindowShouldClose(window)) {
        prepare();
        update();
        draw();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    teardown_gl();
    teardown_hackrf();
    teardown_fftw();
    teardown_glfw();

    return 0;
}


================================================
FILE: c/gradual-noise.c
================================================
// Gradual noise movie.
// Expects noise data files in ../rfdata/rf-x.xxx-big.raw

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#include "easypng.h"

const int BLOCK_SIZE_BYTES = 262144;
const int IMAGE_WIDTH = 1920;
const int IMAGE_HEIGHT = 1080;
const int IQ_SIZE = 256;
const int RF_BUFFER_SIZE = IMAGE_WIDTH * IMAGE_HEIGHT * 2;
const int IMAGE_BUFFER_SIZE = IMAGE_WIDTH * IMAGE_HEIGHT;
const int TOTAL_FRAMES = 20000;
const double INTERPOLATE_STEP = 0.01;
const double FREQ_MHZ_START = 1.0;
const double FREQ_MHZ_STEP = 0.01;
const double WIDTH_SCALE = IMAGE_WIDTH / (double) IQ_SIZE;
const double HEIGHT_SCALE = IMAGE_HEIGHT / (double) IQ_SIZE;
const double BLOCK_SCALE  = WIDTH_SCALE > HEIGHT_SCALE ? WIDTH_SCALE : HEIGHT_SCALE;

// Modeled after half sine wave
double sine_ease_in_out(double p) {
    return 0.5 * (1 - cos(p * M_PI));
}

// Modeled after the piecewise quadratic
// y = (1/2)((2x)^2)             ; [0, 0.5)
// y = -(1/2)((2x-1)*(2x-3) - 1) ; [0.5, 1]
double quadratic_ease_in_out(double p) {
    if(p < 0.5) {
        return 2 * p * p;
    } else {
        return (-2 * p * p) + (4 * p) - 1;
    }
}

// Modeled after the piecewise quintic
// y = (1/2)((2x)^5)       ; [0, 0.5)
// y = (1/2)((2x-2)^5 + 2) ; [0.5, 1]
double quintic_ease_in_out(double p) {
    if (p < 0.5) {
        return 16 * p * p * p * p * p;
    } else {
        double f = ((2 * p) - 2);
        return  0.5 * f * f * f * f * f + 1;
    }
}

double lerp(double a, double b, double t) {
    t = sine_ease_in_out(t);
    return a * (1.0 - t) + b * t;
}

double clamp(double v, double min, double max) {
    return v < min ? min : v > max ? max : v;
}

void read_buffer(uint8_t *dst, double freq_mhz) {
    char fname[100];
    snprintf(fname, 100, "../rftmp/rf-%.3f-big.raw", freq_mhz);
    FILE *fp = fopen(fname, "r");
    fread(dst, RF_BUFFER_SIZE, 1, fp);
    fclose(fp);
}

static inline void put_pixel(uint8_t *image_buffer, int x, int y, uint8_t color) {
    if (x >= IMAGE_WIDTH || y >= IMAGE_HEIGHT) return;
    int offset = y * IMAGE_WIDTH + x;
    image_buffer[offset] = color;
}

static inline void put_block(uint8_t *image_buffer, int x, int y, uint8_t color) {
    for (int dy = 0; dy < BLOCK_SCALE; dy++) {
        for (int dx = 0; dx < BLOCK_SCALE; dx++) {
            put_pixel(image_buffer, x * BLOCK_SCALE + dx, y * BLOCK_SCALE + dy, color);
        }
    }
}

int main() {
    double freq_mhz = FREQ_MHZ_START;
    double t = 0.0;

    uint8_t *rf_buffer_a = calloc(RF_BUFFER_SIZE, 1);
    uint8_t *rf_buffer_b = calloc(RF_BUFFER_SIZE, 1);
    uint8_t *image_buffer = calloc(IMAGE_BUFFER_SIZE, 1);

    read_buffer(rf_buffer_a, freq_mhz);
    read_buffer(rf_buffer_b, freq_mhz + FREQ_MHZ_STEP);

    for (int frame = 1; frame <= TOTAL_FRAMES; frame++) {
        int i = 0;
        for (int y = 0; y < IQ_SIZE; y++) {
            for (int x = 0; x < IQ_SIZE; x++) {
                int ai = (rf_buffer_a[i] + 128) % 256;
                int bi = (rf_buffer_b[i] + 128) % 256;
                double pwr = lerp(ai, bi, t);
                int color = clamp(pwr, 0, 255);
                put_block(image_buffer, x, y, color);
                i += 2;
            }
        }

        char fname[100];
        snprintf(fname, 100, "_export/noise-%d.png", frame);
        write_gray_png(fname, IMAGE_WIDTH, IMAGE_HEIGHT, image_buffer);

        t += INTERPOLATE_STEP;

        if (t >= 1.0) {
            t = 0.0;
            freq_mhz += FREQ_MHZ_STEP;
            printf("Frequency: %.3f\n", freq_mhz);
            read_buffer(rf_buffer_a, freq_mhz);
            read_buffer(rf_buffer_b, freq_mhz + FREQ_MHZ_STEP);
        }
    }
}


================================================
FILE: c/gridvis.c
================================================
// 3D visualization of spectrum

#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
#include <libhackrf/hackrf.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <png.h>
#include <OpenGL/glu.h>

#define WIDTH 800
#define HEIGHT 600


GLFWwindow* window;
GLuint texture_id;
GLuint program;
uint8_t buffer[512 * 512];
hackrf_device *device;
double freq_mhz = 124.2;
int paused = 0;
float camera_x = 112;
float camera_y = 40;
float camera_z = -50;

#define HAVE_HACKRF


#define HACKRF_CHECK_STATUS(status, message) \
    if (status != 0) { \
        printf("FAIL: %s\n", message); \
        hackrf_close(device); \
        hackrf_exit(); \
        exit(EXIT_FAILURE); \
    } \

int receive_sample_block(hackrf_transfer *transfer) {
    if (paused) return 0;
    for (int idx = 0; idx < transfer->valid_length; idx += 2) {
        double i = transfer->buffer[idx] / 255.0;
        double q = transfer->buffer[idx + 1] / 255.0;
        double v = sqrt(i * i + q * q);



        // double v = transfer->buffer[i + 1] / 255.0;
        // if (v <= 0.05) {
        //     v *= 10.0;
        // } else if (v >= 0.95) {
        //     v = 0.5 + (v - 0.95) * 10.0;
        // }
        uint8_t vi = (uint8_t) round(v * 255);
        buffer[idx] = vi;
        buffer[idx + 1] = vi;
    }
    return 0;
}

static void setup_fake() {
	char *fname = "img.raw";
    FILE *fp = fopen(fname, "rb");
    if (!fp) {
        printf("ERROR: Could not write open file %s.\n", fname);
        exit(EXIT_FAILURE);
    }
    fread(buffer, 512 * 512, 1, fp);
    fclose(fp);
}

static void setup_hackrf() {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, 8e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");

    memset(buffer, 0, 512 * 512);

    //status = hackrf_set_freq(device, freq_mhz * 1e6);
    //HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
}

static void set_frequency() {
    #if defined(HAVE_HACKRF)
    freq_mhz = round(freq_mhz * 1000.0) / 1000.0;
    printf("Seting freq to %f MHz.\n", freq_mhz);
    int status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
    #endif
}

static void teardown_hackrf() {
    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
}

static void check_shader_error(char *prefix, GLuint shader) {
    int length = 0;
    int charsWritten  = 0;
    char *infoLog;

    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

    if (length > 0) {
        char message[length];
        glGetShaderInfoLog(shader, length, NULL, message);
        printf("%s: %s\n", prefix, message);
        exit(EXIT_FAILURE);
    }
}

static void setup() {
    glEnable(GL_DEPTH_TEST);
    const char *vertex_shader_source =
        "#extension GL_EXT_gpu_shader4 : require\n"
        "\n"
        "vec4 light_pos = vec4(0, 4, 0, 1);\n"
        "vec3 light_color = vec3(1.5, 0.5, 5);\n"
        "vec3 diffuse_reflectivity = vec3(1.0, 1.0, 1.0);\n"
        "flat varying vec3 color;\n"
        "\n"
        "void main(void) {\n"
        "  vec3 normal_dir = normalize(gl_NormalMatrix * gl_Normal);\n"
        "  vec4 eye_coords = gl_ModelViewMatrix * gl_Vertex;\n"
        "  vec3 s = normalize(vec3(light_pos - eye_coords));\n"
        "  color = light_color * diffuse_reflectivity * max(0.0, dot(s, normal_dir));\n"
        "  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
        //"  normal = vec3(0, 0, 0);"
        "}\n";

    const char *fragment_shader_source =
        "#extension GL_EXT_gpu_shader4 : require\n"
        "\n"
        "flat varying vec3 color;\n"
        "\n"
        "void main(void) {\n"
        "  gl_FragColor = vec4(color, 0.8);\n"
        //"  gl_FragColor = vec4(0.5, 0.5, 1, 0.1);"
        "}\n";

    GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &vertex_shader_source, NULL);
    glCompileShader(vertex_shader);
    check_shader_error("V", vertex_shader);

    GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &fragment_shader_source, NULL);
    glCompileShader(fragment_shader);
    check_shader_error("F", fragment_shader);

    program = glCreateProgram();
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    glLinkProgram(program);

    // glActiveTexture(0);
    // GLuint u_texture = glGetUniformLocation(program, "texture");
    // glUniform1i(u_texture, texture_id);
}

static void prepare() {
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    glClearColor(1, 1, 0.93, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 102.0 );
    gluPerspective(80.0, width / height, 1, 5000);
    //glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);

    //glOrtho(0, WIDTH, 0, HEIGHT, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(camera_x, camera_y, camera_z, 0, 0, 0, 0, 1, 0);
    //glTranslatef(camera_x, camera_y, camera_z);

    glShadeModel(GL_FLAT);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


    glEnable(GL_LIGHTING);
    glEnable(GL_COLOR_MATERIAL);

    glEnable(GL_LIGHT0);
    GLfloat light0_position[] = {10.0, 10.0, 0.0, 1.0};

    GLfloat light0_ambient[] = {0.0, 0.0, 0.0, 1.0};
    GLfloat light0_diffuse[] = {1.0, 1.0, 1.0, 1.0};
    GLfloat light0_specular[] = {1.0, 1.0, 1.0, 1.0};
    glLightfv(GL_LIGHT1, GL_POSITION, light0_position);
    glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);

    glEnable(GL_LIGHT1);
    GLfloat light1_ambient[] = {0.8, 0.8, 0.8, 1.0};

    // glEnable(GL_FOG);
    // float fog_color[3] = {1.0, 1.0, 0.93};
    // glFogfv(GL_FOG_COLOR, fog_color);
    // glFogi(GL_FOG_MODE, GL_LINEAR);
    // glFogf(GL_FOG_START, 100.f);
    // glFogf(GL_FOG_END, 110.f);
}



static void update() {
    //glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, 512, 512, 0, GL_RED, GL_UNSIGNED_BYTE, buffer);
}

static void draw() {
    // Draw simple ground plane
    // int ground_size = 10;
    // glColor4f(1, 1, 1, 0.3);
    // glBegin(GL_QUADS);
    // glVertex3f(-ground_size, 0, -ground_size);
    // glVertex3f(-ground_size, 0, ground_size);
    // glVertex3f(ground_size, 0, ground_size);
    // glVertex3f(ground_size, 0, -ground_size);
    // glEnd();

    GLdouble vertices[256 * 256 * 3];
    GLdouble normals[256 * 256 * 3];
    GLushort indices[255 * 255 * 6];
    GLubyte colors[255 * 255 * 6];

    int vi = 0;
    int ni = 0;
    for (int y = 0; y < 256; y += 1) {
        for (int x = 0; x < 256; x += 1) {
            vertices[vi++] = (x - 128);
            //vertices[vi++] =  sin(x / 5.0) + cos(y / 7.0) * 10.2;
            vertices[vi++] =  buffer[(y * 256) + x] / 100.0;
            vertices[vi++] = (y - 128);
            //printf("%3.1f %3.1f %3.1f\n", points[i-3], points[i-2], points[i-1]);
            normals[ni++] = 0.0;
            normals[ni++] = 0;
            normals[ni++] = 0.0;
        }
    }

    int ii = 0;
    int ci = 0;
    for (int y = 0; y < 255; y += 1) {
        for (int x = 0; x < 255; x += 1) {
            indices[ii++] = (y * 256) + x;
            indices[ii++] = ((y + 1) * 256) + x;
            indices[ii++] = ((y + 1) * 256) + (x + 1);

            colors[ci++] = 0; //x % 255;
            colors[ci++] = 0; //y % 255;
            colors[ci++] = 0; //220;

            indices[ii++] = (y * 256) + x;
            indices[ii++] = ((y + 1) * 256) + (x + 1);
            indices[ii++] = (y * 256) + (x + 1);

            colors[ci++] = 0; //y % 255;
            colors[ci++] = 0; // x % 255;
            colors[ci++] = 0; //240;

        }
    }

    glColor4f(1, 0, 1, 1);
    glUseProgram(program);
    //glUseProgram(0);
    glPointSize(2);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glVertexPointer(3, GL_DOUBLE, 0, vertices);
    glNormalPointer(GL_DOUBLE, 0, normals);
    glColorPointer(3, GL_UNSIGNED_BYTE, 0, colors);
    //glDrawElements(GL_TRIANGLES, 255 * 255 * 6, GL_UNSIGNED_SHORT, indices);
    glDrawArrays(GL_POINTS, 0, 256 * 256);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);
    glUseProgram(0);


    // glEnable(GL_TEXTURE_2D);
    // glBlendFunc(GL_ONE, GL_SRC_COLOR);

    // glBindTexture(GL_TEXTURE_2D, texture_id);
    // glBegin(GL_QUADS);
    // glTexCoord2f(0.0, 0.0);
    // glVertex2f(0, 0);
    // glTexCoord2f(1.0, 0.0);
    // glVertex2f(WIDTH, 0);
    // glTexCoord2f(1.0, 1.0);
    // glVertex2f(WIDTH, HEIGHT);
    // glTexCoord2f(0.0, 1.0);
    // glVertex2f(0, HEIGHT);
    // glEnd();
    // glUseProgram(0);
}

static void error_callback(int error, const char* description) {
    fputs(description, stderr);
}

static void print_camera_pos() {
    printf("Camera: %.1f %.1f %.1f\n", camera_x, camera_y, camera_z);
}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
        glfwSetWindowShouldClose(window, GL_TRUE);
    } else if (key == GLFW_KEY_W && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        camera_z += 1;
        print_camera_pos();
    } else if (key == GLFW_KEY_S && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        camera_z -= 1;
        print_camera_pos();
    } else if (key == GLFW_KEY_A && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        camera_x -= 1;
        print_camera_pos();
    } else if (key == GLFW_KEY_D && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        camera_x += 1;
        print_camera_pos();
    } else if (key == GLFW_KEY_Q && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        camera_y += 1;
        print_camera_pos();
    } else if (key == GLFW_KEY_E && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        camera_y -= 1;
        print_camera_pos();
    } else if (key == GLFW_KEY_RIGHT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        freq_mhz += 0.01;
        set_frequency();
    } else if (key == GLFW_KEY_LEFT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        freq_mhz -= 0.01;
        set_frequency();
    } else if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {
        paused = !paused;
    }
}

int main(void) {
    glfwSetErrorCallback(error_callback);
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }
    window = glfwCreateWindow(WIDTH, HEIGHT, "Frequensea", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    #if defined(HAVE_HACKRF)
        setup_hackrf();
    #else
        setup_fake();
    #endif
    setup();
    while (!glfwWindowShouldClose(window)) {
        prepare();
        update();
        draw();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    #if defined(HAVE_HACKRF)
        teardown_hackrf();
    #endif
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}


================================================
FILE: c/iq-lines.c
================================================
// Slowly show a single sample, frame by frame. Used for exporting to movie.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include <pthread.h>

#include <libhackrf/hackrf.h>
#include <GLFW/glfw3.h>

#include "easypng.h"

const int SAMPLES_STEP = 100;
const int IQ_RESOLUTION = 256;
const int SIZE_MULTIPLIER = 4;
const int WIDTH = IQ_RESOLUTION * SIZE_MULTIPLIER;
const int HEIGHT = IQ_RESOLUTION * SIZE_MULTIPLIER;
const int SAMPLE_BUFFER_SIZE = 262144;

hackrf_device *device;
double freq_mhz = 124.2;

pthread_mutex_t data_mutex;
uint8_t *sample_buffer;
uint8_t *image_buffer;

GLFWwindow* window;
GLuint texture_id;
GLuint program;

int line_intensity = 4;
float line_percentage = 1.0;

// Utility ////////////////////////////////////////////////////////////////////

float clampf(float v, float min, float max) {
    return v < min ? min : v > max ? max : v;
}

// HackRF /////////////////////////////////////////////////////////////////////

void hackrf_check_status(int status, const char *message, const char *file, int line) {
    if (status != 0) {
        fprintf(stderr, "NRF HackRF fatal error: %s\n", message);
        if (device != NULL) {
            hackrf_close(device);
        }
        hackrf_exit();
        exit(EXIT_FAILURE);
    }
}

#define HACKRF_CHECK_STATUS(status, message) hackrf_check_status(status, message, __FILE__, __LINE__)

int receive_sample_block(hackrf_transfer *transfer) {
    assert(SAMPLE_BUFFER_SIZE == transfer->valid_length);
    pthread_mutex_lock(&data_mutex);
    memcpy(sample_buffer, transfer->buffer, SAMPLE_BUFFER_SIZE);
    pthread_mutex_unlock(&data_mutex);
    return 0;
}

static void setup_hackrf() {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, 10e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");

    //memset(buffer, 0, WIDTH * HEIGHT);

    //status = hackrf_set_freq(device, freq_mhz * 1e6);
    //HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
}

static void teardown_hackrf() {
    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
}

static void set_frequency() {
    freq_mhz = freq_mhz < 1 ? 1 : freq_mhz > 6000 ? 6000 : freq_mhz;
    freq_mhz = round(freq_mhz * 1000.0) / 1000.0;
    printf("Seting freq to %f MHz.\n", freq_mhz);
    int status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
}

// Line drawing ///////////////////////////////////////////////////////////////

void pixel_put(uint8_t *image_buffer, int x, int y, int color) {
    int offset = y * WIDTH + x;
    image_buffer[offset] = color;
}

void pixel_inc(uint8_t *image_buffer, int x, int y) {
    static int have_warned = 0;
    int offset = y * WIDTH + x;
    int v = image_buffer[offset];
    if (v + line_intensity >= 255) {
        if (!have_warned) {
            fprintf(stderr, "WARN: pixel value out of range (%d, %d)\n", x, y);
            have_warned = 1;
        }
    } else {
        v += line_intensity;
        image_buffer[offset] = v;
    }
}

void draw_line(uint8_t *image_buffer, int x1, int y1, int x2, int y2, int color) {
  int dx = abs(x2 - x1);
  int sx = x1 < x2 ? 1 : -1;
  int dy = abs(y2-y1);
  int sy = y1 < y2 ? 1 : -1;
  int err = (dx > dy ? dx : -dy) / 2;
  int e2;

  for(;;){
    pixel_inc(image_buffer, x1, y1);
    if (x1 == x2 && y1 == y2) break;
    e2 = err;
    if (e2 > -dx) { err -= dy; x1 += sx; }
    if (e2 <  dy) { err += dx; y1 += sy; }
  }
}

static void update_image_buffer() {
    pthread_mutex_lock(&data_mutex);
    memset(image_buffer, 0, WIDTH * HEIGHT * sizeof(uint8_t));
    int x1 = 0;
    int y1 = 0;
    int max = SAMPLE_BUFFER_SIZE * line_percentage;
    for (int i = 0; i < max; i += 2) {
        int x2 = (sample_buffer[i] + 128) % 256;
        int y2 = (sample_buffer[i + 1] + 128) % 256;
        if (i > 0) {
            draw_line(image_buffer, x1 * SIZE_MULTIPLIER, y1 * SIZE_MULTIPLIER, x2 * SIZE_MULTIPLIER, y2 * SIZE_MULTIPLIER, 0);
        }
        x1 = x2;
        y1 = y2;
    }
    pthread_mutex_unlock(&data_mutex);
}

// OpenGL /////////////////////////////////////////////////////////////////////

static void check_shader_error(GLuint shader) {
    int length = 0;
    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

    if (length > 0) {
        char message[length];
        glGetShaderInfoLog(shader, length, NULL, message);
        printf("%s\n", message);
    }
}

static void setup() {
    glGenTextures(1, &texture_id);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    const char *vertex_shader_source =
        "void main(void) {"
        "  gl_TexCoord[0] = gl_MultiTexCoord0;"
        "  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
        "}";

    const char *fragment_shader_source =
        "uniform sampler2D texture;"
        "void main(void) {"
        "  vec4 c = texture2D(texture, gl_TexCoord[0].st);"
        "  float v = c.r;"
        "  gl_FragColor = vec4(v, v, v, 1);"
        "}";

    GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &vertex_shader_source, NULL);
    glCompileShader(vertex_shader);
    check_shader_error(vertex_shader);

    GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &fragment_shader_source, NULL);
    glCompileShader(fragment_shader);
    check_shader_error(fragment_shader);

    program = glCreateProgram();
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    glLinkProgram(program);

    glActiveTexture(0);
    GLuint u_texture = glGetUniformLocation(program, "texture");
    glUniform1i(u_texture, texture_id);
}


static void prepare() {
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WIDTH, 0, HEIGHT, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}


static void update() {
    update_image_buffer();
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, WIDTH, HEIGHT, 0, GL_RED, GL_UNSIGNED_BYTE, image_buffer);
}

static void draw() {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_SRC_COLOR);

    glUseProgram(program);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex2f(0, 0);
    glTexCoord2f(1.0, 0.0);
    glVertex2f(WIDTH, 0);
    glTexCoord2f(1.0, 1.0);
    glVertex2f(WIDTH, HEIGHT);
    glTexCoord2f(0.0, 1.0);
    glVertex2f(0, HEIGHT);
    glEnd();
    glUseProgram(0);
}

// GLFW ///////////////////////////////////////////////////////////////////////

static void export() {
    time_t t;
    time(&t);
    struct tm* tm_info = localtime(&t);
    char s_time[20];
    strftime(s_time, 20, "%Y-%m-%d_%H.%M.%S", tm_info);
    char fname[100];
    snprintf(fname, 100, "screenshot-%s-%.4f.png", s_time, freq_mhz);
    write_gray_png(fname, WIDTH, HEIGHT, image_buffer);
}

static void error_callback(int error, const char* description) {
    fputs(description, stderr);
}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (action == GLFW_PRESS || action == GLFW_REPEAT) {

        double d;
        if (mods == 1) { // Shift key
            d = 10;
        } else if (mods == 4) { // Alt key
            d = 0.001;
        } else {
            d = 0.1;
        }
        if (key == GLFW_KEY_ESCAPE) {
            glfwSetWindowShouldClose(window, GL_TRUE);
        } else if (key == GLFW_KEY_RIGHT) {
            freq_mhz += d;
            set_frequency();
        } else if (key == GLFW_KEY_LEFT) {
            freq_mhz -= d;
            set_frequency();
        } else if (key == GLFW_KEY_SPACE) {
            //paused = !paused;
        } else if (key == GLFW_KEY_E) {
            export();
        } else if (key == GLFW_KEY_EQUAL) {
            line_intensity += 1;
            printf("Intensity: %d\n", line_intensity);
        } else if (key == GLFW_KEY_MINUS) {
            line_intensity -= 1;
            printf("Intensity: %d\n", line_intensity);
        } else if (key == GLFW_KEY_COMMA) {
            line_percentage = clampf(line_percentage - (d / 100), 0, 1);
            printf("Line percentage: %.2f%%\n", line_percentage * 100);
        } else if (key == GLFW_KEY_PERIOD) {
            line_percentage = clampf(line_percentage + (d / 100), 0, 1);
            printf("Line percentage: %.2f%%\n", line_percentage * 100);
        }
    }
}

// Main ///////////////////////////////////////////////////////////////////////

int main(void) {
    glfwSetErrorCallback(error_callback);
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }
    window = glfwCreateWindow(WIDTH, HEIGHT, "HackRF", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);

    sample_buffer = calloc(SAMPLE_BUFFER_SIZE, sizeof(uint8_t));
    image_buffer = calloc(WIDTH * HEIGHT, sizeof(uint8_t));

    setup_hackrf();
    setup();
    while (!glfwWindowShouldClose(window)) {
        prepare();
        update();
        draw();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    teardown_hackrf();
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}


================================================
FILE: c/iqvis-rtl.c
================================================
#include <math.h>
#include <png.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <rtl-sdr.h>

#define WIDTH 256
#define HEIGHT 256

GLFWwindow* window;
GLuint texture_id;
GLuint program;
GLfloat buffer[WIDTH * HEIGHT];
rtlsdr_dev_t *device;
pthread_t receive_thread;
double freq_mhz = 1000;
int paused = 0;
float intensity = 0.03;
void *rtl_buffer;
const uint32_t rtl_buffer_length = (16 * 16384);
int rtl_should_quit = 0;

void rtl_check_status(rtlsdr_dev_t *device, int status, const char *message, const char *file, int line) {
    if (status != 0) {
        fprintf(stderr, "RTL-SDR: %s (Status code %d) %s:%d\n", message, status, file, line);
        if (device != NULL) {
            rtlsdr_close(device);
        }
        exit(EXIT_FAILURE);
    }
}

#define RTL_CHECK_STATUS(device, status, message) rtl_check_status(device, status, message, __FILE__, __LINE__)

void receive_block(unsigned char *in_buffer, uint32_t buffer_length, void *ctx) {
    printf("o\n");
    if (paused) return;
    memset(buffer, 0, sizeof(GLfloat) * WIDTH * HEIGHT);
    for (int i = 0; i < buffer_length; i += 2) {
        int vi = in_buffer[i];
        int vq = in_buffer[i + 1];

        int d = (vq * 256) + vi;
        float v = buffer[d];
        v += intensity;
        v = v < 0 ? 0 : v > 255 ? 255 : v;
        buffer[d] = v;
    }
}

// This function will block, so needs to be called on its own thread.
void *_receive_loop(rtlsdr_dev_t *device) {
    while (!rtl_should_quit) {
        int n_read;
        int status = rtlsdr_read_sync(device, rtl_buffer, rtl_buffer_length, &n_read);
        RTL_CHECK_STATUS(device, status, "rtlsdr_read_sync");

        if (n_read < rtl_buffer_length) {
            fprintf(stderr, "Short read, samples lost, exiting!\n");
            exit(EXIT_FAILURE);
        }

        receive_block(rtl_buffer, rtl_buffer_length, device);
    }
    return NULL;
}

static void setup_rtl() {
    int status;

    rtl_buffer = calloc(rtl_buffer_length, sizeof(uint8_t));

    int device_count = rtlsdr_get_device_count();
    if (device_count == 0) {
        fprintf(stderr, "RTL-SDR: No devices found.\n");
        exit(EXIT_FAILURE);
    }

    const char *device_name = rtlsdr_get_device_name(0);
    printf("Device %s\n", device_name);

    status = rtlsdr_open(&device, 0);
    RTL_CHECK_STATUS(device, status, "rtlsdr_open");

    status = rtlsdr_set_sample_rate(device, 3e6);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_sample_rate");

    // Set auto-gain mode
    status = rtlsdr_set_tuner_gain_mode(device, 0);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_tuner_gain_mode");

    status = rtlsdr_set_agc_mode(device, 1);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_agc_mode");

    status = rtlsdr_set_center_freq(device, freq_mhz * 1e6);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_center_freq");

    status = rtlsdr_reset_buffer(device);
    RTL_CHECK_STATUS(device, status, "rtlsdr_reset_buffer");

    printf("Start\n");
    pthread_create(&receive_thread, NULL, (void *(*)(void *))_receive_loop, device);
    printf("Running\n");

}

static void set_frequency() {
    freq_mhz = round(freq_mhz * 10.0) / 10.0;
    printf("Seting freq to %f MHz.\n", freq_mhz);
    int status = rtlsdr_set_center_freq(device, freq_mhz * 1e6);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_center_freq");
}

static void teardown_rtl() {
    int status;

    rtl_should_quit = 1;

    printf("pthread_join\n");
    pthread_join(receive_thread, NULL);

    printf("rtlsdr_close\n");
    status = rtlsdr_close(device);
    //printf("Closed\n");
    RTL_CHECK_STATUS(device, status, "rtlsdr_close");
}

static void setup() {
    glGenTextures(1, &texture_id);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

}

static void prepare() {
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WIDTH, 0, HEIGHT, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

static void update() {
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, WIDTH, HEIGHT, 0, GL_RED, GL_FLOAT, buffer);
}

static void export() {
    png_structp png_ptr = NULL;
    png_infop info_ptr = NULL;
    png_bytepp row_pointers;

    // We set paused so we don't write to the buffer while saving the file.
    paused = 1;

    // Filename contains the frequency.
    char fname[100];
    snprintf(fname, 100, "vis-%.3f.png", freq_mhz);

    FILE *fp = fopen(fname, "wb");
    if (!fp) {
        printf("ERROR: Could not write open file %s for writing.\n", fname);
        paused = 0;
        return;
    }

    // Init PNG writer.
    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    if (png_ptr == NULL) {
        printf("ERROR: png_create_write_struct.\n");
        paused = 0;
        return;
    }

    info_ptr = png_create_info_struct(png_ptr);
    if (info_ptr == NULL) {
        printf("ERROR: png_create_info_struct.\n");
        png_destroy_write_struct(&png_ptr, NULL);
        paused = 0;
        return;
    }

    png_set_IHDR(png_ptr, info_ptr,
                 WIDTH, HEIGHT,
                 8,
                 PNG_COLOR_TYPE_GRAY,
                 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);

    // PNG expects a list of pointers. We just calculate offsets into our buffer.
    row_pointers = (png_bytepp) png_malloc(png_ptr, HEIGHT * sizeof(png_bytep));
    for (int y = 0; y < HEIGHT; y++) {
       row_pointers[y] = (png_byte *) (buffer + y * WIDTH);
   }

    // Write out the image data.
    png_init_io(png_ptr, fp);
    png_set_rows(png_ptr, info_ptr, row_pointers);
    png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);

    // Cleanup.
    png_free(png_ptr, row_pointers);
    png_destroy_write_struct(&png_ptr, &info_ptr);
    fclose(fp);
    printf("Written %s.\n", fname);
    paused = 0;
}

static void draw() {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_SRC_COLOR);

    glBindTexture(GL_TEXTURE_2D, texture_id);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex2f(0, 0);
    glTexCoord2f(1.0, 0.0);
    glVertex2f(WIDTH, 0);
    glTexCoord2f(1.0, 1.0);
    glVertex2f(WIDTH, HEIGHT);
    glTexCoord2f(0.0, 1.0);
    glVertex2f(0, HEIGHT);
    glEnd();
}

static void error_callback(int error, const char* description) {
    fputs(description, stderr);
}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
        glfwSetWindowShouldClose(window, GL_TRUE);
    } else if (key == GLFW_KEY_RIGHT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        if (mods == 0) {
            freq_mhz += 0.1;
        } else {
            freq_mhz += 10;
        }
        set_frequency();
    } else if (key == GLFW_KEY_LEFT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        if (mods == 0) {
            freq_mhz -= 0.1;
        } else {
            freq_mhz -= 10;
        }
        set_frequency();
    } else if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {
        paused = !paused;
    } else if (key == GLFW_KEY_E && action == GLFW_PRESS) {
        export();
    } else if (key == GLFW_KEY_EQUAL && action == GLFW_PRESS) {
        intensity += 0.01;
        printf("Intensity: %.2f\n", intensity);
    } else if (key == GLFW_KEY_MINUS && action == GLFW_PRESS) {
        intensity -= 0.01;
        printf("Intensity: %.2f\n", intensity);
    }
}

int main(void) {
    glfwSetErrorCallback(error_callback);
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }
    window = glfwCreateWindow(WIDTH * 2, HEIGHT * 2, "RTL-SDR", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    setup_rtl();
    setup();
    while (!glfwWindowShouldClose(window)) {
        prepare();
        update();
        draw();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    teardown_rtl();
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}


================================================
FILE: c/iqvis.c
================================================
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
#include <libhackrf/hackrf.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <png.h>

#define WIDTH 256
#define HEIGHT 256

GLFWwindow* window;
GLuint texture_id;
GLuint program;
GLfloat buffer[WIDTH * HEIGHT];
hackrf_device *device;
double freq_mhz = 124.2;
int paused = 0;
float intensity = 0.01;

#define HACKRF_CHECK_STATUS(status, message) \
    if (status != 0) { \
        printf("FAIL: %s\n", message); \
        hackrf_close(device); \
        hackrf_exit(); \
        exit(EXIT_FAILURE); \
    } \

int receive_sample_block(hackrf_transfer *transfer) {
    if (paused) return 0;
    memset(buffer, 0, sizeof(GLfloat) * WIDTH * HEIGHT);
    // for (int i = 0; i < WIDTH * HEIGHT; i += 1) {
    //     buffer[i] = 0;
    // }
    for (int i = 0; i < transfer->valid_length; i += 2) {

        int vi = transfer->buffer[i];
        int vq = transfer->buffer[i + 1];

        vi = (vi + 128) % 256;
        vq = (vq + 128) % 256;
        int d = (vq * 256) + vi;
        float v = buffer[d];
        v += intensity;
        v = v < 0 ? 0 : v > 255 ? 255 : v;
        buffer[d] = v;
        //buffer[i] = transfer->buffer[i + 1];
        //buffer[i + 1] = transfer->buffer[i + 1];
    }
    return 0;
}

static void setup_hackrf() {
    int status;

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, 10e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");

    //memset(buffer, 0, WIDTH * HEIGHT);

    //status = hackrf_set_freq(device, freq_mhz * 1e6);
    //HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
}

static void set_frequency() {
    freq_mhz = round(freq_mhz * 10.0) / 10.0;
    printf("Seting freq to %f MHz.\n", freq_mhz);
    int status = hackrf_set_freq(device, freq_mhz * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");
}

static void teardown_hackrf() {
    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
}

static void check_shader_error(GLuint shader) {
    int length = 0;
    int charsWritten  = 0;
    char *infoLog;

    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

    if (length > 0) {
        char message[length];
        glGetShaderInfoLog(shader, length, NULL, message);
        printf("%s\n", message);
    }
}

static void setup() {
    glGenTextures(1, &texture_id);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    const char *vertex_shader_source =
        "void main(void) {"
        "  gl_TexCoord[0] = gl_MultiTexCoord0;"
        "  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
        "}";

    const char *fragment_shader_source =
        "uniform sampler2D texture;"
        "void main(void) {"
        "  vec4 c = texture2D(texture, gl_TexCoord[0].st);"
        "  float v = c.r;"
        "  gl_FragColor = vec4(v, v, v, 1);"
        "}";

    GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &vertex_shader_source, NULL);
    glCompileShader(vertex_shader);
    check_shader_error(vertex_shader);

    GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &fragment_shader_source, NULL);
    glCompileShader(fragment_shader);
    check_shader_error(fragment_shader);

    program = glCreateProgram();
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    glLinkProgram(program);

    glActiveTexture(0);
    GLuint u_texture = glGetUniformLocation(program, "texture");
    glUniform1i(u_texture, texture_id);
}

static void prepare() {
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WIDTH, 0, HEIGHT, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

static void update() {
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, WIDTH, HEIGHT, 0, GL_RED, GL_FLOAT, buffer);
}

static void export() {
    png_structp png_ptr = NULL;
    png_infop info_ptr = NULL;
    png_bytepp row_pointers;

    // We set paused so we don't write to the buffer while saving the file.
    paused = 1;

    // Filename contains the frequency.
    char fname[100];
    snprintf(fname, 100, "vis-%.3f.png", freq_mhz);

    FILE *fp = fopen(fname, "wb");
    if (!fp) {
        printf("ERROR: Could not write open file %s for writing.\n", fname);
        paused = 0;
        return;
    }

    // Init PNG writer.
    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    if (png_ptr == NULL) {
        printf("ERROR: png_create_write_struct.\n");
        paused = 0;
        return;
    }

    info_ptr = png_create_info_struct(png_ptr);
    if (info_ptr == NULL) {
        printf("ERROR: png_create_info_struct.\n");
        png_destroy_write_struct(&png_ptr, NULL);
        paused = 0;
        return;
    }

    png_set_IHDR(png_ptr, info_ptr,
                 WIDTH, HEIGHT,
                 8,
                 PNG_COLOR_TYPE_GRAY,
                 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);

    // PNG expects a list of pointers. We just calculate offsets into our buffer.
    row_pointers = (png_bytepp) png_malloc(png_ptr, HEIGHT * sizeof(png_bytep));
    for (int y = 0; y < HEIGHT; y++) {
       row_pointers[y] = buffer + y * WIDTH;
   }

    // Write out the image data.
    png_init_io(png_ptr, fp);
    png_set_rows(png_ptr, info_ptr, row_pointers);
    png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);

    // Cleanup.
    png_free(png_ptr, row_pointers);
    png_destroy_write_struct(&png_ptr, &info_ptr);
    fclose(fp);
    printf("Written %s.\n", fname);
    paused = 0;
}

static void draw() {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_SRC_COLOR);

    glUseProgram(program);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex2f(0, 0);
    glTexCoord2f(1.0, 0.0);
    glVertex2f(WIDTH, 0);
    glTexCoord2f(1.0, 1.0);
    glVertex2f(WIDTH, HEIGHT);
    glTexCoord2f(0.0, 1.0);
    glVertex2f(0, HEIGHT);
    glEnd();
    glUseProgram(0);
}

static void error_callback(int error, const char* description) {
    fputs(description, stderr);
}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
        glfwSetWindowShouldClose(window, GL_TRUE);
    } else if (key == GLFW_KEY_RIGHT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        freq_mhz += 0.1;
        set_frequency();
    } else if (key == GLFW_KEY_LEFT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        freq_mhz -= 0.1;
        set_frequency();
    } else if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {
        paused = !paused;
    } else if (key == GLFW_KEY_E && action == GLFW_PRESS) {
        export();
    } else if (key == GLFW_KEY_EQUAL && action == GLFW_PRESS) {
        intensity += 0.01;
        printf("Intensity: %.2f\n", intensity);
    } else if (key == GLFW_KEY_MINUS && action == GLFW_PRESS) {
        intensity -= 0.01;
        printf("Intensity: %.2f\n", intensity);
    }
}

int main(void) {
    glfwSetErrorCallback(error_callback);
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }
    window = glfwCreateWindow(WIDTH * 2, HEIGHT * 2, "HackRF", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    setup_hackrf();
    setup();
    while (!glfwWindowShouldClose(window)) {
        prepare();
        update();
        draw();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    teardown_hackrf();
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}


================================================
FILE: c/osc-server.c
================================================
// A simple OSC listening server.
// Can be used to receive messages from OSCulator.

#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>

static void die(const char * format, ...)
{
    va_list vargs;
    va_start(vargs, format);
    vfprintf(stderr, format, vargs);
    fprintf(stderr, ".\n");
    exit(1);
}

static void warn(const char * format, ...) {
    va_list vargs;
    va_start(vargs, format);
    vfprintf(stderr, format, vargs);
    fprintf(stderr, ".\n");
}

#if defined( __BIG_ENDIAN__ )
    static inline void swap32(void *v) { }
#elif defined( __LITTLE_ENDIAN__ )
    static inline void swap(char *a, char *b){
        char t = *a;
        *a = *b;
        *b = t;
    }

    static inline void swap32(void *v) {
        char *b = (char *) v;
        swap(b  , b+3);
        swap(b+1, b+2);
    }
#else
    #error Either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined.
#endif

void check_arg(int cond, const char *format, ...) {
    if (!cond) {
        va_list vargs;
        va_start(vargs, format);
        fprintf(stderr, "ERROR checking arg: ");
        vfprintf(stderr, format, vargs);
        fprintf(stderr, ".\n");
        exit(1);
    }
}

ssize_t get_string(void *data, ssize_t size) {
    ssize_t i = 0;
    ssize_t len = 0;
    char *c = data;
    if (size < 0) {
        return -1;
    }
    for (i = 0; i < size; ++i) {
        if (c[i] == '\0') {
            len = 4 * (i / 4 + 1);
            break;
        }
    }
    if (0 == len) {
        return -1;
    }
    if (len > size) {
        return -1;
    }
    for (; i < len; ++i) {
        if (c[i] != '\0') {
            return -1;
        }
    }
    return len;
}

#define MAX_PATH_LENGTH 200
#define MAX_TYPES_LENGTH 10

typedef union osc_arg {
    char *s;
    int32_t i;
    float f;
} osc_arg;

typedef struct {
    char path[MAX_PATH_LENGTH];
    char types[MAX_TYPES_LENGTH];
    osc_arg *args;
} osc_message;

const char *osc_message_get_string_arg(const osc_message *msg, int index) {
    char arg_type = msg->types[index];
    check_arg(arg_type == 's', "OSC argument %d is not a string.", index);
    return msg->args[index].s;
}

int32_t osc_message_get_int_arg(const osc_message *msg, int index) {
    char arg_type = msg->types[index];
    check_arg(arg_type == 'i', "OSC argument %d is not an int32.", index);
    return msg->args[index].i;
}

float osc_message_get_float_arg(const osc_message *msg, int index) {
    char arg_type = msg->types[index];
    check_arg(arg_type == 'f', "OSC argument %d is not a float.", index);
    return msg->args[index].f;
}

typedef struct {
    char *pos;
    int remaining;
} parser;

char *parse_string(parser *p) {
    assert(p != NULL);
    assert(p->pos != NULL);
    assert(p->remaining > 0);

    // The string starts where the parser is.
    char *start = p->pos;

    // Now let's find the end
    char *end = p->pos;
    end += 3;
    while (*end) {
        end += 4;
    }
    end++;

    printf("parse_string %s len %ld\n", start, end - start);
    p->pos = end;
    p->remaining = end - start;

    return start;
}

int32_t parse_int32(parser *p) {
    assert(p != NULL);
    assert(p->pos != NULL);
    assert(p->remaining >= 4);

    swap32(p->pos);
    uint32_t v = *(int32_t *)p->pos;

    printf("parse_int32 %d\n", v);
    p->pos += 4;
    p->remaining -= 4;

    return v;
}

float parse_float(parser *p) {
    assert(p != NULL);
    assert(p->pos != NULL);
    assert(p->remaining >= 4);

    swap32(p->pos);
    float v = *(float *)p->pos;

    printf("parse_float %.3f\n", v);
    p->pos += 4;
    p->remaining -= 4;

    return v;
}


void handle_datagram(char *data, size_t size) {
    printf("Size: %ld\n", size);
    printf("Buffer: %s\n", data);

    for (int i = 0; i < size; i++) {
        printf("%4d: %d\n", i, data[i]);
    }

    osc_message *msg = calloc(1, sizeof(osc_message));

    parser p;
    p.pos = data;
    p.remaining = size;



    //int pos = 0;
    //int len = 0;
    //int remaining = size;

    //char *p = data;

    // Parse the path
    const char *path = parse_string(&p);
    strncpy(msg->path, path, MAX_PATH_LENGTH);

    // Parse the types
    printf("Types: %s\n", p.pos);
    const char *types = parse_string(&p);
    check_arg(*types == ',', "OSC message does not contain type tag string.");
    types++;
    strncpy(msg->types, types, MAX_TYPES_LENGTH);
    int types_count = strlen(types);
    printf("Types in msg: %s\n", msg->types);

    // char *types_ptr = data + len;
    // types_ptr++;
    // len = get_string(types_ptr, remaining);
    // remaining -= len;
    // strncpy(msg->types, types_ptr, MAX_TYPES_LENGTH);

    // Allocate the data structures.
    msg->args = calloc(types_count, sizeof(osc_arg));

    // Parse the actual arguments.
    //char *args_ptr = types_ptr + len;
    for (int i = 0; i < types_count; i ++) {
        char arg_type = types[i];
        if (arg_type == 's') {
            const char *str = parse_string(&p);
            //len = get_string(args_ptr, remaining);
            //remaining -= len;
            int len = strlen(str);
            msg->args[i].s = calloc(len, 1);
            printf("Len %d\n", len);
            strncpy(msg->args[i].s, str, len);
        } else if (arg_type == 'i') {
            int v = parse_int32(&p);
            msg->args[i].i = v;
        } else if (arg_type == 'f') {
            float v = parse_float(&p);
            msg->args[i].f = v;
        }

        printf("Arg %c\n", arg_type);
    }

    printf("Message PATH %s TYPES %s\n", msg->path, msg->types);

    const char *arg0 = osc_message_get_string_arg(msg, 0);
    printf("Arg 0 %s\n", arg0);

    int arg1 = osc_message_get_int_arg(msg, 1);
    printf("Arg 1 %d\n", arg1);

    float arg2 = osc_message_get_float_arg(msg, 2);
    printf("Arg 2 %.3f\n", arg2);

    free(msg);
}

int main() {
    const char *hostname = 0;
    const char *portname = "2222";
    struct addrinfo hints;
    memset(&hints, 0 ,sizeof(hints));
    hints.ai_family=AF_UNSPEC;
    hints.ai_socktype=SOCK_DGRAM;
    hints.ai_protocol=0;
    hints.ai_flags=AI_PASSIVE|AI_ADDRCONFIG;
    struct addrinfo *res = NULL;
    int err=getaddrinfo(hostname,portname,&hints,&res);
    if (err!=0) {
            die("failed to resolve local socket address (err=%d)",err);
    }
    // Create the socket
    int fd=socket(res->ai_family,res->ai_socktype,res->ai_protocol);
    if (fd==-1) {
            die("%s",strerror(errno));
    }
    // Bind the local address to the socket
    if (bind(fd,res->ai_addr,res->ai_addrlen)==-1) {
            die("%s",strerror(errno));
    }
    // Free addrinfo
    freeaddrinfo(res);

    char buffer[548];
    struct sockaddr_storage src_addr;

    struct iovec iov[1];
    iov[0].iov_base=buffer;
    iov[0].iov_len=sizeof(buffer);

    struct msghdr message;
    message.msg_name=&src_addr;
    message.msg_namelen=sizeof(src_addr);
    message.msg_iov=iov;
    message.msg_iovlen=1;
    message.msg_control=0;
    message.msg_controllen=0;

    while (1) {
        ssize_t count=recvmsg(fd,&message,0);
        if (count==-1) {
                die("%s",strerror(errno));
        } else if (message.msg_flags&MSG_TRUNC) {
                warn("datagram too large for buffer: truncated");
        } else {
                handle_datagram(buffer,count);
        }

    }



}


================================================
FILE: c/piqvis.c
================================================
// Visualisation on the Raspberry PI

#include <math.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define GLFW_INCLUDE_ES2
#include <GLFW/glfw3.h>
#include <rtl-sdr.h>

#define WIDTH 256
#define HEIGHT 256

GLFWwindow* window;
GLuint texture_id;
GLuint program;
GLuint position_vbo;
GLuint uv_vbo;
GLuint vao;
GLfloat buffer[WIDTH * HEIGHT * 3];
rtlsdr_dev_t *device;
pthread_t receive_thread;
double freq_mhz = 124.2;
int paused = 0;
float intensity = 0.03;
void *rtl_buffer;
const uint32_t rtl_buffer_length = (16 * 16384);
int rtl_should_quit = 0;

void rtl_check_status(rtlsdr_dev_t *device, int status, const char *message, const char *file, int line) {
    if (status != 0) {
        fprintf(stderr, "RTL-SDR: %s (Status code %d) %s:%d\n", message, status, file, line);
        if (device != NULL) {
            rtlsdr_close(device);
        }
        exit(EXIT_FAILURE);
    }
}

#define RTL_CHECK_STATUS(device, status, message) rtl_check_status(device, status, message, __FILE__, __LINE__)

void receive_block(unsigned char *in_buffer, uint32_t buffer_length, void *ctx) {
    if (paused) return;
    memset(buffer, 0, WIDTH * HEIGHT * 3 * sizeof(GLfloat));
    for (int i = 0; i < buffer_length; i += 2) {
        int vi = in_buffer[i];
        int vq = in_buffer[i + 1];

        int d = (vq * 256) + vi;
        float v = buffer[d];
        v += intensity;
        v = v < 0 ? 0 : v > 255 ? 255 : v;
        buffer[d * 3] = v;
    }
}

// This function will block, so needs to be called on its own thread.
void *_receive_loop(rtlsdr_dev_t *device) {
    while (!rtl_should_quit) {
        int n_read;
        int status = rtlsdr_read_sync(device, rtl_buffer, rtl_buffer_length, &n_read);
        RTL_CHECK_STATUS(device, status, "rtlsdr_read_sync");

        if (n_read < rtl_buffer_length) {
            fprintf(stderr, "Short read, samples lost, exiting!\n");
            exit(EXIT_FAILURE);
        }

        receive_block(rtl_buffer, rtl_buffer_length, device);
    }
    return NULL;
}

static void setup_rtl() {
    int status;

    rtl_buffer = calloc(rtl_buffer_length, sizeof(uint8_t));

    int device_count = rtlsdr_get_device_count();
    if (device_count == 0) {
        fprintf(stderr, "RTL-SDR: No devices found.\n");
        exit(EXIT_FAILURE);
    }

    const char *device_name = rtlsdr_get_device_name(0);
    printf("Device %s\n", device_name);

    status = rtlsdr_open(&device, 0);
    RTL_CHECK_STATUS(device, status, "rtlsdr_open");

    status = rtlsdr_set_sample_rate(device, 2e6);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_sample_rate");

    // Set auto-gain mode
    status = rtlsdr_set_tuner_gain_mode(device, 0);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_tuner_gain_mode");

    status = rtlsdr_set_agc_mode(device, 1);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_agc_mode");

    status = rtlsdr_set_center_freq(device, freq_mhz * 1e6);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_center_freq");

    status = rtlsdr_reset_buffer(device);
    RTL_CHECK_STATUS(device, status, "rtlsdr_reset_buffer");

    printf("Start\n");
    pthread_create(&receive_thread, NULL, (void *(*)(void *))_receive_loop, device);
    printf("Running\n");

}

static void set_frequency() {
    freq_mhz = round(freq_mhz * 10.0) / 10.0;
    printf("Seting freq to %f MHz.\n", freq_mhz);
    int status = rtlsdr_set_center_freq(device, freq_mhz * 1e6);
    RTL_CHECK_STATUS(device, status, "rtlsdr_set_center_freq");
}

static void teardown_rtl() {
    int status;

    rtl_should_quit = 1;

    printf("pthread_join\n");
    pthread_join(receive_thread, NULL);

    printf("rtlsdr_close\n");
    status = rtlsdr_close(device);
    //printf("Closed\n");
    RTL_CHECK_STATUS(device, status, "rtlsdr_close");
}


void ngl_check_gl_error(const char *file, int line) {
    GLenum err = glGetError();
    int has_error = 0;
    while (err != GL_NO_ERROR) {
        has_error = 1;
        char *msg = NULL;
        switch(err) {
            case GL_INVALID_OPERATION:
            msg = "GL_INVALID_OPERATION";
            break;
            case GL_INVALID_ENUM:
            msg = "GL_INVALID_ENUM";
            fprintf(stderr, "OpenGL error: GL_INVALID_ENUM\n");
            break;
            case GL_INVALID_VALUE:
            msg = "GL_INVALID_VALUE";
            fprintf(stderr, "OpenGL error: GL_INVALID_VALUE\n");
            break;
            case GL_OUT_OF_MEMORY:
            msg = "GL_OUT_OF_MEMORY";
            fprintf(stderr, "OpenGL error: GL_OUT_OF_MEMORY\n");
            break;
            default:
            msg = "UNKNOWN_ERROR";
        }
        fprintf(stderr, "OpenGL error: %s - %s:%d\n", msg, file, line);
        err = glGetError();
    }
    if (has_error) {
        exit(EXIT_FAILURE);
    }
}

#define NGL_CHECK_ERROR() ngl_check_gl_error(__FILE__, __LINE__)

static void check_shader_error(GLuint shader) {
    int length = 0;

    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);

    if (length > 0) {
        char message[length];
        glGetShaderInfoLog(shader, length, NULL, message);
        printf("%s\n", message);
    }
}


static const GLfloat positions[] = {
    -1.0, -1.0,
     1.0, -1.0,
    -1.0,  1.0,
     1.0,  1.0
};

static const GLfloat uvs[] = {
    1.0, 1.0,
    1.0, 0.0,
    0.0, 1.0,
    0.0, 0.0
};

const int ATTRIB_VERTEX = 0;
const int ATTRIB_TEXTUREPOSITION = 1;

static void setup() {
    glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_FLOAT, 0, 0, positions);
    glEnableVertexAttribArray(ATTRIB_VERTEX);
    glVertexAttribPointer(ATTRIB_TEXTUREPOSITION, 2, GL_FLOAT, 0, 0, uvs);
    glEnableVertexAttribArray(ATTRIB_TEXTUREPOSITION);
    NGL_CHECK_ERROR();

    glGenTextures(1, &texture_id);
    glBindTexture(GL_TEXTURE_2D, texture_id);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    NGL_CHECK_ERROR();

    const char *vertex_shader_source =
        "#ifdef GL_ES\n"
        "precision mediump float;\n"
        "#endif\n"
        "attribute vec2 vp;\n"
        "attribute vec2 vt;\n"
        "varying vec2 uv;\n"
        "void main(void) {\n"
        "  uv = vt;\n"
        "  gl_Position = vec4(vp.x, vp.y, 0, 1);\n"
        "}\n";

    const char *fragment_shader_source =
        "#ifdef GL_ES\n"
        "precision mediump float;\n"
        "#endif\n"
        "uniform sampler2D texture;\n"
        "varying vec2 uv;\n"
        "void main(void) {\n"
        "  vec4 c = texture2D(texture, uv);\n"
        "  float v = c.r;\n"
        "  gl_FragColor = vec4(v, v, v, 1);\n"
        "}\n";

    GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &vertex_shader_source, NULL);
    glCompileShader(vertex_shader);
    check_shader_error(vertex_shader);

    GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &fragment_shader_source, NULL);
    glCompileShader(fragment_shader);
    check_shader_error(fragment_shader);

    program = glCreateProgram();
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    glLinkProgram(program);
    NGL_CHECK_ERROR();

    glActiveTexture(0);
    GLuint u_texture = glGetUniformLocation(program, "texture");
    glUniform1i(u_texture, texture_id);
    NGL_CHECK_ERROR();
}

static void prepare() {
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);
    NGL_CHECK_ERROR();
}

static void update() {
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_FLOAT, buffer);
    NGL_CHECK_ERROR();
}

static void draw() {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_SRC_COLOR);
    NGL_CHECK_ERROR();

    glUseProgram(program);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    glUseProgram(0);
}

static void error_callback(int error, const char* description) {
    fputs(description, stderr);
}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
        glfwSetWindowShouldClose(window, GL_TRUE);
    } else if (key == GLFW_KEY_RIGHT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        if (mods == 0) {
            freq_mhz += 0.1;
        } else {
            freq_mhz += 10;
        }
        set_frequency();
    } else if (key == GLFW_KEY_LEFT && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
        if (mods == 0) {
            freq_mhz -= 0.1;
        } else {
            freq_mhz -= 10;
        }
        set_frequency();
    } else if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {
        paused = !paused;
    } else if (key == GLFW_KEY_EQUAL && action == GLFW_PRESS) {
        intensity += 0.01;
        printf("Intensity: %.2f\n", intensity);
    } else if (key == GLFW_KEY_MINUS && action == GLFW_PRESS) {
        intensity -= 0.01;
        printf("Intensity: %.2f\n", intensity);
    }
}

int main(void) {
    glfwSetErrorCallback(error_callback);
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }
    window = glfwCreateWindow(WIDTH * 2, HEIGHT * 2, "RTL-SDR", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    setup_rtl();
    setup();
    while (!glfwWindowShouldClose(window)) {
        prepare();
        update();
        draw();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    teardown_rtl();
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}


================================================
FILE: c/play.c
================================================
// Play random noise as audio

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#include <sndfile.h>

void nal_check_error(const char *file, int line) {
    ALenum err = alGetError();
    int has_error = 0;
    while (err != AL_NO_ERROR) {
        has_error = 1;
        char *msg = NULL;
        switch (err) {
            case AL_INVALID_NAME:
                msg = "AL_INVALID_NAME";
                break;
            case AL_INVALID_ENUM:
                msg = "AL_INVALID_ENUM";
                break;
            case AL_INVALID_VALUE:
                msg = "AL_INVALID_VALUE";
                break;
            case AL_INVALID_OPERATION:
                msg = "AL_INVALID_OPERATION";
                break;
            case AL_OUT_OF_MEMORY:
                msg = "AL_OUT_OF_MEMORY";
                break;
        }
        fprintf(stderr, "OpenAL error: %s - %s:%d\n", msg, file, line);
        err = alGetError();
    }
    if (has_error) {
        exit(EXIT_FAILURE);
    }
}

#define NAL_CHECK_ERROR() nal_check_error(__FILE__, __LINE__)

int main(int argc, char **argv) {
    if (argc != 2) {
        fprintf(stderr, "Usage: play <audio_file.wav>\n");
        exit(1);
    }
    const char *file_name = argv[1];

    // Initialize the audio context
    ALCdevice *device = alcOpenDevice(NULL);
    if (!device) {
        fprintf(stderr, "Could not open audio device.\n");
        return 1;
    }
    ALCcontext *ctx = alcCreateContext(device, NULL);
    alcMakeContextCurrent(ctx);

    SF_INFO wav_file_info;
    SNDFILE* wav_file = sf_open(file_name, SFM_READ, &wav_file_info);

    ALsizei n_samples  = wav_file_info.channels * wav_file_info.frames;
    ALsizei sample_rate = wav_file_info.samplerate;
    int16_t *samples = calloc(n_samples, sizeof(short));
    if (sf_read_short(wav_file, samples, n_samples) < n_samples) {
        fprintf(stderr, "Error while reading audio.\n");
        exit(1);
    }

    sf_close(wav_file);

    // Initialize an audio buffer
    ALuint buffer;
    alGetError(); // clear error code
    alGenBuffers(1, &buffer);
    NAL_CHECK_ERROR();

    alBufferData(buffer, AL_FORMAT_MONO16, samples, n_samples * sizeof(ALushort), sample_rate);
    NAL_CHECK_ERROR();

    // Initialize a source
    ALuint source;
    alGenSources(1, &source);
    NAL_CHECK_ERROR();

    // Attach buffer to source
    alSourcei(source, AL_BUFFER, buffer);
    NAL_CHECK_ERROR();

    // Play
    alSourcePlay(source);
    NAL_CHECK_ERROR();

    // Playing is asynchronous so wait a while
    sleep(3);

    // Cleanup
    alDeleteBuffers(1, &buffer);
    alcMakeContextCurrent(NULL);
    alcDestroyContext(ctx);
    alcCloseDevice(device);

    return 0;
}


================================================
FILE: c/reader-all.sh
================================================
./reader 1.00 100
./reader 1.01 100
./reader 1.02 100
./reader 1.03 100
./reader 1.04 100
./reader 1.05 100
./reader 1.06 100
./reader 1.07 100
./reader 1.08 100
./reader 1.09 100
./reader 1.10 100
./reader 1.11 100
./reader 1.12 100
./reader 1.13 100
./reader 1.14 100
./reader 1.15 100
./reader 1.16 100
./reader 1.17 100
./reader 1.18 100
./reader 1.19 100
./reader 1.20 100
./reader 1.21 100
./reader 1.22 100
./reader 1.23 100
./reader 1.24 100
./reader 1.25 100
./reader 1.26 100
./reader 1.27 100
./reader 1.28 100
./reader 1.29 100
./reader 1.30 100
./reader 1.31 100
./reader 1.32 100
./reader 1.33 100
./reader 1.34 100
./reader 1.35 100
./reader 1.36 100
./reader 1.37 100
./reader 1.38 100
./reader 1.39 100
./reader 1.40 100
./reader 1.41 100
./reader 1.42 100
./reader 1.43 100
./reader 1.44 100
./reader 1.45 100
./reader 1.46 100
./reader 1.47 100
./reader 1.48 100
./reader 1.49 100
./reader 1.50 100
./reader 1.51 100
./reader 1.52 100
./reader 1.53 100
./reader 1.54 100
./reader 1.55 100
./reader 1.56 100
./reader 1.57 100
./reader 1.58 100
./reader 1.59 100
./reader 1.60 100
./reader 1.61 100
./reader 1.62 100
./reader 1.63 100
./reader 1.64 100
./reader 1.65 100
./reader 1.66 100
./reader 1.67 100
./reader 1.68 100
./reader 1.69 100
./reader 1.70 100
./reader 1.71 100
./reader 1.72 100
./reader 1.73 100
./reader 1.74 100
./reader 1.75 100
./reader 1.76 100
./reader 1.77 100
./reader 1.78 100
./reader 1.79 100
./reader 1.80 100
./reader 1.81 100
./reader 1.82 100
./reader 1.83 100
./reader 1.84 100
./reader 1.85 100
./reader 1.86 100
./reader 1.87 100
./reader 1.88 100
./reader 1.89 100
./reader 1.90 100
./reader 1.91 100
./reader 1.92 100
./reader 1.93 100
./reader 1.94 100
./reader 1.95 100
./reader 1.96 100
./reader 1.97 100
./reader 1.98 100
./reader 1.99 100
./reader 2.00 100
./reader 2.01 100
./reader 2.02 100
./reader 2.03 100
./reader 2.04 100
./reader 2.05 100
./reader 2.06 100
./reader 2.07 100
./reader 2.08 100
./reader 2.09 100
./reader 2.10 100
./reader 2.11 100
./reader 2.12 100
./reader 2.13 100
./reader 2.14 100
./reader 2.15 100
./reader 2.16 100
./reader 2.17 100
./reader 2.18 100
./reader 2.19 100
./reader 2.20 100
./reader 2.21 100
./reader 2.22 100
./reader 2.23 100
./reader 2.24 100
./reader 2.25 100
./reader 2.26 100
./reader 2.27 100
./reader 2.28 100
./reader 2.29 100
./reader 2.30 100
./reader 2.31 100
./reader 2.32 100
./reader 2.33 100
./reader 2.34 100
./reader 2.35 100
./reader 2.36 100
./reader 2.37 100
./reader 2.38 100
./reader 2.39 100
./reader 2.40 100
./reader 2.41 100
./reader 2.42 100
./reader 2.43 100
./reader 2.44 100
./reader 2.45 100
./reader 2.46 100
./reader 2.47 100
./reader 2.48 100
./reader 2.49 100
./reader 2.50 100
./reader 2.51 100
./reader 2.52 100
./reader 2.53 100
./reader 2.54 100
./reader 2.55 100
./reader 2.56 100
./reader 2.57 100
./reader 2.58 100
./reader 2.59 100
./reader 2.60 100
./reader 2.61 100
./reader 2.62 100
./reader 2.63 100
./reader 2.64 100
./reader 2.65 100
./reader 2.66 100
./reader 2.67 100
./reader 2.68 100
./reader 2.69 100
./reader 2.70 100
./reader 2.71 100
./reader 2.72 100
./reader 2.73 100
./reader 2.74 100
./reader 2.75 100
./reader 2.76 100
./reader 2.77 100
./reader 2.78 100
./reader 2.79 100
./reader 2.80 100
./reader 2.81 100
./reader 2.82 100
./reader 2.83 100
./reader 2.84 100
./reader 2.85 100
./reader 2.86 100
./reader 2.87 100
./reader 2.88 100
./reader 2.89 100
./reader 2.90 100
./reader 2.91 100
./reader 2.92 100
./reader 2.93 100
./reader 2.94 100
./reader 2.95 100
./reader 2.96 100
./reader 2.97 100
./reader 2.98 100
./reader 2.99 100
./reader 3.00 100
./reader 3.01 100
./reader 3.02 100
./reader 3.03 100
./reader 3.04 100
./reader 3.05 100
./reader 3.06 100
./reader 3.07 100
./reader 3.08 100
./reader 3.09 100
./reader 3.10 100
./reader 3.11 100
./reader 3.12 100
./reader 3.13 100
./reader 3.14 100
./reader 3.15 100
./reader 3.16 100
./reader 3.17 100
./reader 3.18 100
./reader 3.19 100
./reader 3.20 100
./reader 3.21 100
./reader 3.22 100
./reader 3.23 100
./reader 3.24 100
./reader 3.25 100
./reader 3.26 100
./reader 3.27 100
./reader 3.28 100
./reader 3.29 100
./reader 3.30 100
./reader 3.31 100
./reader 3.32 100
./reader 3.33 100
./reader 3.34 100
./reader 3.35 100
./reader 3.36 100
./reader 3.37 100
./reader 3.38 100
./reader 3.39 100
./reader 3.40 100
./reader 3.41 100
./reader 3.42 100
./reader 3.43 100
./reader 3.44 100
./reader 3.45 100
./reader 3.46 100
./reader 3.47 100
./reader 3.48 100
./reader 3.49 100
./reader 3.50 100
./reader 3.51 100
./reader 3.52 100
./reader 3.53 100
./reader 3.54 100
./reader 3.55 100
./reader 3.56 100
./reader 3.57 100
./reader 3.58 100
./reader 3.59 100
./reader 3.60 100
./reader 3.61 100
./reader 3.62 100
./reader 3.63 100
./reader 3.64 100
./reader 3.65 100
./reader 3.66 100
./reader 3.67 100
./reader 3.68 100
./reader 3.69 100
./reader 3.70 100
./reader 3.71 100
./reader 3.72 100
./reader 3.73 100
./reader 3.74 100
./reader 3.75 100
./reader 3.76 100
./reader 3.77 100
./reader 3.78 100
./reader 3.79 100
./reader 3.80 100
./reader 3.81 100
./reader 3.82 100
./reader 3.83 100
./reader 3.84 100
./reader 3.85 100
./reader 3.86 100
./reader 3.87 100
./reader 3.88 100
./reader 3.89 100
./reader 3.90 100
./reader 3.91 100
./reader 3.92 100
./reader 3.93 100
./reader 3.94 100
./reader 3.95 100
./reader 3.96 100
./reader 3.97 100
./reader 3.98 100
./reader 3.99 100
./reader 4.00 100
./reader 4.01 100
./reader 4.02 100
./reader 4.03 100
./reader 4.04 100
./reader 4.05 100
./reader 4.06 100
./reader 4.07 100
./reader 4.08 100
./reader 4.09 100
./reader 4.10 100
./reader 4.11 100
./reader 4.12 100
./reader 4.13 100
./reader 4.14 100
./reader 4.15 100
./reader 4.16 100
./reader 4.17 100
./reader 4.18 100
./reader 4.19 100
./reader 4.20 100
./reader 4.21 100
./reader 4.22 100
./reader 4.23 100
./reader 4.24 100
./reader 4.25 100
./reader 4.26 100
./reader 4.27 100
./reader 4.28 100
./reader 4.29 100
./reader 4.30 100
./reader 4.31 100
./reader 4.32 100
./reader 4.33 100
./reader 4.34 100
./reader 4.35 100
./reader 4.36 100
./reader 4.37 100
./reader 4.38 100
./reader 4.39 100
./reader 4.40 100
./reader 4.41 100
./reader 4.42 100
./reader 4.43 100
./reader 4.44 100
./reader 4.45 100
./reader 4.46 100
./reader 4.47 100
./reader 4.48 100
./reader 4.49 100
./reader 4.50 100
./reader 4.51 100
./reader 4.52 100
./reader 4.53 100
./reader 4.54 100
./reader 4.55 100
./reader 4.56 100
./reader 4.57 100
./reader 4.58 100
./reader 4.59 100
./reader 4.60 100
./reader 4.61 100
./reader 4.62 100
./reader 4.63 100
./reader 4.64 100
./reader 4.65 100
./reader 4.66 100
./reader 4.67 100
./reader 4.68 100
./reader 4.69 100
./reader 4.70 100
./reader 4.71 100
./reader 4.72 100
./reader 4.73 100
./reader 4.74 100
./reader 4.75 100
./reader 4.76 100
./reader 4.77 100
./reader 4.78 100
./reader 4.79 100
./reader 4.80 100
./reader 4.81 100
./reader 4.82 100
./reader 4.83 100
./reader 4.84 100
./reader 4.85 100
./reader 4.86 100
./reader 4.87 100
./reader 4.88 100
./reader 4.89 100
./reader 4.90 100
./reader 4.91 100
./reader 4.92 100
./reader 4.93 100
./reader 4.94 100
./reader 4.95 100
./reader 4.96 100
./reader 4.97 100
./reader 4.98 100
./reader 4.99 100
./reader 5.00 100
./reader 5.01 100
./reader 5.02 100
./reader 5.03 100
./reader 5.04 100
./reader 5.05 100
./reader 5.06 100
./reader 5.07 100
./reader 5.08 100
./reader 5.09 100
./reader 5.10 100
./reader 5.11 100
./reader 5.12 100
./reader 5.13 100
./reader 5.14 100
./reader 5.15 100
./reader 5.16 100
./reader 5.17 100
./reader 5.18 100
./reader 5.19 100
./reader 5.20 100
./reader 5.21 100
./reader 5.22 100
./reader 5.23 100
./reader 5.24 100
./reader 5.25 100
./reader 5.26 100
./reader 5.27 100
./reader 5.28 100
./reader 5.29 100
./reader 5.30 100
./reader 5.31 100
./reader 5.32 100
./reader 5.33 100
./reader 5.34 100
./reader 5.35 100
./reader 5.36 100
./reader 5.37 100
./reader 5.38 100
./reader 5.39 100
./reader 5.40 100
./reader 5.41 100
./reader 5.42 100
./reader 5.43 100
./reader 5.44 100
./reader 5.45 100
./reader 5.46 100
./reader 5.47 100
./reader 5.48 100
./reader 5.49 100
./reader 5.50 100
./reader 5.51 100
./reader 5.52 100
./reader 5.53 100
./reader 5.54 100
./reader 5.55 100
./reader 5.56 100
./reader 5.57 100
./reader 5.58 100
./reader 5.59 100
./reader 5.60 100
./reader 5.61 100
./reader 5.62 100
./reader 5.63 100
./reader 5.64 100
./reader 5.65 100
./reader 5.66 100
./reader 5.67 100
./reader 5.68 100
./reader 5.69 100
./reader 5.70 100
./reader 5.71 100
./reader 5.72 100
./reader 5.73 100
./reader 5.74 100
./reader 5.75 100
./reader 5.76 100
./reader 5.77 100
./reader 5.78 100
./reader 5.79 100
./reader 5.80 100
./reader 5.81 100
./reader 5.82 100
./reader 5.83 100
./reader 5.84 100
./reader 5.85 100
./reader 5.86 100
./reader 5.87 100
./reader 5.88 100
./reader 5.89 100
./reader 5.90 100
./reader 5.91 100
./reader 5.92 100
./reader 5.93 100
./reader 5.94 100
./reader 5.95 100
./reader 5.96 100
./reader 5.97 100
./reader 5.98 100
./reader 5.99 100
./reader 6.00 100
./reader 6.01 100
./reader 6.02 100
./reader 6.03 100
./reader 6.04 100
./reader 6.05 100
./reader 6.06 100
./reader 6.07 100
./reader 6.08 100
./reader 6.09 100
./reader 6.10 100
./reader 6.11 100
./reader 6.12 100
./reader 6.13 100
./reader 6.14 100
./reader 6.15 100
./reader 6.16 100
./reader 6.17 100
./reader 6.18 100
./reader 6.19 100
./reader 6.20 100
./reader 6.21 100
./reader 6.22 100
./reader 6.23 100
./reader 6.24 100
./reader 6.25 100
./reader 6.26 100
./reader 6.27 100
./reader 6.28 100
./reader 6.29 100
./reader 6.30 100
./reader 6.31 100
./reader 6.32 100
./reader 6.33 100
./reader 6.34 100
./reader 6.35 100
./reader 6.36 100
./reader 6.37 100
./reader 6.38 100
./reader 6.39 100
./reader 6.40 100
./reader 6.41 100
./reader 6.42 100
./reader 6.43 100
./reader 6.44 100
./reader 6.45 100
./reader 6.46 100
./reader 6.47 100
./reader 6.48 100
./reader 6.49 100
./reader 6.50 100
./reader 6.51 100
./reader 6.52 100
./reader 6.53 100
./reader 6.54 100
./reader 6.55 100
./reader 6.56 100
./reader 6.57 100
./reader 6.58 100
./reader 6.59 100
./reader 6.60 100
./reader 6.61 100
./reader 6.62 100
./reader 6.63 100
./reader 6.64 100
./reader 6.65 100
./reader 6.66 100
./reader 6.67 100
./reader 6.68 100
./reader 6.69 100
./reader 6.70 100
./reader 6.71 100
./reader 6.72 100
./reader 6.73 100
./reader 6.74 100
./reader 6.75 100
./reader 6.76 100
./reader 6.77 100
./reader 6.78 100
./reader 6.79 100
./reader 6.80 100
./reader 6.81 100
./reader 6.82 100
./reader 6.83 100
./reader 6.84 100
./reader 6.85 100
./reader 6.86 100
./reader 6.87 100
./reader 6.88 100
./reader 6.89 100
./reader 6.90 100
./reader 6.91 100
./reader 6.92 100
./reader 6.93 100
./reader 6.94 100
./reader 6.95 100
./reader 6.96 100
./reader 6.97 100
./reader 6.98 100
./reader 6.99 100
./reader 7.00 100
./reader 7.01 100
./reader 7.02 100
./reader 7.03 100
./reader 7.04 100
./reader 7.05 100
./reader 7.06 100
./reader 7.07 100
./reader 7.08 100
./reader 7.09 100
./reader 7.10 100
./reader 7.11 100
./reader 7.12 100
./reader 7.13 100
./reader 7.14 100
./reader 7.15 100
./reader 7.16 100
./reader 7.17 100
./reader 7.18 100
./reader 7.19 100
./reader 7.20 100
./reader 7.21 100
./reader 7.22 100
./reader 7.23 100
./reader 7.24 100
./reader 7.25 100
./reader 7.26 100
./reader 7.27 100
./reader 7.28 100
./reader 7.29 100
./reader 7.30 100
./reader 7.31 100
./reader 7.32 100
./reader 7.33 100
./reader 7.34 100
./reader 7.35 100
./reader 7.36 100
./reader 7.37 100
./reader 7.38 100
./reader 7.39 100
./reader 7.40 100
./reader 7.41 100
./reader 7.42 100
./reader 7.43 100
./reader 7.44 100
./reader 7.45 100
./reader 7.46 100
./reader 7.47 100
./reader 7.48 100
./reader 7.49 100
./reader 7.50 100
./reader 7.51 100
./reader 7.52 100
./reader 7.53 100
./reader 7.54 100
./reader 7.55 100
./reader 7.56 100
./reader 7.57 100
./reader 7.58 100
./reader 7.59 100
./reader 7.60 100
./reader 7.61 100
./reader 7.62 100
./reader 7.63 100
./reader 7.64 100
./reader 7.65 100
./reader 7.66 100
./reader 7.67 100
./reader 7.68 100
./reader 7.69 100
./reader 7.70 100
./reader 7.71 100
./reader 7.72 100
./reader 7.73 100
./reader 7.74 100
./reader 7.75 100
./reader 7.76 100
./reader 7.77 100
./reader 7.78 100
./reader 7.79 100
./reader 7.80 100
./reader 7.81 100
./reader 7.82 100
./reader 7.83 100
./reader 7.84 100
./reader 7.85 100
./reader 7.86 100
./reader 7.87 100
./reader 7.88 100
./reader 7.89 100
./reader 7.90 100
./reader 7.91 100
./reader 7.92 100
./reader 7.93 100
./reader 7.94 100
./reader 7.95 100
./reader 7.96 100
./reader 7.97 100
./reader 7.98 100
./reader 7.99 100
./reader 8.00 100
./reader 8.01 100
./reader 8.02 100
./reader 8.03 100
./reader 8.04 100
./reader 8.05 100
./reader 8.06 100
./reader 8.07 100
./reader 8.08 100
./reader 8.09 100
./reader 8.10 100
./reader 8.11 100
./reader 8.12 100
./reader 8.13 100
./reader 8.14 100
./reader 8.15 100
./reader 8.16 100
./reader 8.17 100
./reader 8.18 100
./reader 8.19 100
./reader 8.20 100
./reader 8.21 100
./reader 8.22 100
./reader 8.23 100
./reader 8.24 100
./reader 8.25 100
./reader 8.26 100
./reader 8.27 100
./reader 8.28 100
./reader 8.29 100
./reader 8.30 100
./reader 8.31 100
./reader 8.32 100
./reader 8.33 100
./reader 8.34 100
./reader 8.35 100
./reader 8.36 100
./reader 8.37 100
./reader 8.38 100
./reader 8.39 100
./reader 8.40 100
./reader 8.41 100
./reader 8.42 100
./reader 8.43 100
./reader 8.44 100
./reader 8.45 100
./reader 8.46 100
./reader 8.47 100
./reader 8.48 100
./reader 8.49 100
./reader 8.50 100
./reader 8.51 100
./reader 8.52 100
./reader 8.53 100
./reader 8.54 100
./reader 8.55 100
./reader 8.56 100
./reader 8.57 100
./reader 8.58 100
./reader 8.59 100
./reader 8.60 100
./reader 8.61 100
./reader 8.62 100
./reader 8.63 100
./reader 8.64 100
./reader 8.65 100
./reader 8.66 100
./reader 8.67 100
./reader 8.68 100
./reader 8.69 100
./reader 8.70 100
./reader 8.71 100
./reader 8.72 100
./reader 8.73 100
./reader 8.74 100
./reader 8.75 100
./reader 8.76 100
./reader 8.77 100
./reader 8.78 100
./reader 8.79 100
./reader 8.80 100
./reader 8.81 100
./reader 8.82 100
./reader 8.83 100
./reader 8.84 100
./reader 8.85 100
./reader 8.86 100
./reader 8.87 100
./reader 8.88 100
./reader 8.89 100
./reader 8.90 100
./reader 8.91 100
./reader 8.92 100
./reader 8.93 100
./reader 8.94 100
./reader 8.95 100
./reader 8.96 100
./reader 8.97 100
./reader 8.98 100
./reader 8.99 100
./reader 9.00 100
./reader 9.01 100
./reader 9.02 100
./reader 9.03 100
./reader 9.04 100
./reader 9.05 100
./reader 9.06 100
./reader 9.07 100
./reader 9.08 100
./reader 9.09 100
./reader 9.10 100
./reader 9.11 100
./reader 9.12 100
./reader 9.13 100
./reader 9.14 100
./reader 9.15 100
./reader 9.16 100
./reader 9.17 100
./reader 9.18 100
./reader 9.19 100
./reader 9.20 100
./reader 9.21 100
./reader 9.22 100
./reader 9.23 100
./reader 9.24 100
./reader 9.25 100
./reader 9.26 100
./reader 9.27 100
./reader 9.28 100
./reader 9.29 100
./reader 9.30 100
./reader 9.31 100
./reader 9.32 100
./reader 9.33 100
./reader 9.34 100
./reader 9.35 100
./reader 9.36 100
./reader 9.37 100
./reader 9.38 100
./reader 9.39 100
./reader 9.40 100
./reader 9.41 100
./reader 9.42 100
./reader 9.43 100
./reader 9.44 100
./reader 9.45 100
./reader 9.46 100
./reader 9.47 100
./reader 9.48 100
./reader 9.49 100
./reader 9.50 100
./reader 9.51 100
./reader 9.52 100
./reader 9.53 100
./reader 9.54 100
./reader 9.55 100
./reader 9.56 100
./reader 9.57 100
./reader 9.58 100
./reader 9.59 100
./reader 9.60 100
./reader 9.61 100
./reader 9.62 100
./reader 9.63 100
./reader 9.64 100
./reader 9.65 100
./reader 9.66 100
./reader 9.67 100
./reader 9.68 100
./reader 9.69 100
./reader 9.70 100
./reader 9.71 100
./reader 9.72 100
./reader 9.73 100
./reader 9.74 100
./reader 9.75 100
./reader 9.76 100
./reader 9.77 100
./reader 9.78 100
./reader 9.79 100
./reader 9.80 100
./reader 9.81 100
./reader 9.82 100
./reader 9.83 100
./reader 9.84 100
./reader 9.85 100
./reader 9.86 100
./reader 9.87 100
./reader 9.88 100
./reader 9.89 100
./reader 9.90 100
./reader 9.91 100
./reader 9.92 100
./reader 9.93 100
./reader 9.94 100
./reader 9.95 100
./reader 9.96 100
./reader 9.97 100
./reader 9.98 100
./reader 9.99 100
./reader 10.00 100


================================================
FILE: c/reader.c
================================================
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <libhackrf/hackrf.h>

const uint64_t NRF_SAMPLES_LENGTH = 262144;
uint64_t BUFFER_SIZE = 0;
uint64_t FREQUENCY = 1e6;
const uint32_t SAMPLE_RATE = 5e6;
uint8_t *buffer;
long buffer_pos = 0;

int skip = 10;

#define CHECK_STATUS(status, message) \
    if (status != 0) { \
        printf("FAIL: %s\n", message); \
        hackrf_close(device); \
        hackrf_exit(); \
        exit(EXIT_FAILURE); \
    } \

int receive_sample_block(hackrf_transfer *transfer) {
    if (skip > 0) {
        printf("skip: %d\n", skip);
        skip--;
        return 0;
    }
    printf("block length: %d index: %d\n", transfer->valid_length, (int)(buffer_pos / (double) NRF_SAMPLES_LENGTH));
    for (int i = 0; i < transfer->valid_length; i++) {
        if (buffer_pos < BUFFER_SIZE) {
            buffer[buffer_pos++] = transfer->buffer[i];
        }
    }
    if (buffer_pos >= BUFFER_SIZE) {
        char fname[100];
        snprintf(fname, 100, "../rfdata/rf-%.3f.raw", FREQUENCY / 1.0e6);
        FILE *fp = fopen(fname, "wb");
        if (fp) {
            fwrite(buffer, BUFFER_SIZE, 1, fp);
            fclose(fp);
            printf("Written %s.\n", fname);
            exit(0);
        }
    }
    return 0;
}

void usage() {
    printf("reader freq_mhz count\n");
}

int main(int argc, char **argv) {
    if (argc != 3) {
        usage();
        exit(1);
    }
    double freq_mhz = atof(argv[1]);
    FREQUENCY = freq_mhz * 1e6;
    int count = atoi(argv[2]);
    BUFFER_SIZE = NRF_SAMPLES_LENGTH * count;
    buffer = calloc(BUFFER_SIZE, 1);

    int status;
    hackrf_device *device;

    status = hackrf_init();
    CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, FREQUENCY);
    CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, SAMPLE_RATE);
    CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 34);
    CHECK_STATUS(status, "hackrf_set_vga_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    CHECK_STATUS(status, "hackrf_start_rx");

    while (buffer_pos < BUFFER_SIZE) {
        sleep(1);
    }

    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
    return 0;
}


================================================
FILE: c/render-text.c
================================================
#include <math.h>

#define STB_TRUETYPE_IMPLEMENTATION
#include "../externals/stb/stb_truetype.h"

#include "easypng.h"

const char* font_file = "../fonts/Roboto-Bold.ttf";

int imax(const int a, const int b) {
    return a > b ? a : b;
}

void measure_text(const stbtt_fontinfo *font, const char *text, int x, int y, int font_size, int *width, int *height) {
    float font_scale = stbtt_ScaleForPixelHeight(font, font_size);
    int ascent, descent;
    stbtt_GetFontVMetrics(font, &ascent, &descent, 0);
    int baseline = (int) (ascent * font_scale);
    int descent_scaled = (int) (descent * font_scale);
    printf("Baseline %d descent %d\n", baseline, descent_scaled);

    *width = x;
    // The glyph height is constant for the font.
    // Descent_scaled is negative.
    *height = y + (baseline - descent_scaled);

    int ch = 0;
    while (text[ch]) {
        int x0, y0, x1, y1;
        int advance, lsb;
        char c = text[ch];
        stbtt_GetCodepointBitmapBox(font, c, font_scale, font_scale, &x0, &y0, &x1, &y1);
        stbtt_GetCodepointHMetrics(font, c, &advance, &lsb);
        int glyph_width = advance * font_scale;
        *width += glyph_width;
        if (text[ch + 1]) {
            *width += font_scale * stbtt_GetCodepointKernAdvance(font, c, text[ch + 1]);
        }
        ch++;
    }
}

// FIXME compose using alpha lookup
void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t dst_stride, uint32_t src_stride) {
    for (uint32_t i = 0; i < height; i++) {
        for (uint32_t j = 0; j < width; j++) {
            dst[(dst_y + i) * dst_stride + dst_x + j] = src[(src_y + i) * src_stride + src_x + j];
        }
    }
}

int main() {
    FILE *fp = fopen(font_file, "rb");
    fseek(fp, 0L, SEEK_END);
    long size = ftell(fp);
    rewind(fp);
    uint8_t *font_buffer = calloc(size, 1);
    fread(font_buffer, size, 1, fp);
    fclose(fp);
    printf("Font file size %ld\n", size);

    stbtt_fontinfo font;
    printf("Offset: %d\n", stbtt_GetFontOffsetForIndex(font_buffer, 0));
    stbtt_InitFont(&font, font_buffer, stbtt_GetFontOffsetForIndex(font_buffer, 0));

    const char *text = "Hello, World!";
    int font_size = 300;
    float font_scale = stbtt_ScaleForPixelHeight(&font, font_size);
    int text_width, text_height;
    measure_text(&font, text, 0, 0, font_size, &text_width, &text_height);
    printf("Text W: %d H: %d\n", text_width, text_height);

    int ascent;
    stbtt_GetFontVMetrics(&font, &ascent, 0, 0);
    int baseline = (int) (ascent * font_scale);


    // Make full image
    uint8_t *image_buffer = calloc(text_width * text_height, 1);
    int ch = 0;
    int x = 0;
    while (text[ch]) {
        int w, h, dx, dy;
        int advance, lsb;
        char c = text[ch];
        stbtt_GetCodepointHMetrics(&font, c, &advance, &lsb);
        uint8_t *glyph_bitmap = stbtt_GetCodepointBitmap(&font, font_scale, font_scale, c, &w, &h, &dx, &dy);
        printf("Offset %d %d\n", dx, baseline + dy);
        img_gray_copy(image_buffer, glyph_bitmap, x + dx, baseline + dy, 0, 0, w, h, text_width, w);
        //x += w;
        x += (advance * font_scale);

        if (text[ch + 1]) {
            x += font_scale * stbtt_GetCodepointKernAdvance(&font, c, text[ch + 1]);
        }

        ch++;
    }

    //draw_text(&font, "Hi!", 0, 0)
    write_gray_png("_text.png", text_width, text_height, image_buffer);







    // float font_scale = stbtt_ScaleForPixelHeight(&font, font_size);
    // int ascent;
    // stbtt_GetFontVMetrics(&font, &ascent, 0, 0);
    // printf("Sclae %.2f Ascent %d\n", font_scale, ascent);
    // //int baseline = (int) (ascent * font_scale);
    // int x_pos = 2; // Pad a little bit.


    // const char *text = "&";
    // int ch = 0;
    // while (text[ch]) {
    //     int advance, lsb;
    //     //float x_shift = x_pos - (float) floor(x_pos);
    //     char c = text[ch];
    //     stbtt_GetCodepointHMetrics(&font, c, &advance, &lsb);
    //     //stbtt_GetCodepointBitmapBoxSubpixel(&font, c, font_scale, font_scale, x_shift, 0, &x0, &y0, &x1, &y1);
    //     int w, h;
    //     unsigned char *bitmap = stbtt_GetCodepointBitmap(&font, 0, font_scale, c, &w, &h, 0, 0);
    //     printf("Width %d Height %d\n", w, h);
    //     write_gray_png("_text.png", w, h, bitmap);

    //     //sbtt_MakeCodepointBitmap(&font, );
    //     x_pos += (advance * font_scale);
    //     if (text[ch + 1]) {
    //         x_pos += font_scale * stbtt_GetCodepointKernAdvance(&font, text[ch], text[ch + 1]);
    //     }
    //     ch++;
    // }


    return 0;
}


================================================
FILE: c/rfcap.c
================================================
// Capture n samples of a frequency range.

#include <libhackrf/hackrf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

const int SAMPLE_SIZE=512*512;

double current_freq = 0;
int n_samples = 0;

hackrf_device *device;
int receive_count = 0;
uint8_t buffer[SAMPLE_SIZE];

#define HACKRF_CHECK_STATUS(status, message) \
    if (status != 0) { \
        printf("FAIL: %s\n", message); \
        hackrf_close(device); \
        hackrf_exit(); \
        exit(EXIT_FAILURE); \
    } \

void export_buffer(uint8_t *buffer) {
    char fname[100];
    snprintf(fname, 100, "export/rf-%.3f-%d.raw", current_freq, receive_count + 1);
    printf("%s\n", fname);
    FILE *write_ptr = fopen(fname, "wb");
    fwrite(buffer, SAMPLE_SIZE, 1, write_ptr);
    fclose(write_ptr);
}


int receive_sample_block(hackrf_transfer *transfer) {
    memcpy(buffer, transfer->buffer, SAMPLE_SIZE);
    export_buffer(buffer);
    receive_count += 1;
    return 0;
}

int main(int argc, char **argv) {
    int status;

    if (argc != 3) {
        printf("Usage: rfcap FREQ N_SAMPLES\n");
        exit(EXIT_FAILURE);
    }

    current_freq = atof(argv[1]);
    n_samples = atoi(argv[2]);

    status = hackrf_init();
    HACKRF_CHECK_STATUS(status, "hackrf_init");

    status = hackrf_open(&device);
    HACKRF_CHECK_STATUS(status, "hackrf_open");

    status = hackrf_set_freq(device, current_freq * 1e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_freq");

    status = hackrf_set_sample_rate(device, 10e6);
    HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate");

    status = hackrf_set_amp_enable(device, 0);
    HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable");

    status = hackrf_set_lna_gain(device, 32);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_set_vga_gain(device, 30);
    HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain");

    status = hackrf_start_rx(device, receive_sample_block, NULL);
    HACKRF_CHECK_STATUS(status, "hackrf_start_rx");

    while (receive_count < n_samples) {
        usleep(100);
    }

    hackrf_stop_rx(device);
    hackrf_close(device);
    hackrf_exit();
    return 0;
}


================================================
FILE: c/sender.c
================================================
#include <libhackrf/hackrf.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int send_sample_block(hackrf_transfer *transfer) {
    arc4random_buf(transfer->buffer, transfer->buffer_length);
    printf("block length: %d\n", transfer->valid_length);
    return 0;
}

int main(int argc, char **argv) {
    int status;
    status = hackrf_init();
    if (status != 0) {
        printf("FAIL: hackrf_init\n");
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    hackrf_device *device;
    status = hackrf_open(&device);
    if (status != 0) {
        printf("FAIL: hackrf_open\n");
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_freq(device, 100.9e6);
    if (status != 0) {
        printf("FAIL: hackrf_set_freq: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_amp_enable(device, 1);
    if (status != 0) {
        printf("FAIL: hackrf_set_amp_enable: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_lna_gain(device, 40);
    if (status != 0) {
        printf("FAIL: hackrf_set_lna_gain: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_vga_gain(device, 62);
    if (status != 0) {
        printf("FAIL: hackrf_set_vga_gain: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_txvga_gain(device, 47);
    if (status != 0) {
        printf("FAIL: hackrf_set_txvga_gain: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_start_tx(device, send_sample_block, NULL);
    if (status != 0) {
        printf("FAIL: hackrf_start_rx: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    sleep(3);

    hackrf_stop_tx(device);
    hackrf_close(device);
    hackrf_exit();
    return 0;
}


================================================
FILE: c/single-sample.c
================================================
// Slowly show a single sample, frame by frame. Used for exporting to movie.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#include "easypng.h"

int SAMPLES_STEP = 100;
const int IQ_RESOLUTION = 256;
const int SIZE_MULTIPLIER = 4;
const int IMAGE_WIDTH = 1920;
const int IMAGE_HEIGHT = 1080;
const int IQ_WIDTH = IQ_RESOLUTION * SIZE_MULTIPLIER;
const int IQ_HEIGHT = IQ_RESOLUTION * SIZE_MULTIPLIER;
const int IMAGE_OFFSET_X = (IMAGE_WIDTH - IQ_WIDTH) / 2;
const int IMAGE_OFFSET_Y = (IMAGE_HEIGHT - IQ_HEIGHT) / 2;
int PIXEL_INC = 4;
int FADE_PER_FRAME = 0;
int PREVIEW_MODE = 0;

static inline uint8_t clamp_u8(int v, uint8_t min, uint8_t max) {
    return (uint8_t) (v < min ? min : v > max ? max : v);
}

void pixel_put(uint8_t *image_buffer, int x, int y, int color) {
    int offset = y * IQ_WIDTH + x;
    image_buffer[offset] = color;
}

void pixel_inc(uint8_t *image_buffer, int x, int y) {
    static int have_warned = 0;
    // Avoid white borders.
    if (x == 0 || y == 0 || x == IMAGE_WIDTH - 1 || y == IMAGE_HEIGHT - 1) {
        return;
    }
    int offset = ((y + IMAGE_OFFSET_Y) * IMAGE_WIDTH) + (x + IMAGE_OFFSET_X);
    int v = image_buffer[offset];
    if (v + PIXEL_INC >= 255) {
        if (!have_warned) {
            fprintf(stderr, "WARN: pixel value out of range (%d, %d)\n", x, y);
            have_warned = 1;
        }
    } else {
        v += PIXEL_INC;
        image_buffer[offset] = v;
    }
}

void draw_line(uint8_t *image_buffer, int x1, int y1, int x2, int y2, int color) {
  int dx = abs(x2 - x1);
  int sx = x1 < x2 ? 1 : -1;
  int dy = abs(y2-y1);
  int sy = y1 < y2 ? 1 : -1;
  int err = (dx > dy ? dx : -dy) / 2;
  int e2;

  for(;;){
    pixel_inc(image_buffer, x1, y1);
    if (x1 == x2 && y1 == y2) break;
    e2 = err;
    if (e2 > -dx) { err -= dy; x1 += sx; }
    if (e2 <  dy) { err += dx; y1 += sy; }
  }
}

void write_image(uint8_t *image_buffer, int fname_index) {
    char fname[100];
    snprintf(fname, 100, "_export/sample-%d.png", fname_index);
    write_gray_png(fname, IMAGE_WIDTH, IMAGE_HEIGHT, image_buffer);
}

void usage() {
    printf("single-sample [-p pixel_inc] [-s samples_per_frame] [-f fade_per_frame] [-v (preview)] rfdata.raw\n");
}

int main(int argc, char **argv) {
    char *sample_fname;
    char ch;
    while ((ch = getopt(argc, argv, "p:s:f:v")) != -1) {
        switch (ch) {
            case 'p':
                PIXEL_INC = atoi(optarg);
                break;
            case 's':
                SAMPLES_STEP = atoi(optarg);
                break;
            case 'f':
                FADE_PER_FRAME = atoi(optarg);
                break;
            case 'v':
                PREVIEW_MODE = 1;
                break;
            case '?':
            default:
                usage();
                exit(1);
        }
    }
    argc -= optind;
    argv += optind;
    if (argc != 1) {
        usage();
        exit(1);
    }
    sample_fname = argv[0];
    FILE *fp = fopen(sample_fname, "r");
    assert(fp != NULL);
    fseek(fp, 0L, SEEK_END);
    long size = ftell(fp);
    rewind(fp);
    uint8_t *sample_buffer = calloc(size, sizeof(uint8_t));
    fread(sample_buffer, size, 1, fp);
    fclose(fp);

    uint8_t *image_buffer = calloc(IMAGE_WIDTH * IMAGE_HEIGHT, sizeof(uint8_t));
    printf("Size: %ld\n", size);

    int x1 = 0;
    int y1 = 0;

    int fname_index = 1;
    for (int j = 0; j < size; j += SAMPLES_STEP) {
        if (FADE_PER_FRAME > 0) {
            for (int i = 0; i < IMAGE_WIDTH * IMAGE_HEIGHT; ++i) {
                int v = image_buffer[i];
                v -= FADE_PER_FRAME;
                v = clamp_u8(v, 0, 255);
                image_buffer[i] = v;
            }
        }

        for (int i = 0; i < SAMPLES_STEP; i += 2) {
            int x2 = (sample_buffer[j + i] + 128) % 256;
            int y2 = (sample_buffer[j + i + 1] + 128) % 256;
            if (i > 0) {
                draw_line(image_buffer, x1 * SIZE_MULTIPLIER, y1 * SIZE_MULTIPLIER, x2 * SIZE_MULTIPLIER, y2 * SIZE_MULTIPLIER, 0);
            }
            x1 = x2;
            y1 = y2;
        }
        if (!PREVIEW_MODE) {
            write_image(image_buffer, fname_index);
        }
        fname_index++;
    }
    if (PREVIEW_MODE) {
        write_image(image_buffer, fname_index);
    }

    return 0;
}


================================================
FILE: c/tv-sender.c
================================================
#include <libhackrf/hackrf.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#define STB_IMAGE_IMPLEMENTATION
#include "../externals/stb/stb_image.h"

uint8_t *image_data;

const int freq = 49e6;

int send_sample_block(hackrf_transfer *transfer) {
    //printf(".\n");
    //arc4random_buf(transfer->buffer, transfer->buffer_length);
    memset(transfer->buffer, 0, transfer->buffer_length);

    //memcpy(transfer->buffer, image_data, transfer->buffer_length);

    int v = 0;
    for (int i = 0; i < transfer->buffer_length; i += 2) {
        int px = image_data[v];
        int vi = 255-px ;
        int vq = 255-px ;
        //printf("%d %d %d\n", px, vi, vq);
        transfer->buffer[i] = vi;
        transfer->buffer[i + 1] = vq;
        v+= 3;
    }
    //printf("%d\n", v);
    //     //double vi = i;
    //     //vi /= (double) transfer->buffer_length;
    //     //vi *= 255;
    //     //vi *= M_PI * 2;
    //     //vi = sin(vi);
    //     //vi = abs(vi) * 255;
    //     //printf("%d\n", transfer->buffer[i]);
    //     //transfer->buffer[i] = 0;
    //     transfer->buffer[i+1] = 255;
    //     transfer->buffer[i+2] = 128;
    //     transfer->buffer[i+3] = 0;
    // }
    //printf("block length: %d\n", transfer->valid_length);
    return 0;
}


int main(int argc, char **argv) {
    int width, height, channels;
    image_data  = stbi_load("../img/lenna-tv.jpg", &width, &height, &channels, 3);
    printf("width %d height %d channels %d\n", width, height, channels);

    int status;
    status = hackrf_init();
    if (status != 0) {
        printf("FAIL: hackrf_init\n");
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    hackrf_device *device;
    status = hackrf_open(&device);
    if (status != 0) {
        printf("FAIL: hackrf_open\n");
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_freq(device, freq);
    if (status != 0) {
        printf("FAIL: hackrf_set_freq: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_sample_rate(device, 6e6);
    if (status != 0) {
        printf("FAIL: hackrf_set_sample_rate: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    status = hackrf_set_amp_enable(device, 1);
    if (status != 0) {
        printf("FAIL: hackrf_set_amp_enable: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    // // status = hackrf_set_lna_gain(device, 40);
    // // if (status != 0) {
    // //     printf("FAIL: hackrf_set_lna_gain: %d\n", status);
    // //     hackrf_close(device);
    // //     hackrf_exit();
    // //     exit(EXIT_FAILURE);
    // // }

    // // status = hackrf_set_vga_gain(device, 62);
    // // if (status != 0) {
    // //     printf("FAIL: hackrf_set_vga_gain: %d\n", status);
    // //     hackrf_close(device);
    // //     hackrf_exit();
    // //     exit(EXIT_FAILURE);
    // // }

    // status = hackrf_set_txvga_gain(device, 47);
    // if (status != 0) {
    //     printf("FAIL: hackrf_set_txvga_gain: %d\n", status);
    //     hackrf_close(device);
    //     hackrf_exit();
    //     exit(EXIT_FAILURE);
    // }

    status = hackrf_start_tx(device, send_sample_block, NULL);
    if (status != 0) {
        printf("FAIL: hackrf_start_rx: %d\n", status);
        hackrf_close(device);
        hackrf_exit();
        exit(EXIT_FAILURE);
    }

    for (int i = 170.6e6; i < 230e6; i += 0.001e6) {
        printf("Freq %d\n", i);
        status = hackrf_set_freq(device, i);

        sleep(1);
    }
    //sleep(9999);

    hackrf_stop_tx(device);
    hackrf_close(device);
    hackrf_exit();
    return 0;
}


================================================
FILE: c/vis.c
================================================
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
#include <libhackrf/hackrf.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <png.h>

#define WIDTH 512
#define HEIGHT 512

GLFWwindow* window;
GLuint texture_id;
GLuint program;
uint8_t buffer[512 * 512];
hackrf_device *device;
double freq_mhz = 1.05;
Download .txt
gitextract_qzmky3ty/

├── .gitignore
├── API.md
├── AUTHORS
├── CMakeLists.txt
├── LICENSE
├── NOTES
├── README.md
├── c/
│   ├── Makefile
│   ├── README.md
│   ├── _export/
│   │   └── .gitkeep
│   ├── add-all-markers.sh
│   ├── add-markers.c
│   ├── batch.c
│   ├── demod-fm-streaming.c
│   ├── demod-fm.c
│   ├── easypng.h
│   ├── fft-batch-broad.c
│   ├── fft-batch.c
│   ├── fft-stitch-broad.c
│   ├── fft-stitch.c
│   ├── fft.c
│   ├── gradual-noise.c
│   ├── gridvis.c
│   ├── iq-lines.c
│   ├── iqvis-rtl.c
│   ├── iqvis.c
│   ├── osc-server.c
│   ├── piqvis.c
│   ├── play.c
│   ├── reader-all.sh
│   ├── reader.c
│   ├── render-text.c
│   ├── rfcap.c
│   ├── sender.c
│   ├── single-sample.c
│   ├── tv-sender.c
│   └── vis.c
├── data-wrangling/
│   ├── bipt_freqs.csv
│   └── csv2lua.py
├── externals/
│   ├── lua/
│   │   ├── CMakeLists.txt
│   │   └── src/
│   │       ├── Makefile
│   │       ├── lapi.c
│   │       ├── lapi.h
│   │       ├── lauxlib.c
│   │       ├── lauxlib.h
│   │       ├── lbaselib.c
│   │       ├── lbitlib.c
│   │       ├── lcode.c
│   │       ├── lcode.h
│   │       ├── lcorolib.c
│   │       ├── lctype.c
│   │       ├── lctype.h
│   │       ├── ldblib.c
│   │       ├── ldebug.c
│   │       ├── ldebug.h
│   │       ├── ldo.c
│   │       ├── ldo.h
│   │       ├── ldump.c
│   │       ├── lfunc.c
│   │       ├── lfunc.h
│   │       ├── lgc.c
│   │       ├── lgc.h
│   │       ├── linit.c
│   │       ├── liolib.c
│   │       ├── llex.c
│   │       ├── llex.h
│   │       ├── llimits.h
│   │       ├── lmathlib.c
│   │       ├── lmem.c
│   │       ├── lmem.h
│   │       ├── loadlib.c
│   │       ├── lobject.c
│   │       ├── lobject.h
│   │       ├── lopcodes.c
│   │       ├── lopcodes.h
│   │       ├── loslib.c
│   │       ├── lparser.c
│   │       ├── lparser.h
│   │       ├── lprefix.h
│   │       ├── lstate.c
│   │       ├── lstate.h
│   │       ├── lstring.c
│   │       ├── lstring.h
│   │       ├── lstrlib.c
│   │       ├── ltable.c
│   │       ├── ltable.h
│   │       ├── ltablib.c
│   │       ├── ltm.c
│   │       ├── ltm.h
│   │       ├── lua.c
│   │       ├── lua.h
│   │       ├── lua.hpp
│   │       ├── luac.c
│   │       ├── luaconf.h
│   │       ├── lualib.h
│   │       ├── lundump.c
│   │       ├── lundump.h
│   │       ├── lutf8lib.c
│   │       ├── lvm.c
│   │       ├── lvm.h
│   │       ├── lzio.c
│   │       └── lzio.h
│   ├── ovr/
│   │   ├── Include/
│   │   │   ├── OVR.h
│   │   │   ├── OVR_Kernel.h
│   │   │   └── OVR_Version.h
│   │   ├── Lib/
│   │   │   └── Mac/
│   │   │       ├── Debug/
│   │   │       │   └── libovr.a
│   │   │       └── Release/
│   │   │           └── libovr.a
│   │   └── Src/
│   │       ├── CAPI/
│   │       │   ├── CAPI_DistortionRenderer.cpp
│   │       │   ├── CAPI_DistortionRenderer.h
│   │       │   ├── CAPI_FrameTimeManager.cpp
│   │       │   ├── CAPI_FrameTimeManager.h
│   │       │   ├── CAPI_HMDRenderState.cpp
│   │       │   ├── CAPI_HMDRenderState.h
│   │       │   ├── CAPI_HMDState.cpp
│   │       │   ├── CAPI_HMDState.h
│   │       │   ├── CAPI_HSWDisplay.cpp
│   │       │   ├── CAPI_HSWDisplay.h
│   │       │   ├── CAPI_LatencyStatistics.cpp
│   │       │   ├── CAPI_LatencyStatistics.h
│   │       │   ├── GL/
│   │       │   │   ├── CAPI_GLE.cpp
│   │       │   │   ├── CAPI_GLE.h
│   │       │   │   ├── CAPI_GLE_GL.h
│   │       │   │   ├── CAPI_GL_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_GL_DistortionRenderer.h
│   │       │   │   ├── CAPI_GL_DistortionShaders.h
│   │       │   │   ├── CAPI_GL_HSWDisplay.cpp
│   │       │   │   ├── CAPI_GL_HSWDisplay.h
│   │       │   │   ├── CAPI_GL_Util.cpp
│   │       │   │   └── CAPI_GL_Util.h
│   │       │   └── Textures/
│   │       │       └── healthAndSafety.tga.h
│   │       ├── Displays/
│   │       │   ├── OVR_Display.cpp
│   │       │   ├── OVR_Display.h
│   │       │   ├── OVR_OSX_Display.cpp
│   │       │   ├── OVR_OSX_Display.h
│   │       │   ├── OVR_OSX_FocusObserver.h
│   │       │   ├── OVR_OSX_FocusObserver.mm
│   │       │   ├── OVR_OSX_FocusReader.h
│   │       │   └── OVR_OSX_FocusReader.mm
│   │       ├── Kernel/
│   │       │   ├── OVR_Alg.cpp
│   │       │   ├── OVR_Alg.h
│   │       │   ├── OVR_Allocator.cpp
│   │       │   ├── OVR_Allocator.h
│   │       │   ├── OVR_Array.h
│   │       │   ├── OVR_Atomic.cpp
│   │       │   ├── OVR_Atomic.h
│   │       │   ├── OVR_CRC32.cpp
│   │       │   ├── OVR_CRC32.h
│   │       │   ├── OVR_Color.h
│   │       │   ├── OVR_Compiler.h
│   │       │   ├── OVR_ContainerAllocator.h
│   │       │   ├── OVR_DebugHelp.cpp
│   │       │   ├── OVR_DebugHelp.h
│   │       │   ├── OVR_Delegates.h
│   │       │   ├── OVR_Deque.h
│   │       │   ├── OVR_File.cpp
│   │       │   ├── OVR_File.h
│   │       │   ├── OVR_FileFILE.cpp
│   │       │   ├── OVR_Hash.h
│   │       │   ├── OVR_KeyCodes.h
│   │       │   ├── OVR_List.h
│   │       │   ├── OVR_Lockless.cpp
│   │       │   ├── OVR_Lockless.h
│   │       │   ├── OVR_Log.cpp
│   │       │   ├── OVR_Log.h
│   │       │   ├── OVR_Math.cpp
│   │       │   ├── OVR_Math.h
│   │       │   ├── OVR_Nullptr.h
│   │       │   ├── OVR_Observer.h
│   │       │   ├── OVR_RefCount.cpp
│   │       │   ├── OVR_RefCount.h
│   │       │   ├── OVR_SharedMemory.cpp
│   │       │   ├── OVR_SharedMemory.h
│   │       │   ├── OVR_Std.cpp
│   │       │   ├── OVR_Std.h
│   │       │   ├── OVR_String.cpp
│   │       │   ├── OVR_String.h
│   │       │   ├── OVR_StringHash.h
│   │       │   ├── OVR_String_FormatUtil.cpp
│   │       │   ├── OVR_String_PathUtil.cpp
│   │       │   ├── OVR_SysFile.cpp
│   │       │   ├── OVR_SysFile.h
│   │       │   ├── OVR_System.cpp
│   │       │   ├── OVR_System.h
│   │       │   ├── OVR_ThreadCommandQueue.cpp
│   │       │   ├── OVR_ThreadCommandQueue.h
│   │       │   ├── OVR_Threads.h
│   │       │   ├── OVR_ThreadsPthread.cpp
│   │       │   ├── OVR_Timer.cpp
│   │       │   ├── OVR_Timer.h
│   │       │   ├── OVR_Types.h
│   │       │   ├── OVR_UTF8Util.cpp
│   │       │   ├── OVR_UTF8Util.h
│   │       │   ├── OVR_mach_exc_OSX.c
│   │       │   └── OVR_mach_exc_OSX.h
│   │       ├── Net/
│   │       │   ├── OVR_BitStream.cpp
│   │       │   ├── OVR_BitStream.h
│   │       │   ├── OVR_MessageIDTypes.h
│   │       │   ├── OVR_NetworkPlugin.cpp
│   │       │   ├── OVR_NetworkPlugin.h
│   │       │   ├── OVR_NetworkTypes.h
│   │       │   ├── OVR_PacketizedTCPSocket.cpp
│   │       │   ├── OVR_PacketizedTCPSocket.h
│   │       │   ├── OVR_RPC1.cpp
│   │       │   ├── OVR_RPC1.h
│   │       │   ├── OVR_Session.cpp
│   │       │   ├── OVR_Session.h
│   │       │   ├── OVR_Socket.cpp
│   │       │   ├── OVR_Socket.h
│   │       │   ├── OVR_Unix_Socket.cpp
│   │       │   └── OVR_Unix_Socket.h
│   │       ├── OVR_CAPI.cpp
│   │       ├── OVR_CAPI.h
│   │       ├── OVR_CAPI_GL.h
│   │       ├── OVR_CAPI_Keys.h
│   │       ├── OVR_JSON.cpp
│   │       ├── OVR_JSON.h
│   │       ├── OVR_Profile.cpp
│   │       ├── OVR_Profile.h
│   │       ├── OVR_SerialFormat.cpp
│   │       ├── OVR_SerialFormat.h
│   │       ├── OVR_Stereo.cpp
│   │       ├── OVR_Stereo.h
│   │       ├── Sensors/
│   │       │   └── OVR_DeviceConstants.h
│   │       ├── Service/
│   │       │   ├── Service_NetClient.cpp
│   │       │   ├── Service_NetClient.h
│   │       │   ├── Service_NetSessionCommon.cpp
│   │       │   └── Service_NetSessionCommon.h
│   │       ├── Tracking/
│   │       │   ├── Tracking_PoseState.h
│   │       │   ├── Tracking_SensorState.h
│   │       │   ├── Tracking_SensorStateReader.cpp
│   │       │   └── Tracking_SensorStateReader.h
│   │       └── Util/
│   │           ├── Util_ImageWindow.cpp
│   │           ├── Util_ImageWindow.h
│   │           ├── Util_Interface.cpp
│   │           ├── Util_Interface.h
│   │           ├── Util_LatencyTest2Reader.cpp
│   │           ├── Util_LatencyTest2Reader.h
│   │           ├── Util_LatencyTest2State.h
│   │           ├── Util_Render_Stereo.cpp
│   │           ├── Util_Render_Stereo.h
│   │           ├── Util_SystemGUI.cpp
│   │           ├── Util_SystemGUI.h
│   │           ├── Util_SystemGUI_OSX.mm
│   │           ├── Util_SystemInfo.cpp
│   │           ├── Util_SystemInfo.h
│   │           └── Util_SystemInfo_OSX.mm
│   ├── ovr-0.5.0.1/
│   │   └── Src/
│   │       ├── CAPI/
│   │       │   ├── CAPI_DistortionRenderer.cpp
│   │       │   ├── CAPI_DistortionRenderer.h
│   │       │   ├── CAPI_DistortionTiming.cpp
│   │       │   ├── CAPI_DistortionTiming.h
│   │       │   ├── CAPI_FrameLatencyTracker.cpp
│   │       │   ├── CAPI_FrameLatencyTracker.h
│   │       │   ├── CAPI_FrameTimeManager3.cpp
│   │       │   ├── CAPI_FrameTimeManager3.h
│   │       │   ├── CAPI_HMDRenderState.cpp
│   │       │   ├── CAPI_HMDRenderState.h
│   │       │   ├── CAPI_HMDState.cpp
│   │       │   ├── CAPI_HMDState.h
│   │       │   ├── CAPI_HSWDisplay.cpp
│   │       │   ├── CAPI_HSWDisplay.h
│   │       │   ├── D3D1X/
│   │       │   │   ├── CAPI_D3D11_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_D3D11_DistortionRenderer.h
│   │       │   │   ├── CAPI_D3D11_HSWDisplay.cpp
│   │       │   │   ├── CAPI_D3D11_HSWDisplay.h
│   │       │   │   ├── CAPI_D3D11_Util.cpp
│   │       │   │   ├── CAPI_D3D11_Util.h
│   │       │   │   └── Shaders/
│   │       │   │       ├── DistortionCS2x2.csh
│   │       │   │       ├── DistortionChroma_ps.psh
│   │       │   │       ├── DistortionChroma_vs.vsh
│   │       │   │       ├── DistortionTimewarpChroma_vs.vsh
│   │       │   │       ├── Distortion_ps.psh
│   │       │   │       ├── SimpleQuad_ps.psh
│   │       │   │       ├── SimpleQuad_vs.vsh
│   │       │   │       ├── SimpleTexturedQuad_ps.psh
│   │       │   │       ├── SimpleTexturedQuad_vs.vsh
│   │       │   │       ├── genComputeShaderHeader.bat
│   │       │   │       ├── genPixelShaderHeader.bat
│   │       │   │       └── genVertexShaderHeader.bat
│   │       │   ├── D3D9/
│   │       │   │   ├── CAPI_D3D9_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_D3D9_DistortionRenderer.h
│   │       │   │   ├── CAPI_D3D9_HSWDisplay.cpp
│   │       │   │   ├── CAPI_D3D9_HSWDisplay.h
│   │       │   │   └── CAPI_D3D9_Util.cpp
│   │       │   ├── GL/
│   │       │   │   ├── CAPI_GL_DistortionRenderer.cpp
│   │       │   │   ├── CAPI_GL_DistortionRenderer.h
│   │       │   │   ├── CAPI_GL_DistortionShaders.h
│   │       │   │   ├── CAPI_GL_HSWDisplay.cpp
│   │       │   │   ├── CAPI_GL_HSWDisplay.h
│   │       │   │   ├── CAPI_GL_Util.cpp
│   │       │   │   └── CAPI_GL_Util.h
│   │       │   └── Textures/
│   │       │       ├── healthAndSafety.tga
│   │       │       ├── healthAndSafety.tga.h
│   │       │       ├── overdriveLut_dk2.h
│   │       │       └── overdriveLut_dk2_2.h
│   │       ├── Displays/
│   │       │   ├── OVR_Display.cpp
│   │       │   ├── OVR_Display.h
│   │       │   ├── OVR_OSX_Display.cpp
│   │       │   ├── OVR_OSX_Display.h
│   │       │   ├── OVR_Win32_Display.cpp
│   │       │   ├── OVR_Win32_Display.h
│   │       │   ├── OVR_Win32_Dxgi_Display.h
│   │       │   ├── OVR_Win32_FocusReader.cpp
│   │       │   ├── OVR_Win32_FocusReader.h
│   │       │   ├── OVR_Win32_RenderShim.cpp
│   │       │   ├── OVR_Win32_ShimFunctions.cpp
│   │       │   ├── OVR_Win32_ShimFunctions.h
│   │       │   └── OVR_Win32_ShimVersion.h
│   │       ├── Net/
│   │       │   ├── OVR_BitStream.cpp
│   │       │   ├── OVR_BitStream.h
│   │       │   ├── OVR_MessageIDTypes.h
│   │       │   ├── OVR_NetworkPlugin.cpp
│   │       │   ├── OVR_NetworkPlugin.h
│   │       │   ├── OVR_NetworkTypes.h
│   │       │   ├── OVR_PacketizedTCPSocket.cpp
│   │       │   ├── OVR_PacketizedTCPSocket.h
│   │       │   ├── OVR_RPC1.cpp
│   │       │   ├── OVR_RPC1.h
│   │       │   ├── OVR_Session.cpp
│   │       │   ├── OVR_Session.h
│   │       │   ├── OVR_Socket.cpp
│   │       │   ├── OVR_Socket.h
│   │       │   ├── OVR_Unix_Socket.cpp
│   │       │   ├── OVR_Unix_Socket.h
│   │       │   ├── OVR_Win32_Socket.cpp
│   │       │   └── OVR_Win32_Socket.h
│   │       ├── OVR_CAPI.cpp
│   │       ├── OVR_Profile.cpp
│   │       ├── OVR_Profile.h
│   │       ├── OVR_SerialFormat.cpp
│   │       ├── OVR_SerialFormat.h
│   │       ├── OVR_Stereo.cpp
│   │       ├── OVR_Stereo.h
│   │       ├── Sensors/
│   │       │   └── OVR_DeviceConstants.h
│   │       ├── Service/
│   │       │   ├── Service_NetClient.cpp
│   │       │   ├── Service_NetClient.h
│   │       │   ├── Service_NetSessionCommon.cpp
│   │       │   ├── Service_NetSessionCommon.h
│   │       │   ├── Service_Win32_FastIPC_Client.cpp
│   │       │   └── Service_Win32_FastIPC_Client.h
│   │       ├── Util/
│   │       │   ├── Util_Interface.cpp
│   │       │   ├── Util_Interface.h
│   │       │   ├── Util_LatencyTest2Reader.cpp
│   │       │   ├── Util_LatencyTest2Reader.h
│   │       │   ├── Util_LatencyTest2State.h
│   │       │   ├── Util_MatFile.cpp
│   │       │   ├── Util_MatFile.h
│   │       │   ├── Util_Render_Stereo.cpp
│   │       │   └── Util_Render_Stereo.h
│   │       └── Vision/
│   │           ├── SensorFusion/
│   │           │   ├── Vision_SensorState.h
│   │           │   ├── Vision_SensorStateReader.cpp
│   │           │   └── Vision_SensorStateReader.h
│   │           └── Vision_Common.h
│   └── stb/
│       ├── stb_image.h
│       └── stb_truetype.h
├── frequensea-osculator-config.oscd
├── houdini/
│   └── surface.hipnc
├── lua/
│   ├── _frequencies.lua
│   ├── _keys.lua
│   ├── animate-camera.lua
│   ├── capture-model.lua
│   ├── diffuse.lua
│   ├── draw-text.lua
│   ├── dvbt-animate-one.lua
│   ├── dvbt.lua
│   ├── empty.lua
│   ├── fft-sea-auto.lua
│   ├── fft-sea-sick.lua
│   ├── fft-sea.lua
│   ├── fft-shifted.lua
│   ├── fft.lua
│   ├── fm-player.lua
│   ├── grid-ripple.lua
│   ├── grid.lua
│   ├── iq-lines-animate-freq.lua
│   ├── iq-lines-animate-one.lua
│   ├── iq-lines-buffer.lua
│   ├── iq-lines.lua
│   ├── iq-tex-3d-filtered.lua
│   ├── iq-tex-3d.lua
│   ├── iq-tex-audio.lua
│   ├── iq-tex-filtered.lua
│   ├── iq-tex-steps.lua
│   ├── iq-tex.lua
│   ├── keys.lua
│   ├── model-sea.lua
│   ├── noise-grid-triangles.lua
│   ├── noise-grid-wave.lua
│   ├── noise-grid.lua
│   ├── osc-rotate.lua
│   ├── osc-server.lua
│   ├── psychedelic-noise.lua
│   ├── samples-and-model.lua
│   ├── samples-tex-3d-filtered.lua
│   ├── samples-tex-3d.lua
│   ├── samples-tex-shaded.lua
│   ├── samples-tex-slow.lua
│   ├── samples-tex.lua
│   ├── sea-grid.lua
│   ├── signal-detector.lua
│   ├── skybox.lua
│   ├── slinky-points.lua
│   ├── slinky-slow.lua
│   ├── slinky-two-point-five.lua
│   ├── slinky-vr.lua
│   ├── slinky.lua
│   ├── static-gradient.lua
│   ├── static.lua
│   └── texture-image.lua
├── obj/
│   ├── c004.obj
│   ├── cubes.obj
│   ├── grid.obj
│   └── monkey.obj
├── rfdata/
│   ├── rf-100.900-1.raw
│   ├── rf-100.900-2.raw
│   ├── rf-100.900-3.raw
│   ├── rf-1278.000-1.raw
│   ├── rf-1574.182-1.raw
│   ├── rf-1574.182-2.raw
│   ├── rf-1574.182-3.raw
│   ├── rf-2.500-1.raw
│   ├── rf-2.500-2.raw
│   ├── rf-2.500-3.raw
│   ├── rf-200.500-big.raw
│   ├── rf-2003.800-1.raw
│   ├── rf-2003.800-2.raw
│   ├── rf-2003.800-3.raw
│   ├── rf-202.500-1.raw
│   ├── rf-202.500-2.raw
│   ├── rf-202.500-3.raw
│   ├── rf-2040.200-1.raw
│   ├── rf-2040.200-2.raw
│   ├── rf-2040.200-3.raw
│   ├── rf-2072.300-1.raw
│   ├── rf-2072.300-2.raw
│   ├── rf-2072.300-3.raw
│   ├── rf-2104.800-1.raw
│   ├── rf-2104.800-2.raw
│   ├── rf-2104.800-3.raw
│   ├── rf-394.855-1.raw
│   ├── rf-4.000-1.raw
│   ├── rf-4.000-2.raw
│   ├── rf-4.000-3.raw
│   ├── rf-433.000-short.raw
│   ├── rf-433.000.raw
│   ├── rf-612.004-1.raw
│   ├── rf-612.004-2.raw
│   ├── rf-612.004-3.raw
│   ├── rf-862.000-1.raw
│   └── rf-887.000-1.raw
├── rpi-fdb/
│   ├── Makefile
│   ├── README
│   ├── iqvis.c
│   └── iqvis_lines.c
├── rust/
│   ├── Cargo.toml
│   └── src/
│       └── main.rs
├── shaders/
│   ├── skybox.frag
│   └── skybox.vert
└── src/
    ├── main.cpp
    ├── nfile.c
    ├── nfile.h
    ├── ngl.c
    ├── ngl.h
    ├── nim.c
    ├── nim.h
    ├── noise.c
    ├── noise.h
    ├── nosc.c
    ├── nosc.h
    ├── nrf.c
    ├── nrf.h
    ├── nut.c
    ├── nut.h
    ├── nvr.cpp
    ├── nvr.h
    ├── nwm.c
    ├── nwm.h
    ├── obj.c
    ├── obj.h
    ├── vec.c
    └── vec.h
Download .txt
Showing preview only (348K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3835 symbols across 312 files)

FILE: c/add-markers.c
  function max_u8 (line 18) | uint8_t max_u8(uint8_t a, uint8_t b) {
  function img_gray_copy (line 24) | void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t ...
  function img_pixel_put (line 34) | void img_pixel_put(uint8_t *buffer, uint32_t stride, uint32_t x, uint32_...
  function img_vline (line 40) | void img_vline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y...
  function img_hline (line 47) | void img_hline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y...
  type ntt_font (line 55) | typedef struct {
  function ntt_font (line 60) | ntt_font *ntt_font_load(const char *font_file) {
  function ntt_font_measure (line 75) | void ntt_font_measure(const ntt_font *font, const char *text, const int ...
  function ntt_font_draw (line 104) | void ntt_font_draw(const ntt_font *font, uint8_t *img, const uint32_t im...
  function frequency_to_x (line 138) | int frequency_to_x(const int image_width, const uint64_t frequency_real_...
  function main (line 143) | int main(int argc, char **argv) {

FILE: c/batch.c
  function export_buffer (line 30) | void export_buffer() {
  function next_frequency (line 38) | void next_frequency() {
  function receive_sample_block (line 51) | int receive_sample_block(hackrf_transfer *transfer) {
  function main (line 62) | int main(int argc, char **argv) {

FILE: c/demod-fm-streaming.c
  function nal_check_error (line 41) | void nal_check_error(const char *file, int line) {
  type queue (line 76) | typedef struct {
  function queue (line 82) | queue *queue_new(int capacity) {
  function queue_push (line 90) | void queue_push(queue *q, ALuint v) {
  function ALuint (line 98) | ALuint queue_pop(queue *q) {
  type fir_filter (line 145) | typedef struct {
  function fir_filter (line 154) | fir_filter *fir_filter_new(int sample_rate, int half_ampl_freq, int leng...
  function fir_filter_load (line 165) | void fir_filter_load(fir_filter *filter, double *samples, int length) {
  function fir_filter_get (line 187) | double fir_filter_get(fir_filter *filter, int index) {
  function fir_filter_free (line 195) | void fir_filter_free(fir_filter *filter) {
  type downsampler (line 201) | typedef struct {
  function downsampler (line 210) | downsampler *downsampler_new(int in_rate, int out_rate, int filter_freq,...
  function downsampler_process (line 221) | void downsampler_process(downsampler *d, double *samples, int length) {
  function downsampler_free (line 235) | void downsampler_free(downsampler *d) {
  function average (line 252) | double average(double *values, int length) {
  function shift_frequency (line 260) | void shift_frequency(double *samples_i, double *samples_q, int length, i...
  function process_sample_block (line 279) | void process_sample_block(uint8_t *buffer, size_t length) {
  function receive_sample_block (line 403) | int receive_sample_block(hackrf_transfer *transfer) {
  function cleanup (line 409) | void cleanup() {
  function main (line 421) | int main(int argc, char **argv) {

FILE: c/demod-fm.c
  function nal_check_error (line 32) | void nal_check_error(const char *file, int line) {
  type fir_filter (line 107) | typedef struct {
  function fir_filter (line 116) | fir_filter *fir_filter_new(int sample_rate, int half_ampl_freq, int leng...
  function fir_filter_load (line 127) | void fir_filter_load(fir_filter *filter, double *samples, int length) {
  function fir_filter_get (line 149) | double fir_filter_get(fir_filter *filter, int index) {
  function fir_filter_free (line 157) | void fir_filter_free(fir_filter *filter) {
  type downsampler (line 163) | typedef struct {
  function downsampler (line 172) | downsampler *downsampler_new(int in_rate, int out_rate, int filter_freq,...
  function downsampler_process (line 183) | void downsampler_process(downsampler *d, double *samples, int length) {
  function downsampler_free (line 197) | void downsampler_free(downsampler *d) {
  function average (line 214) | double average(double *values, int length) {
  function shift_frequency (line 222) | void shift_frequency(double *samples_i, double *samples_q, int length, i...
  function process_sample_block (line 241) | void process_sample_block(uint8_t *buffer, size_t length) {
  function receive_sample_block (line 340) | int receive_sample_block(hackrf_transfer *transfer) {
  function main (line 345) | int main(int argc, char **argv) {

FILE: c/easypng.h
  function write_gray_png (line 6) | static void write_gray_png(const char *fname, const int width, const int...

FILE: c/fft-batch-broad.c
  function clamp_u8 (line 37) | uint8_t clamp_u8(int v, uint8_t min, uint8_t max) {
  function hackrf_check_status (line 43) | static void hackrf_check_status(int status, const char *message, const c...
  function receive_sample_block (line 56) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_hackrf (line 131) | static void setup_hackrf() {
  function teardown_hackrf (line 159) | static void teardown_hackrf() {
  function setup_fftw (line 167) | static void setup_fftw() {
  function teardown_fftw (line 174) | static void teardown_fftw() {
  function main (line 183) | int main(int argc, char **argv) {

FILE: c/fft-batch.c
  function clamp_u8 (line 35) | uint8_t clamp_u8(int v, uint8_t min, uint8_t max) {
  function hackrf_check_status (line 41) | static void hackrf_check_status(int status, const char *message, const c...
  function receive_sample_block (line 54) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_hackrf (line 104) | static void setup_hackrf() {
  function teardown_hackrf (line 132) | static void teardown_hackrf() {
  function setup_fftw (line 140) | static void setup_fftw() {
  function teardown_fftw (line 147) | static void teardown_fftw() {
  function main (line 156) | int main(int argc, char **argv) {

FILE: c/fft-stitch-broad.c
  function max_u8 (line 22) | uint8_t max_u8(uint8_t a, uint8_t b) {
  function img_gray_copy (line 28) | void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t ...
  function img_pixel_put (line 38) | void img_pixel_put(uint8_t *buffer, uint32_t stride, uint32_t x, uint32_...
  function main (line 46) | int main(int argc, char **argv) {

FILE: c/fft-stitch.c
  function max_u8 (line 40) | uint8_t max_u8(uint8_t a, uint8_t b) {
  function img_gray_copy (line 46) | void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t ...
  function img_pixel_put (line 56) | void img_pixel_put(uint8_t *buffer, uint32_t stride, uint32_t x, uint32_...
  function img_vline (line 62) | void img_vline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y...
  function img_hline (line 68) | void img_hline(uint8_t *buffer, uint32_t stride, uint32_t x1, uint32_t y...
  type ntt_font (line 76) | typedef struct {
  function ntt_font (line 81) | ntt_font *ntt_font_load(const char *font_file) {
  function ntt_font_measure (line 97) | void ntt_font_measure(const ntt_font *font, const char *text, const int ...
  function ntt_font_draw (line 126) | void ntt_font_draw(const ntt_font *font, uint8_t *img, const uint32_t im...
  function main (line 160) | int main() {

FILE: c/fft.c
  function receive_sample_block (line 45) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_hackrf (line 58) | static void setup_hackrf() {
  function teardown_hackrf (line 86) | static void teardown_hackrf() {
  function set_frequency (line 92) | static void set_frequency() {
  function setup_fftw (line 101) | static void setup_fftw() {
  function teardown_fftw (line 107) | static void teardown_fftw() {
  function check_shader_error (line 115) | static void check_shader_error(GLuint shader) {
  function setup_gl (line 129) | static void setup_gl() {
  function prepare (line 169) | static void prepare() {
  function update (line 181) | static void update() {
  function draw (line 216) | static void draw() {
  function teardown_gl (line 236) | static void teardown_gl() {
  function export (line 241) | static void export() {
  function key_callback (line 250) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function setup_glfw (line 272) | static void setup_glfw() {
  function teardown_glfw (line 285) | static void teardown_glfw() {
  function main (line 292) | int main(int argc, char **argv) {

FILE: c/gradual-noise.c
  function sine_ease_in_out (line 27) | double sine_ease_in_out(double p) {
  function quadratic_ease_in_out (line 34) | double quadratic_ease_in_out(double p) {
  function quintic_ease_in_out (line 45) | double quintic_ease_in_out(double p) {
  function lerp (line 54) | double lerp(double a, double b, double t) {
  function clamp (line 59) | double clamp(double v, double min, double max) {
  function read_buffer (line 63) | void read_buffer(uint8_t *dst, double freq_mhz) {
  function put_pixel (line 71) | static inline void put_pixel(uint8_t *image_buffer, int x, int y, uint8_...
  function put_block (line 77) | static inline void put_block(uint8_t *image_buffer, int x, int y, uint8_...
  function main (line 85) | int main() {

FILE: c/gridvis.c
  function receive_sample_block (line 39) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_fake (line 61) | static void setup_fake() {
  function setup_hackrf (line 72) | static void setup_hackrf() {
  function set_frequency (line 105) | static void set_frequency() {
  function teardown_hackrf (line 114) | static void teardown_hackrf() {
  function check_shader_error (line 120) | static void check_shader_error(char *prefix, GLuint shader) {
  function setup (line 135) | static void setup() {
  function prepare (line 184) | static void prepare() {
  function update (line 234) | static void update() {
  function draw (line 238) | static void draw() {
  function error_callback (line 327) | static void error_callback(int error, const char* description) {
  function print_camera_pos (line 331) | static void print_camera_pos() {
  function key_callback (line 335) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function main (line 367) | int main(void) {

FILE: c/iq-lines.c
  function clampf (line 39) | float clampf(float v, float min, float max) {
  function hackrf_check_status (line 45) | void hackrf_check_status(int status, const char *message, const char *fi...
  function receive_sample_block (line 58) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_hackrf (line 66) | static void setup_hackrf() {
  function teardown_hackrf (line 99) | static void teardown_hackrf() {
  function set_frequency (line 105) | static void set_frequency() {
  function pixel_put (line 115) | void pixel_put(uint8_t *image_buffer, int x, int y, int color) {
  function pixel_inc (line 120) | void pixel_inc(uint8_t *image_buffer, int x, int y) {
  function draw_line (line 135) | void draw_line(uint8_t *image_buffer, int x1, int y1, int x2, int y2, in...
  function update_image_buffer (line 152) | static void update_image_buffer() {
  function check_shader_error (line 172) | static void check_shader_error(GLuint shader) {
  function setup (line 183) | static void setup() {
  function prepare (line 224) | static void prepare() {
  function update (line 237) | static void update() {
  function draw (line 242) | static void draw() {
  function export (line 264) | static void export() {
  function error_callback (line 275) | static void error_callback(int error, const char* description) {
  function key_callback (line 279) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function main (line 320) | int main(void) {

FILE: c/iqvis-rtl.c
  function rtl_check_status (line 29) | void rtl_check_status(rtlsdr_dev_t *device, int status, const char *mess...
  function receive_block (line 41) | void receive_block(unsigned char *in_buffer, uint32_t buffer_length, voi...
  function setup_rtl (line 74) | static void setup_rtl() {
  function set_frequency (line 113) | static void set_frequency() {
  function teardown_rtl (line 120) | static void teardown_rtl() {
  function setup (line 134) | static void setup() {
  function prepare (line 142) | static void prepare() {
  function update (line 154) | static void update() {
  function export (line 158) | static void export() {
  function draw (line 218) | static void draw() {
  function error_callback (line 236) | static void error_callback(int error, const char* description) {
  function key_callback (line 240) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function main (line 270) | int main(void) {

FILE: c/iqvis.c
  function receive_sample_block (line 30) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_hackrf (line 54) | static void setup_hackrf() {
  function set_frequency (line 87) | static void set_frequency() {
  function teardown_hackrf (line 94) | static void teardown_hackrf() {
  function check_shader_error (line 100) | static void check_shader_error(GLuint shader) {
  function setup (line 114) | static void setup() {
  function prepare (line 154) | static void prepare() {
  function update (line 166) | static void update() {
  function export (line 170) | static void export() {
  function draw (line 230) | static void draw() {
  function error_callback (line 250) | static void error_callback(int error, const char* description) {
  function key_callback (line 254) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function main (line 276) | int main(void) {

FILE: c/osc-server.c
  function die (line 15) | static void die(const char * format, ...)
  function warn (line 24) | static void warn(const char * format, ...) {
  function swap32 (line 32) | static inline void swap32(void *v) { }
  function swap (line 34) | static inline void swap(char *a, char *b){
  function swap32 (line 40) | static inline void swap32(void *v) {
  function check_arg (line 49) | void check_arg(int cond, const char *format, ...) {
  function get_string (line 60) | ssize_t get_string(void *data, ssize_t size) {
  type osc_arg (line 90) | typedef union osc_arg {
  type osc_message (line 96) | typedef struct {
  function osc_message_get_int_arg (line 108) | int32_t osc_message_get_int_arg(const osc_message *msg, int index) {
  function osc_message_get_float_arg (line 114) | float osc_message_get_float_arg(const osc_message *msg, int index) {
  type parser (line 120) | typedef struct {
  function parse_int32 (line 148) | int32_t parse_int32(parser *p) {
  function parse_float (line 163) | float parse_float(parser *p) {
  function handle_datagram (line 179) | void handle_datagram(char *data, size_t size) {
  function main (line 260) | int main() {

FILE: c/piqvis.c
  function rtl_check_status (line 33) | void rtl_check_status(rtlsdr_dev_t *device, int status, const char *mess...
  function receive_block (line 45) | void receive_block(unsigned char *in_buffer, uint32_t buffer_length, voi...
  function setup_rtl (line 77) | static void setup_rtl() {
  function set_frequency (line 116) | static void set_frequency() {
  function teardown_rtl (line 123) | static void teardown_rtl() {
  function ngl_check_gl_error (line 138) | void ngl_check_gl_error(const char *file, int line) {
  function check_shader_error (line 173) | static void check_shader_error(GLuint shader) {
  function setup (line 203) | static void setup() {
  function prepare (line 262) | static void prepare() {
  function update (line 270) | static void update() {
  function draw (line 275) | static void draw() {
  function error_callback (line 286) | static void error_callback(int error, const char* description) {
  function key_callback (line 290) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function main (line 318) | int main(void) {

FILE: c/play.c
  function nal_check_error (line 13) | void nal_check_error(const char *file, int line) {
  function main (line 46) | int main(int argc, char **argv) {

FILE: c/reader.c
  function receive_sample_block (line 25) | int receive_sample_block(hackrf_transfer *transfer) {
  function usage (line 51) | void usage() {
  function main (line 55) | int main(int argc, char **argv) {

FILE: c/render-text.c
  function imax (line 10) | int imax(const int a, const int b) {
  function measure_text (line 14) | void measure_text(const stbtt_fontinfo *font, const char *text, int x, i...
  function img_gray_copy (line 44) | void img_gray_copy(uint8_t *dst, uint8_t *src, uint32_t dst_x, uint32_t ...
  function main (line 52) | int main() {

FILE: c/rfcap.c
  function export_buffer (line 26) | void export_buffer(uint8_t *buffer) {
  function receive_sample_block (line 36) | int receive_sample_block(hackrf_transfer *transfer) {
  function main (line 43) | int main(int argc, char **argv) {

FILE: c/sender.c
  function send_sample_block (line 6) | int send_sample_block(hackrf_transfer *transfer) {
  function main (line 12) | int main(int argc, char **argv) {

FILE: c/single-sample.c
  function clamp_u8 (line 25) | static inline uint8_t clamp_u8(int v, uint8_t min, uint8_t max) {
  function pixel_put (line 29) | void pixel_put(uint8_t *image_buffer, int x, int y, int color) {
  function pixel_inc (line 34) | void pixel_inc(uint8_t *image_buffer, int x, int y) {
  function draw_line (line 53) | void draw_line(uint8_t *image_buffer, int x1, int y1, int x2, int y2, in...
  function write_image (line 70) | void write_image(uint8_t *image_buffer, int fname_index) {
  function usage (line 76) | void usage() {
  function main (line 80) | int main(int argc, char **argv) {

FILE: c/tv-sender.c
  function send_sample_block (line 16) | int send_sample_block(hackrf_transfer *transfer) {
  function main (line 51) | int main(int argc, char **argv) {

FILE: c/vis.c
  function receive_sample_block (line 29) | int receive_sample_block(hackrf_transfer *transfer) {
  function setup_hackrf (line 38) | static void setup_hackrf() {
  function set_frequency (line 71) | static void set_frequency() {
  function teardown_hackrf (line 78) | static void teardown_hackrf() {
  function check_shader_error (line 84) | static void check_shader_error(GLuint shader) {
  function setup (line 98) | static void setup() {
  function prepare (line 143) | static void prepare() {
  function update (line 155) | static void update() {
  function export (line 159) | static void export() {
  function draw (line 219) | static void draw() {
  function error_callback (line 239) | static void error_callback(int error, const char* description) {
  function key_callback (line 243) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
  function main (line 259) | int main(void) {

FILE: data-wrangling/csv2lua.py
  function csv2lua (line 5) | def csv2lua(in_file, out_file, global_name):
  function usage (line 35) | def usage():

FILE: externals/lua/src/lapi.c
  function TValue (line 60) | static TValue *index2addr (lua_State *L, int idx) {
  function growstack (line 91) | static void growstack (lua_State *L, void *ud) {
  function LUA_API (line 97) | LUA_API int lua_checkstack (lua_State *L, int n) {
  function LUA_API (line 118) | LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
  function LUA_API (line 133) | LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
  function LUA_API (line 143) | LUA_API const lua_Number *lua_version (lua_State *L) {
  function LUA_API (line 159) | LUA_API int lua_absindex (lua_State *L, int idx) {
  function LUA_API (line 166) | LUA_API int lua_gettop (lua_State *L) {
  function LUA_API (line 171) | LUA_API void lua_settop (lua_State *L, int idx) {
  function reverse (line 192) | static void reverse (lua_State *L, StkId from, StkId to) {
  function LUA_API (line 206) | LUA_API void lua_rotate (lua_State *L, int idx, int n) {
  function LUA_API (line 221) | LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) {
  function LUA_API (line 236) | LUA_API void lua_pushvalue (lua_State *L, int idx) {
  function LUA_API (line 250) | LUA_API int lua_type (lua_State *L, int idx) {
  function LUA_API (line 256) | LUA_API const char *lua_typename (lua_State *L, int t) {
  function LUA_API (line 263) | LUA_API int lua_iscfunction (lua_State *L, int idx) {
  function LUA_API (line 269) | LUA_API int lua_isinteger (lua_State *L, int idx) {
  function LUA_API (line 275) | LUA_API int lua_isnumber (lua_State *L, int idx) {
  function LUA_API (line 282) | LUA_API int lua_isstring (lua_State *L, int idx) {
  function LUA_API (line 288) | LUA_API int lua_isuserdata (lua_State *L, int idx) {
  function LUA_API (line 294) | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
  function LUA_API (line 301) | LUA_API void lua_arith (lua_State *L, int op) {
  function LUA_API (line 317) | LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
  function LUA_API (line 336) | LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) {
  function LUA_API (line 344) | LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) {
  function LUA_API (line 355) | LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) {
  function LUA_API (line 366) | LUA_API int lua_toboolean (lua_State *L, int idx) {
  function LUA_API (line 372) | LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
  function LUA_API (line 390) | LUA_API size_t lua_rawlen (lua_State *L, int idx) {
  function LUA_API (line 401) | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
  function LUA_API (line 410) | LUA_API void *lua_touserdata (lua_State *L, int idx) {
  function LUA_API (line 420) | LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
  function LUA_API (line 426) | LUA_API const void *lua_topointer (lua_State *L, int idx) {
  function LUA_API (line 448) | LUA_API void lua_pushnil (lua_State *L) {
  function LUA_API (line 456) | LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
  function LUA_API (line 464) | LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
  function LUA_API (line 472) | LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t...
  function LUA_API (line 484) | LUA_API const char *lua_pushstring (lua_State *L, const char *s) {
  function LUA_API (line 502) | LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
  function LUA_API (line 513) | LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
  function LUA_API (line 526) | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
  function LUA_API (line 550) | LUA_API void lua_pushboolean (lua_State *L, int b) {
  function LUA_API (line 558) | LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
  function LUA_API (line 566) | LUA_API int lua_pushthread (lua_State *L) {
  function LUA_API (line 581) | LUA_API int lua_getglobal (lua_State *L, const char *name) {
  function LUA_API (line 593) | LUA_API int lua_gettable (lua_State *L, int idx) {
  function LUA_API (line 603) | LUA_API int lua_getfield (lua_State *L, int idx, const char *k) {
  function LUA_API (line 615) | LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) {
  function LUA_API (line 627) | LUA_API int lua_rawget (lua_State *L, int idx) {
  function LUA_API (line 638) | LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) {
  function LUA_API (line 650) | LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) {
  function LUA_API (line 664) | LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
  function LUA_API (line 677) | LUA_API int lua_getmetatable (lua_State *L, int objindex) {
  function LUA_API (line 704) | LUA_API int lua_getuservalue (lua_State *L, int idx) {
  function LUA_API (line 721) | LUA_API void lua_setglobal (lua_State *L, const char *name) {
  function LUA_API (line 734) | LUA_API void lua_settable (lua_State *L, int idx) {
  function LUA_API (line 745) | LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
  function LUA_API (line 757) | LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) {
  function LUA_API (line 769) | LUA_API void lua_rawset (lua_State *L, int idx) {
  function LUA_API (line 785) | LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) {
  function LUA_API (line 800) | LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {
  function LUA_API (line 817) | LUA_API int lua_setmetatable (lua_State *L, int objindex) {
  function LUA_API (line 857) | LUA_API void lua_setuservalue (lua_State *L, int idx) {
  function LUA_API (line 880) | LUA_API void lua_callk (lua_State *L, int nargs, int nresults,
  type CallS (line 906) | struct CallS {  /* data to 'f_call' */
  function f_call (line 912) | static void f_call (lua_State *L, void *ud) {
  function LUA_API (line 919) | LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
  function LUA_API (line 963) | LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
  function LUA_API (line 987) | LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int s...
  function LUA_API (line 1002) | LUA_API int lua_status (lua_State *L) {
  function LUA_API (line 1011) | LUA_API int lua_gc (lua_State *L, int what, int data) {
  function LUA_API (line 1085) | LUA_API int lua_error (lua_State *L) {
  function LUA_API (line 1094) | LUA_API int lua_next (lua_State *L, int idx) {
  function LUA_API (line 1111) | LUA_API void lua_concat (lua_State *L, int n) {
  function LUA_API (line 1127) | LUA_API void lua_len (lua_State *L, int idx) {
  function LUA_API (line 1137) | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
  function LUA_API (line 1147) | LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {
  function LUA_API (line 1155) | LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
  function LUA_API (line 1193) | LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
  function LUA_API (line 1207) | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
  function UpVal (line 1228) | static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
  function LUA_API (line 1239) | LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
  function LUA_API (line 1258) | LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,

FILE: externals/lua/src/lauxlib.c
  function findfield (line 45) | static int findfield (lua_State *L, int objidx, int level) {
  function pushglobalfuncname (line 73) | static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
  function pushfuncname (line 94) | static void pushfuncname (lua_State *L, lua_Debug *ar) {
  function countlevels (line 110) | static int countlevels (lua_State *L) {
  function LUALIB_API (line 125) | LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,
  function LUALIB_API (line 162) | LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extrams...
  function typeerror (line 180) | static int typeerror (lua_State *L, int arg, const char *tname) {
  function tag_error (line 194) | static void tag_error (lua_State *L, int arg, int tag) {
  function LUALIB_API (line 199) | LUALIB_API void luaL_where (lua_State *L, int level) {
  function LUALIB_API (line 212) | LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
  function LUALIB_API (line 223) | LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fnam...
  function LUALIB_API (line 263) | LUALIB_API int luaL_execresult (lua_State *L, int stat) {
  function LUALIB_API (line 288) | LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
  function LUALIB_API (line 301) | LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) {
  function LUALIB_API (line 307) | LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {
  function LUALIB_API (line 322) | LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tnam...
  function LUALIB_API (line 337) | LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def,
  function LUALIB_API (line 350) | LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *ms...
  function LUALIB_API (line 362) | LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) {
  function LUALIB_API (line 368) | LUALIB_API void luaL_checkany (lua_State *L, int arg) {
  function LUALIB_API (line 374) | LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t ...
  function LUALIB_API (line 381) | LUALIB_API const char *luaL_optlstring (lua_State *L, int arg,
  function LUALIB_API (line 392) | LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) {
  function LUALIB_API (line 401) | LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number ...
  function interror (line 406) | static void interror (lua_State *L, int arg) {
  function LUALIB_API (line 414) | LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) {
  function LUALIB_API (line 424) | LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg,
  function LUALIB_API (line 448) | LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) {
  function LUALIB_API (line 470) | LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
  function LUALIB_API (line 477) | LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
  function LUALIB_API (line 482) | LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
  function LUALIB_API (line 490) | LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) {
  function LUALIB_API (line 496) | LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
  function LUALIB_API (line 507) | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
  function LUALIB_API (line 515) | LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t...
  function LUALIB_API (line 533) | LUALIB_API int luaL_ref (lua_State *L, int t) {
  function LUALIB_API (line 554) | LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
  type LoadF (line 573) | typedef struct LoadF {
  function errfile (line 598) | static int errfile (lua_State *L, const char *what, int fnameindex) {
  function skipBOM (line 607) | static int skipBOM (LoadF *lf) {
  function skipcomment (line 628) | static int skipcomment (LoadF *lf, int *cp) {
  function LUALIB_API (line 641) | LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
  type LoadS (line 677) | typedef struct LoadS {
  function LUALIB_API (line 693) | LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t ...
  function LUALIB_API (line 702) | LUALIB_API int luaL_loadstring (lua_State *L, const char *s) {
  function LUALIB_API (line 710) | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *eve...
  function LUALIB_API (line 726) | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
  function LUALIB_API (line 736) | LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) {
  function LUALIB_API (line 748) | LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *le...
  function libsize (line 813) | static int libsize (const luaL_Reg *l) {
  function LUALIB_API (line 826) | LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname,
  function LUALIB_API (line 842) | LUALIB_API void luaL_openlib (lua_State *L, const char *libname,
  function LUALIB_API (line 863) | LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
  function LUALIB_API (line 880) | LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fnam...
  function LUALIB_API (line 900) | LUALIB_API void luaL_requiref (lua_State *L, const char *modname,
  function LUALIB_API (line 920) | LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const cha...
  function panic (line 948) | static int panic (lua_State *L) {
  function LUALIB_API (line 955) | LUALIB_API lua_State *luaL_newstate (void) {
  function LUALIB_API (line 962) | LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t...

FILE: externals/lua/src/lauxlib.h
  type luaL_Reg (line 23) | typedef struct luaL_Reg {
  type luaL_Buffer (line 140) | typedef struct luaL_Buffer {
  type luaL_Stream (line 185) | typedef struct luaL_Stream {

FILE: externals/lua/src/lbaselib.c
  function luaB_print (line 24) | static int luaB_print (lua_State *L) {
  function luaB_tonumber (line 69) | static int luaB_tonumber (lua_State *L) {
  function luaB_error (line 102) | static int luaB_error (lua_State *L) {
  function luaB_getmetatable (line 114) | static int luaB_getmetatable (lua_State *L) {
  function luaB_setmetatable (line 125) | static int luaB_setmetatable (lua_State *L) {
  function luaB_rawequal (line 138) | static int luaB_rawequal (lua_State *L) {
  function luaB_rawlen (line 146) | static int luaB_rawlen (lua_State *L) {
  function luaB_rawget (line 155) | static int luaB_rawget (lua_State *L) {
  function luaB_rawset (line 163) | static int luaB_rawset (lua_State *L) {
  function luaB_collectgarbage (line 173) | static int luaB_collectgarbage (lua_State *L) {
  function luaB_type (line 204) | static int luaB_type (lua_State *L) {
  function pairsmeta (line 211) | static int pairsmeta (lua_State *L, const char *method, int iszero,
  function luaB_next (line 228) | static int luaB_next (lua_State *L) {
  function luaB_pairs (line 240) | static int luaB_pairs (lua_State *L) {
  function ipairsaux_raw (line 248) | static int ipairsaux_raw (lua_State *L) {
  function ipairsaux (line 259) | static int ipairsaux (lua_State *L) {
  function luaB_ipairs (line 271) | static int luaB_ipairs (lua_State *L) {
  function load_aux (line 286) | static int load_aux (lua_State *L, int status, int envidx) {
  function luaB_loadfile (line 303) | static int luaB_loadfile (lua_State *L) {
  function luaB_load (line 350) | static int luaB_load (lua_State *L) {
  function dofilecont (line 372) | static int dofilecont (lua_State *L, int d1, lua_KContext d2) {
  function luaB_dofile (line 378) | static int luaB_dofile (lua_State *L) {
  function luaB_assert (line 388) | static int luaB_assert (lua_State *L) {
  function luaB_select (line 401) | static int luaB_select (lua_State *L) {
  function finishpcall (line 424) | static int finishpcall (lua_State *L, int status, lua_KContext extra) {
  function luaB_pcall (line 435) | static int luaB_pcall (lua_State *L) {
  function luaB_xpcall (line 450) | static int luaB_xpcall (lua_State *L) {
  function luaB_tostring (line 462) | static int luaB_tostring (lua_State *L) {
  function LUAMOD_API (line 502) | LUAMOD_API int luaopen_base (lua_State *L) {

FILE: externals/lua/src/lbitlib.c
  function lua_Unsigned (line 45) | static lua_Unsigned andaux (lua_State *L) {
  function b_and (line 54) | static int b_and (lua_State *L) {
  function b_test (line 61) | static int b_test (lua_State *L) {
  function b_or (line 68) | static int b_or (lua_State *L) {
  function b_xor (line 78) | static int b_xor (lua_State *L) {
  function b_not (line 88) | static int b_not (lua_State *L) {
  function b_shift (line 95) | static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) {
  function b_lshift (line 112) | static int b_lshift (lua_State *L) {
  function b_rshift (line 117) | static int b_rshift (lua_State *L) {
  function b_arshift (line 122) | static int b_arshift (lua_State *L) {
  function b_rot (line 137) | static int b_rot (lua_State *L, lua_Integer d) {
  function b_lrot (line 148) | static int b_lrot (lua_State *L) {
  function b_rrot (line 153) | static int b_rrot (lua_State *L) {
  function fieldargs (line 164) | static int fieldargs (lua_State *L, int farg, int *width) {
  function b_extract (line 176) | static int b_extract (lua_State *L) {
  function b_replace (line 186) | static int b_replace (lua_State *L) {
  function LUAMOD_API (line 217) | LUAMOD_API int luaopen_bit32 (lua_State *L) {
  function LUAMOD_API (line 226) | LUAMOD_API int luaopen_bit32 (lua_State *L) {

FILE: externals/lua/src/lcode.c
  function tonumeral (line 39) | static int tonumeral(expdesc *e, TValue *v) {
  function luaK_nil (line 54) | void luaK_nil (FuncState *fs, int from, int n) {
  function luaK_jump (line 76) | int luaK_jump (FuncState *fs) {
  function luaK_ret (line 86) | void luaK_ret (FuncState *fs, int first, int nret) {
  function condjump (line 91) | static int condjump (FuncState *fs, OpCode op, int A, int B, int C) {
  function fixjump (line 97) | static void fixjump (FuncState *fs, int pc, int dest) {
  function luaK_getlabel (line 111) | int luaK_getlabel (FuncState *fs) {
  function getjump (line 117) | static int getjump (FuncState *fs, int pc) {
  function Instruction (line 126) | static Instruction *getjumpcontrol (FuncState *fs, int pc) {
  function need_value (line 139) | static int need_value (FuncState *fs, int list) {
  function patchtestreg (line 148) | static int patchtestreg (FuncState *fs, int node, int reg) {
  function removevalues (line 161) | static void removevalues (FuncState *fs, int list) {
  function patchlistaux (line 167) | static void patchlistaux (FuncState *fs, int list, int vtarget, int reg,
  function dischargejpc (line 180) | static void dischargejpc (FuncState *fs) {
  function luaK_patchlist (line 186) | void luaK_patchlist (FuncState *fs, int list, int target) {
  function luaK_patchclose (line 196) | void luaK_patchclose (FuncState *fs, int list, int level) {
  function luaK_patchtohere (line 209) | void luaK_patchtohere (FuncState *fs, int list) {
  function luaK_concat (line 215) | void luaK_concat (FuncState *fs, int *l1, int l2) {
  function luaK_code (line 229) | static int luaK_code (FuncState *fs, Instruction i) {
  function luaK_codeABC (line 244) | int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
  function luaK_codeABx (line 253) | int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
  function codeextraarg (line 261) | static int codeextraarg (FuncState *fs, int a) {
  function luaK_codek (line 267) | int luaK_codek (FuncState *fs, int reg, int k) {
  function luaK_checkstack (line 278) | void luaK_checkstack (FuncState *fs, int n) {
  function luaK_reserveregs (line 288) | void luaK_reserveregs (FuncState *fs, int n) {
  function freereg (line 294) | static void freereg (FuncState *fs, int reg) {
  function freeexp (line 302) | static void freeexp (FuncState *fs, expdesc *e) {
  function addk (line 312) | static int addk (FuncState *fs, TValue *key, TValue *v) {
  function luaK_stringK (line 339) | int luaK_stringK (FuncState *fs, TString *s) {
  function luaK_intK (line 351) | int luaK_intK (FuncState *fs, lua_Integer n) {
  function luaK_numberK (line 359) | static int luaK_numberK (FuncState *fs, lua_Number r) {
  function boolK (line 366) | static int boolK (FuncState *fs, int b) {
  function nilK (line 373) | static int nilK (FuncState *fs) {
  function luaK_setreturns (line 382) | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
  function luaK_setoneret (line 394) | void luaK_setoneret (FuncState *fs, expdesc *e) {
  function luaK_dischargevars (line 406) | void luaK_dischargevars (FuncState *fs, expdesc *e) {
  function code_label (line 438) | static int code_label (FuncState *fs, int A, int b, int jump) {
  function discharge2reg (line 444) | static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
  function discharge2anyreg (line 487) | static void discharge2anyreg (FuncState *fs, expdesc *e) {
  function exp2reg (line 495) | static void exp2reg (FuncState *fs, expdesc *e, int reg) {
  function luaK_exp2nextreg (line 519) | void luaK_exp2nextreg (FuncState *fs, expdesc *e) {
  function luaK_exp2anyreg (line 527) | int luaK_exp2anyreg (FuncState *fs, expdesc *e) {
  function luaK_exp2anyregup (line 541) | void luaK_exp2anyregup (FuncState *fs, expdesc *e) {
  function luaK_exp2val (line 547) | void luaK_exp2val (FuncState *fs, expdesc *e) {
  function luaK_exp2RK (line 555) | int luaK_exp2RK (FuncState *fs, expdesc *e) {
  function luaK_storevar (line 591) | void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
  function luaK_self (line 618) | void luaK_self (FuncState *fs, expdesc *e, expdesc *key) {
  function invertjump (line 631) | static void invertjump (FuncState *fs, expdesc *e) {
  function jumponcond (line 639) | static int jumponcond (FuncState *fs, expdesc *e, int cond) {
  function luaK_goiftrue (line 654) | void luaK_goiftrue (FuncState *fs, expdesc *e) {
  function luaK_goiffalse (line 678) | void luaK_goiffalse (FuncState *fs, expdesc *e) {
  function codenot (line 701) | static void codenot (FuncState *fs, expdesc *e) {
  function luaK_indexed (line 736) | void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
  function validop (line 749) | static int validop (int op, TValue *v1, TValue *v2) {
  function constfolding (line 766) | static int constfolding (FuncState *fs, int op, expdesc *e1, expdesc *e2) {
  function codeexpval (line 793) | static void codeexpval (FuncState *fs, OpCode op,
  function codecomp (line 824) | static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
  function luaK_prefix (line 840) | void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
  function luaK_infix (line 854) | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
  function luaK_posfix (line 884) | void luaK_posfix (FuncState *fs, BinOpr op,
  function luaK_fixline (line 935) | void luaK_fixline (FuncState *fs, int line) {
  function luaK_setlist (line 940) | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {

FILE: externals/lua/src/lcode.h
  type BinOpr (line 26) | typedef enum BinOpr {
  type UnOpr (line 40) | typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR ...

FILE: externals/lua/src/lcorolib.c
  function lua_State (line 21) | static lua_State *getco (lua_State *L) {
  function auxresume (line 28) | static int auxresume (lua_State *L, lua_State *co, int narg) {
  function luaB_coresume (line 57) | static int luaB_coresume (lua_State *L) {
  function luaB_auxwrap (line 74) | static int luaB_auxwrap (lua_State *L) {
  function luaB_cocreate (line 89) | static int luaB_cocreate (lua_State *L) {
  function luaB_cowrap (line 99) | static int luaB_cowrap (lua_State *L) {
  function luaB_yield (line 106) | static int luaB_yield (lua_State *L) {
  function luaB_costatus (line 111) | static int luaB_costatus (lua_State *L) {
  function luaB_yieldable (line 138) | static int luaB_yieldable (lua_State *L) {
  function luaB_corunning (line 144) | static int luaB_corunning (lua_State *L) {
  function LUAMOD_API (line 164) | LUAMOD_API int luaopen_coroutine (lua_State *L) {

FILE: externals/lua/src/ldblib.c
  function db_getregistry (line 30) | static int db_getregistry (lua_State *L) {
  function db_getmetatable (line 36) | static int db_getmetatable (lua_State *L) {
  function db_setmetatable (line 45) | static int db_setmetatable (lua_State *L) {
  function db_getuservalue (line 55) | static int db_getuservalue (lua_State *L) {
  function db_setuservalue (line 64) | static int db_setuservalue (lua_State *L) {
  function lua_State (line 79) | static lua_State *getthread (lua_State *L, int *arg) {
  function settabss (line 96) | static void settabss (lua_State *L, const char *k, const char *v) {
  function settabsi (line 101) | static void settabsi (lua_State *L, const char *k, int v) {
  function settabsb (line 106) | static void settabsb (lua_State *L, const char *k, int v) {
  function treatstackoption (line 119) | static void treatstackoption (lua_State *L, lua_State *L1, const char *f...
  function db_getinfo (line 131) | static int db_getinfo (lua_State *L) {
  function db_getlocal (line 178) | static int db_getlocal (lua_State *L) {
  function db_setlocal (line 208) | static int db_setlocal (lua_State *L) {
  function auxupvalue (line 231) | static int auxupvalue (lua_State *L, int get) {
  function db_getupvalue (line 243) | static int db_getupvalue (lua_State *L) {
  function db_setupvalue (line 248) | static int db_setupvalue (lua_State *L) {
  function checkupval (line 258) | static int checkupval (lua_State *L, int argf, int argnup) {
  function db_upvalueid (line 267) | static int db_upvalueid (lua_State *L) {
  function db_upvaluejoin (line 274) | static int db_upvaluejoin (lua_State *L) {
  function hookf (line 288) | static void hookf (lua_State *L, lua_Debug *ar) {
  function makemask (line 307) | static int makemask (const char *smask, int count) {
  function db_sethook (line 330) | static int db_sethook (lua_State *L) {
  function db_gethook (line 361) | static int db_gethook (lua_State *L) {
  function db_debug (line 383) | static int db_debug (lua_State *L) {
  function db_traceback (line 398) | static int db_traceback (lua_State *L) {
  function LUAMOD_API (line 433) | LUAMOD_API int luaopen_debug (lua_State *L) {

FILE: externals/lua/src/ldebug.c
  function currentpc (line 40) | static int currentpc (CallInfo *ci) {
  function currentline (line 46) | static int currentline (CallInfo *ci) {
  function LUA_API (line 54) | LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int cou...
  function LUA_API (line 68) | LUA_API lua_Hook lua_gethook (lua_State *L) {
  function LUA_API (line 73) | LUA_API int lua_gethookmask (lua_State *L) {
  function LUA_API (line 78) | LUA_API int lua_gethookcount (lua_State *L) {
  function LUA_API (line 83) | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
  function LUA_API (line 144) | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int...
  function LUA_API (line 166) | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int...
  function funcinfo (line 179) | static void funcinfo (lua_Debug *ar, Closure *cl) {
  function collectvalidlines (line 197) | static void collectvalidlines (lua_State *L, Closure *f) {
  function auxgetinfo (line 216) | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
  function LUA_API (line 267) | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
  function kname (line 311) | static void kname (Proto *p, int pc, int c, const char **name) {
  function filterpc (line 331) | static int filterpc (int pc, int jmptarget) {
  function findsetreg (line 341) | static int findsetreg (Proto *p, int lastpc, int reg) {
  function isinstack (line 494) | static int isinstack (CallInfo *ci, const TValue *o) {
  function l_noret (line 533) | l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
  function l_noret (line 539) | l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *...
  function l_noret (line 545) | l_noret luaG_opinterror (lua_State *L, const TValue *p1,
  function l_noret (line 557) | l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p...
  function l_noret (line 565) | l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p...
  function addinfo (line 575) | static void addinfo (lua_State *L, const char *msg) {
  function l_noret (line 591) | l_noret luaG_errormsg (lua_State *L) {
  function l_noret (line 603) | l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
  function luaG_traceexec (line 612) | void luaG_traceexec (lua_State *L) {

FILE: externals/lua/src/ldo.c
  type lua_longjmp (line 84) | struct lua_longjmp {
  function seterrorobj (line 91) | static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
  function l_noret (line 110) | l_noret luaD_throw (lua_State *L, int errcode) {
  function luaD_rawrunprotected (line 136) | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
  function correctstack (line 153) | static void correctstack (lua_State *L, TValue *oldstack) {
  function luaD_reallocstack (line 172) | void luaD_reallocstack (lua_State *L, int newsize) {
  function luaD_growstack (line 186) | void luaD_growstack (lua_State *L, int n) {
  function stackinuse (line 205) | static int stackinuse (lua_State *L) {
  function luaD_shrinkstack (line 216) | void luaD_shrinkstack (lua_State *L) {
  function luaD_hook (line 232) | void luaD_hook (lua_State *L, int event, int line) {
  function callhook (line 259) | static void callhook (lua_State *L, CallInfo *ci) {
  function StkId (line 272) | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {
  function tryfuncTM (line 294) | static void tryfuncTM (lua_State *L, StkId func) {
  function luaD_precall (line 314) | int luaD_precall (lua_State *L, StkId func, int nresults) {
  function luaD_poscall (line 382) | int luaD_poscall (lua_State *L, StkId firstResult) {
  function luaD_call (line 413) | void luaD_call (lua_State *L, StkId func, int nResults, int allowyield) {
  function finishCcall (line 432) | static void finishCcall (lua_State *L, int status) {
  function unroll (line 464) | static void unroll (lua_State *L, void *ud) {
  function CallInfo (line 482) | static CallInfo *findpcall (lua_State *L) {
  function recover (line 497) | static int recover (lua_State *L, int status) {
  function l_noret (line 519) | static l_noret resume_error (lua_State *L, const char *msg, StkId firstA...
  function resume (line 534) | static void resume (lua_State *L, void *ud) {
  function LUA_API (line 571) | LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {
  function LUA_API (line 602) | LUA_API int lua_isyieldable (lua_State *L) {
  function LUA_API (line 607) | LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx,
  function luaD_pcall (line 636) | int luaD_pcall (lua_State *L, Pfunc func, void *u,
  type SParser (line 663) | struct SParser {  /* data to 'f_parser' */
  function checkmode (line 672) | static void checkmode (lua_State *L, const char *mode, const char *x) {
  function f_parser (line 681) | static void f_parser (lua_State *L, void *ud) {
  function luaD_protectedparser (line 698) | int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,

FILE: externals/lua/src/ldump.c
  type DumpState (line 22) | typedef struct {
  function DumpBlock (line 40) | static void DumpBlock (const void *b, size_t size, DumpState *D) {
  function DumpByte (line 52) | static void DumpByte (int y, DumpState *D) {
  function DumpInt (line 58) | static void DumpInt (int x, DumpState *D) {
  function DumpNumber (line 63) | static void DumpNumber (lua_Number x, DumpState *D) {
  function DumpInteger (line 68) | static void DumpInteger (lua_Integer x, DumpState *D) {
  function DumpString (line 73) | static void DumpString (const TString *s, DumpState *D) {
  function DumpCode (line 89) | static void DumpCode (const Proto *f, DumpState *D) {
  function DumpConstants (line 97) | static void DumpConstants (const Proto *f, DumpState *D) {
  function DumpProtos (line 127) | static void DumpProtos (const Proto *f, DumpState *D) {
  function DumpUpvalues (line 136) | static void DumpUpvalues (const Proto *f, DumpState *D) {
  function DumpDebug (line 146) | static void DumpDebug (const Proto *f, DumpState *D) {
  function DumpFunction (line 165) | static void DumpFunction (const Proto *f, TString *psource, DumpState *D) {
  function DumpHeader (line 183) | static void DumpHeader (DumpState *D) {
  function luaU_dump (line 201) | int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data,

FILE: externals/lua/src/lfunc.c
  function CClosure (line 25) | CClosure *luaF_newCclosure (lua_State *L, int n) {
  function LClosure (line 33) | LClosure *luaF_newLclosure (lua_State *L, int n) {
  function luaF_initupvals (line 45) | void luaF_initupvals (lua_State *L, LClosure *cl) {
  function UpVal (line 57) | UpVal *luaF_findupval (lua_State *L, StkId level) {
  function luaF_close (line 83) | void luaF_close (lua_State *L, StkId level) {
  function Proto (line 99) | Proto *luaF_newproto (lua_State *L) {
  function luaF_freeproto (line 125) | void luaF_freeproto (lua_State *L, Proto *f) {

FILE: externals/lua/src/lfunc.h
  type UpVal (line 28) | struct UpVal {

FILE: externals/lua/src/lgc.c
  function removeentry (line 115) | static void removeentry (Node *n) {
  function iscleared (line 129) | static int iscleared (global_State *g, const TValue *o) {
  function luaC_barrier_ (line 145) | void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) {
  function luaC_barrierback_ (line 161) | void luaC_barrierback_ (lua_State *L, Table *t) {
  function luaC_upvalbarrier_ (line 175) | void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) {
  function luaC_fix (line 184) | void luaC_fix (lua_State *L, GCObject *o) {
  function GCObject (line 198) | GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) {
  function reallymarkobject (line 225) | static void reallymarkobject (global_State *g, GCObject *o) {
  function markmt (line 275) | static void markmt (global_State *g) {
  function markbeingfnz (line 285) | static void markbeingfnz (global_State *g) {
  function remarkupvals (line 298) | static void remarkupvals (global_State *g) {
  function restartcollection (line 323) | static void restartcollection (global_State *g) {
  function traverseweakvalue (line 347) | static void traverseweakvalue (global_State *g, Table *h) {
  function traverseephemeron (line 380) | static int traverseephemeron (global_State *g, Table *h) {
  function traversestrongtable (line 419) | static void traversestrongtable (global_State *g, Table *h) {
  function lu_mem (line 437) | static lu_mem traversetable (global_State *g, Table *h) {
  function traverseproto (line 460) | static int traverseproto (global_State *g, Proto *f) {
  function lu_mem (line 482) | static lu_mem traverseCclosure (global_State *g, CClosure *cl) {
  function lu_mem (line 495) | static lu_mem traverseLclosure (global_State *g, LClosure *cl) {
  function lu_mem (line 511) | static lu_mem traversethread (global_State *g, lua_State *th) {
  function propagatemark (line 539) | static void propagatemark (global_State *g) {
  function propagateall (line 583) | static void propagateall (global_State *g) {
  function convergeephemerons (line 588) | static void convergeephemerons (global_State *g) {
  function clearkeys (line 619) | static void clearkeys (global_State *g, GCObject *l, GCObject *f) {
  function clearvalues (line 637) | static void clearvalues (global_State *g, GCObject *l, GCObject *f) {
  function luaC_upvdeccount (line 657) | void luaC_upvdeccount (lua_State *L, UpVal *uv) {
  function freeLclosure (line 665) | static void freeLclosure (lua_State *L, LClosure *cl) {
  function freeobj (line 676) | static void freeobj (lua_State *L, GCObject *o) {
  function GCObject (line 713) | static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
  function GCObject (line 736) | static GCObject **sweeptolive (lua_State *L, GCObject **p, int *n) {
  function checkSizes (line 759) | static void checkSizes (lua_State *L, global_State *g) {
  function GCObject (line 770) | static GCObject *udata2finalize (global_State *g) {
  function dothecall (line 783) | static void dothecall (lua_State *L, void *ud) {
  function GCTM (line 789) | static void GCTM (lua_State *L, int propagateerrors) {
  function runafewfinalizers (line 824) | static int runafewfinalizers (lua_State *L) {
  function callallpendingfinalizers (line 839) | static void callallpendingfinalizers (lua_State *L, int propagateerrors) {
  function GCObject (line 849) | static GCObject **findlast (GCObject **p) {
  function separatetobefnz (line 860) | static void separatetobefnz (global_State *g, int all) {
  function luaC_checkfinalizer (line 882) | void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
  function setpause (line 920) | static void setpause (global_State *g) {
  function entersweep (line 940) | static int entersweep (lua_State *L) {
  function luaC_freeallobjects (line 950) | void luaC_freeallobjects (lua_State *L) {
  function l_mem (line 965) | static l_mem atomic (lua_State *L) {
  function lu_mem (line 1011) | static lu_mem sweepstep (lua_State *L, global_State *g,
  function lu_mem (line 1027) | static lu_mem singlestep (lua_State *L) {
  function luaC_runtilstate (line 1087) | void luaC_runtilstate (lua_State *L, int statesmask) {
  function l_mem (line 1098) | static l_mem getdebt (global_State *g) {
  function luaC_step (line 1109) | void luaC_step (lua_State *L) {
  function luaC_fullgc (line 1139) | void luaC_fullgc (lua_State *L, int isemergency) {

FILE: externals/lua/src/linit.c
  function LUALIB_API (line 60) | LUALIB_API void luaL_openlibs (lua_State *L) {

FILE: externals/lua/src/liolib.c
  type luaL_Stream (line 135) | typedef luaL_Stream LStream;
  function io_type (line 143) | static int io_type (lua_State *L) {
  function f_tostring (line 157) | static int f_tostring (lua_State *L) {
  function FILE (line 167) | static FILE *tofile (lua_State *L) {
  function LStream (line 181) | static LStream *newprefile (lua_State *L) {
  function aux_close (line 194) | static int aux_close (lua_State *L) {
  function io_close (line 202) | static int io_close (lua_State *L) {
  function f_gc (line 210) | static int f_gc (lua_State *L) {
  function io_fclose (line 221) | static int io_fclose (lua_State *L) {
  function LStream (line 228) | static LStream *newfile (lua_State *L) {
  function opencheck (line 236) | static void opencheck (lua_State *L, const char *fname, const char *mode) {
  function io_open (line 244) | static int io_open (lua_State *L) {
  function io_pclose (line 258) | static int io_pclose (lua_State *L) {
  function io_popen (line 264) | static int io_popen (lua_State *L) {
  function io_tmpfile (line 274) | static int io_tmpfile (lua_State *L) {
  function FILE (line 281) | static FILE *getiofile (lua_State *L, const char *findex) {
  function g_iofile (line 291) | static int g_iofile (lua_State *L, const char *f, const char *mode) {
  function io_input (line 308) | static int io_input (lua_State *L) {
  function io_output (line 313) | static int io_output (lua_State *L) {
  function aux_lines (line 321) | static void aux_lines (lua_State *L, int toclose) {
  function f_lines (line 330) | static int f_lines (lua_State *L) {
  function io_lines (line 337) | static int io_lines (lua_State *L) {
  type RN (line 368) | typedef struct {
  function nextc (line 379) | static int nextc (RN *rn) {
  function test2 (line 395) | static int test2 (RN *rn, const char *set) {
  function readdigits (line 405) | static int readdigits (RN *rn, int hex) {
  function read_number (line 424) | static int read_number (lua_State *L, FILE *f) {
  function test_eof (line 457) | static int test_eof (lua_State *L, FILE *f) {
  function read_line (line 465) | static int read_line (lua_State *L, FILE *f, int chop) {
  function read_all (line 486) | static void read_all (lua_State *L, FILE *f) {
  function read_chars (line 499) | static int read_chars (lua_State *L, FILE *f, size_t n) {
  function g_read (line 512) | static int g_read (lua_State *L, FILE *f, int first) {
  function io_read (line 562) | static int io_read (lua_State *L) {
  function f_read (line 567) | static int f_read (lua_State *L) {
  function io_readline (line 572) | static int io_readline (lua_State *L) {
  function g_write (line 603) | static int g_write (lua_State *L, FILE *f, int arg) {
  function io_write (line 625) | static int io_write (lua_State *L) {
  function f_write (line 630) | static int f_write (lua_State *L) {
  function f_seek (line 637) | static int f_seek (lua_State *L) {
  function f_setvbuf (line 656) | static int f_setvbuf (lua_State *L) {
  function io_flush (line 668) | static int io_flush (lua_State *L) {
  function f_flush (line 673) | static int f_flush (lua_State *L) {
  function createmeta (line 714) | static void createmeta (lua_State *L) {
  function io_noclose (line 726) | static int io_noclose (lua_State *L) {
  function createstdfile (line 735) | static void createstdfile (lua_State *L, FILE *f, const char *k,
  function LUAMOD_API (line 748) | LUAMOD_API int luaopen_io (lua_State *L) {

FILE: externals/lua/src/llex.c
  function save (line 56) | static void save (LexState *ls, int c) {
  function luaX_init (line 69) | void luaX_init (lua_State *L) {
  function l_noret (line 108) | static l_noret lexerror (LexState *ls, const char *msg, int token) {
  function l_noret (line 118) | l_noret luaX_syntaxerror (LexState *ls, const char *msg) {
  function TString (line 128) | TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
  function inclinenumber (line 152) | static void inclinenumber (LexState *ls) {
  function luaX_setinput (line 163) | void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,
  function check_next1 (line 188) | static int check_next1 (LexState *ls, int c) {
  function check_next2 (line 201) | static int check_next2 (LexState *ls, const char *set) {
  function buffreplace (line 214) | static void buffreplace (LexState *ls, char from, char to) {
  function trydecpoint (line 235) | static void trydecpoint (LexState *ls, TValue *o) {
  function read_numeral (line 252) | static int read_numeral (LexState *ls, SemInfo *seminfo) {
  function skip_sep (line 289) | static int skip_sep (LexState *ls) {
  function read_long_string (line 302) | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
  function esccheck (line 341) | static void esccheck (LexState *ls, int c, const char *msg) {
  function gethexa (line 350) | static int gethexa (LexState *ls) {
  function readhexaesc (line 357) | static int readhexaesc (LexState *ls) {
  function readutf8esc (line 365) | static unsigned long readutf8esc (LexState *ls) {
  function utf8esc (line 383) | static void utf8esc (LexState *ls) {
  function readdecesc (line 391) | static int readdecesc (LexState *ls) {
  function read_string (line 404) | static void read_string (LexState *ls, int del, SemInfo *seminfo) {
  function llex (line 467) | static int llex (LexState *ls, SemInfo *seminfo) {
  function luaX_next (line 586) | void luaX_next (LexState *ls) {
  function luaX_lookahead (line 597) | int luaX_lookahead (LexState *ls) {

FILE: externals/lua/src/llex.h
  type RESERVED (line 26) | enum RESERVED {
  type SemInfo (line 43) | typedef union {
  type Token (line 50) | typedef struct Token {
  type LexState (line 58) | typedef struct LexState {

FILE: externals/lua/src/llimits.h
  type LUAI_UMEM (line 23) | typedef LUAI_UMEM lu_mem;
  type LUAI_MEM (line 24) | typedef LUAI_MEM l_mem;
  type lu_mem (line 26) | typedef size_t lu_mem;
  type l_mem (line 27) | typedef ptrdiff_t l_mem;
  type lu_mem (line 29) | typedef unsigned long lu_mem;
  type l_mem (line 30) | typedef long l_mem;
  type lu_byte (line 35) | typedef unsigned char lu_byte;
  type LUAI_USER_ALIGNMENT_T (line 65) | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
  type L_Umaxalign (line 67) | typedef union { double u; void *s; lua_Integer i; long l; } L_Umaxalign;
  type LUAI_UACNUMBER (line 73) | typedef LUAI_UACNUMBER l_uacNumber;
  type LUAI_UACINT (line 74) | typedef LUAI_UACINT l_uacInt;
  type Instruction (line 164) | typedef unsigned int Instruction;
  type Instruction (line 166) | typedef unsigned long Instruction;

FILE: externals/lua/src/lmathlib.c
  function math_abs (line 39) | static int math_abs (lua_State *L) {
  function math_sin (line 50) | static int math_sin (lua_State *L) {
  function math_cos (line 55) | static int math_cos (lua_State *L) {
  function math_tan (line 60) | static int math_tan (lua_State *L) {
  function math_asin (line 65) | static int math_asin (lua_State *L) {
  function math_acos (line 70) | static int math_acos (lua_State *L) {
  function math_atan (line 75) | static int math_atan (lua_State *L) {
  function math_toint (line 83) | static int math_toint (lua_State *L) {
  function pushnumint (line 96) | static void pushnumint (lua_State *L, lua_Number d) {
  function math_floor (line 105) | static int math_floor (lua_State *L) {
  function math_ceil (line 116) | static int math_ceil (lua_State *L) {
  function math_fmod (line 127) | static int math_fmod (lua_State *L) {
  function math_modf (line 149) | static int math_modf (lua_State *L) {
  function math_sqrt (line 166) | static int math_sqrt (lua_State *L) {
  function math_ult (line 172) | static int math_ult (lua_State *L) {
  function math_log (line 179) | static int math_log (lua_State *L) {
  function math_exp (line 193) | static int math_exp (lua_State *L) {
  function math_deg (line 198) | static int math_deg (lua_State *L) {
  function math_rad (line 203) | static int math_rad (lua_State *L) {
  function math_min (line 209) | static int math_min (lua_State *L) {
  function math_max (line 223) | static int math_max (lua_State *L) {
  function math_random (line 241) | static int math_random (lua_State *L) {
  function math_randomseed (line 271) | static int math_randomseed (lua_State *L) {
  function math_type (line 278) | static int math_type (lua_State *L) {
  function math_cosh (line 300) | static int math_cosh (lua_State *L) {
  function math_sinh (line 305) | static int math_sinh (lua_State *L) {
  function math_tanh (line 310) | static int math_tanh (lua_State *L) {
  function math_pow (line 315) | static int math_pow (lua_State *L) {
  function math_frexp (line 322) | static int math_frexp (lua_State *L) {
  function math_ldexp (line 329) | static int math_ldexp (lua_State *L) {
  function math_log10 (line 336) | static int math_log10 (lua_State *L) {
  function LUAMOD_API (line 392) | LUAMOD_API int luaopen_math (lua_State *L) {

FILE: externals/lua/src/lmem.c
  function l_noret (line 68) | l_noret luaM_toobig (lua_State *L) {

FILE: externals/lua/src/loadlib.c
  function lsys_unloadlib (line 150) | static void lsys_unloadlib (void *lib) {
  function lua_CFunction (line 162) | static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) {
  function setprogdir (line 191) | static void setprogdir (lua_State *L) {
  function pusherror (line 206) | static void pusherror (lua_State *L) {
  function lsys_unloadlib (line 216) | static void lsys_unloadlib (void *lib) {
  function lua_CFunction (line 229) | static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) {
  function lsys_unloadlib (line 252) | static void lsys_unloadlib (void *lib) {
  function lua_CFunction (line 264) | static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) {
  function addtoclib (line 291) | static void addtoclib (lua_State *L, const char *path, void *plib) {
  function gctm (line 305) | static int gctm (lua_State *L) {
  function lookforfunc (line 332) | static int lookforfunc (lua_State *L, const char *path, const char *sym) {
  function ll_loadlib (line 353) | static int ll_loadlib (lua_State *L) {
  function readable (line 376) | static int readable (const char *filename) {
  function ll_searchpath (line 418) | static int ll_searchpath (lua_State *L) {
  function checkload (line 444) | static int checkload (lua_State *L, int stat, const char *filename) {
  function searcher_Lua (line 455) | static int searcher_Lua (lua_State *L) {
  function loadfunc (line 472) | static int loadfunc (lua_State *L, const char *filename, const char *mod...
  function searcher_C (line 490) | static int searcher_C (lua_State *L) {
  function searcher_Croot (line 498) | static int searcher_Croot (lua_State *L) {
  function searcher_preload (line 520) | static int searcher_preload (lua_State *L) {
  function findloader (line 529) | static void findloader (lua_State *L, const char *name) {
  function ll_require (line 557) | static int ll_require (lua_State *L) {
  function set_env (line 594) | static void set_env (lua_State *L) {
  function dooptions (line 606) | static void dooptions (lua_State *L, int n) {
  function modinit (line 618) | static void modinit (lua_State *L, const char *modname) {
  function ll_module (line 633) | static int ll_module (lua_State *L) {
  function ll_seeall (line 651) | static int ll_seeall (lua_State *L) {
  function noenv (line 675) | static int noenv (lua_State *L) {
  function setpath (line 684) | static void setpath (lua_State *L, const char *fieldname, const char *en...
  function createsearcherstable (line 728) | static void createsearcherstable (lua_State *L) {
  function createclibstable (line 752) | static void createclibstable (lua_State *L) {
  function LUAMOD_API (line 762) | LUAMOD_API int luaopen_package (lua_State *L) {

FILE: externals/lua/src/lobject.c
  function luaO_int2fb (line 39) | int luaO_int2fb (unsigned int x) {
  function luaO_fb2int (line 51) | int luaO_fb2int (int x) {
  function luaO_ceillog2 (line 58) | int luaO_ceillog2 (unsigned int x) {
  function lua_Integer (line 76) | static lua_Integer intarith (lua_State *L, int op, lua_Integer v1,
  function lua_Number (line 96) | static lua_Number numarith (lua_State *L, int op, lua_Number v1,
  function luaO_arith (line 116) | void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2,
  function luaO_hexavalue (line 156) | int luaO_hexavalue (int c) {
  function isneg (line 162) | static int isneg (const char **s) {
  function lua_Number (line 187) | static lua_Number lua_strx2number (const char *s, char **endptr) {
  function luaO_str2num (line 282) | size_t luaO_str2num (const char *s, TValue *o) {
  function luaO_utf8esc (line 297) | int luaO_utf8esc (char *buff, unsigned long x) {
  function luaO_tostring (line 322) | void luaO_tostring (lua_State *L, StkId obj) {
  function pushstr (line 341) | static void pushstr (lua_State *L, const char *str, size_t l) {
  function luaO_chunkid (line 435) | void luaO_chunkid (char *out, const char *source, size_t bufflen) {

FILE: externals/lua/src/lobject.h
  type GCObject (line 74) | typedef struct GCObject GCObject;
  type GCObject (line 87) | struct GCObject {
  type Value (line 96) | typedef union Value Value;
  type TValue (line 108) | typedef struct lua_TValue TValue;
  type lua_TValue (line 289) | struct lua_TValue {
  type TValue (line 294) | typedef TValue *StkId;
  type TString (line 303) | typedef struct TString {
  type UTString (line 315) | typedef union UTString {
  type Udata (line 337) | typedef struct Udata {
  type UUdata (line 349) | typedef union UUdata {
  type Upvaldesc (line 377) | typedef struct Upvaldesc {
  type LocVar (line 388) | typedef struct LocVar {
  type Proto (line 398) | typedef struct Proto {
  type UpVal (line 427) | typedef struct UpVal UpVal;
  type CClosure (line 437) | typedef struct CClosure {
  type LClosure (line 444) | typedef struct LClosure {
  type Closure (line 451) | typedef union Closure {
  type TKey (line 466) | typedef union TKey {
  type Node (line 482) | typedef struct Node {
  type Table (line 488) | typedef struct Table {

FILE: externals/lua/src/lopcodes.h
  type OpMode (line 32) | enum OpMode {iABC, iABx, iAsBx, iAx}
  type OpCode (line 165) | typedef enum {
  type OpArgMask (line 272) | enum OpArgMask {

FILE: externals/lua/src/loslib.c
  function os_execute (line 112) | static int os_execute (lua_State *L) {
  function os_remove (line 124) | static int os_remove (lua_State *L) {
  function os_rename (line 130) | static int os_rename (lua_State *L) {
  function os_tmpname (line 137) | static int os_tmpname (lua_State *L) {
  function os_getenv (line 148) | static int os_getenv (lua_State *L) {
  function os_clock (line 154) | static int os_clock (lua_State *L) {
  function setfield (line 168) | static void setfield (lua_State *L, const char *key, int value) {
  function setboolfield (line 173) | static void setboolfield (lua_State *L, const char *key, int value) {
  function getboolfield (line 180) | static int getboolfield (lua_State *L, const char *key) {
  function getfield (line 188) | static int getfield (lua_State *L, const char *key, int d) {
  function os_date (line 226) | static int os_date (lua_State *L) {
  function os_time (line 272) | static int os_time (lua_State *L) {
  function os_difftime (line 299) | static int os_difftime (lua_State *L) {
  function os_setlocale (line 308) | static int os_setlocale (lua_State *L) {
  function os_exit (line 320) | static int os_exit (lua_State *L) {
  function LUAMOD_API (line 352) | LUAMOD_API int luaopen_os (lua_State *L) {

FILE: externals/lua/src/lparser.c
  type BlockCnt (line 48) | typedef struct BlockCnt {
  function l_noret (line 67) | static l_noret semerror (LexState *ls, const char *msg) {
  function l_noret (line 73) | static l_noret error_expected (LexState *ls, int token) {
  function l_noret (line 79) | static l_noret errorlimit (FuncState *fs, int limit, const char *what) {
  function checklimit (line 92) | static void checklimit (FuncState *fs, int v, int l, const char *what) {
  function testnext (line 97) | static int testnext (LexState *ls, int c) {
  function check (line 106) | static void check (LexState *ls, int c) {
  function checknext (line 112) | static void checknext (LexState *ls, int c) {
  function check_match (line 122) | static void check_match (LexState *ls, int what, int who, int where) {
  function TString (line 135) | static TString *str_checkname (LexState *ls) {
  function init_exp (line 144) | static void init_exp (expdesc *e, expkind k, int i) {
  function codestring (line 151) | static void codestring (LexState *ls, expdesc *e, TString *s) {
  function checkname (line 156) | static void checkname (LexState *ls, expdesc *e) {
  function registerlocalvar (line 161) | static int registerlocalvar (LexState *ls, TString *varname) {
  function new_localvar (line 174) | static void new_localvar (LexState *ls, TString *name) {
  function new_localvarliteral_ (line 186) | static void new_localvarliteral_ (LexState *ls, const char *name, size_t...
  function LocVar (line 194) | static LocVar *getlocvar (FuncState *fs, int i) {
  function adjustlocalvars (line 201) | static void adjustlocalvars (LexState *ls, int nvars) {
  function removevars (line 210) | static void removevars (FuncState *fs, int tolevel) {
  function searchupvalue (line 217) | static int searchupvalue (FuncState *fs, TString *name) {
  function newupvalue (line 227) | static int newupvalue (FuncState *fs, TString *name, expdesc *v) {
  function searchvar (line 242) | static int searchvar (FuncState *fs, TString *n) {
  function markupval (line 256) | static void markupval (FuncState *fs, int level) {
  function singlevaraux (line 267) | static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int ba...
  function singlevar (line 293) | static void singlevar (LexState *ls, expdesc *var) {
  function adjust_assign (line 306) | static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *...
  function enterlevel (line 326) | static void enterlevel (LexState *ls) {
  function closegoto (line 336) | static void closegoto (LexState *ls, int g, Labeldesc *label) {
  function findlabel (line 360) | static int findlabel (LexState *ls, int g) {
  function newlabelentry (line 380) | static int newlabelentry (LexState *ls, Labellist *l, TString *name,
  function findgotos (line 398) | static void findgotos (LexState *ls, Labeldesc *lb) {
  function movegotosout (line 416) | static void movegotosout (FuncState *fs, BlockCnt *bl) {
  function enterblock (line 434) | static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) {
  function breaklabel (line 449) | static void breaklabel (LexState *ls) {
  function l_noret (line 459) | static l_noret undefgoto (LexState *ls, Labeldesc *gt) {
  function leaveblock (line 468) | static void leaveblock (FuncState *fs) {
  function Proto (line 494) | static Proto *addprototype (LexState *ls) {
  function codeclosure (line 516) | static void codeclosure (LexState *ls, expdesc *v) {
  function open_func (line 523) | static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {
  function close_func (line 546) | static void close_func (LexState *ls) {
  function block_follow (line 581) | static int block_follow (LexState *ls, int withuntil) {
  function statlist (line 592) | static void statlist (LexState *ls) {
  function fieldsel (line 604) | static void fieldsel (LexState *ls, expdesc *v) {
  function yindex (line 615) | static void yindex (LexState *ls, expdesc *v) {
  type ConsControl (line 631) | struct ConsControl {
  function recfield (line 640) | static void recfield (LexState *ls, struct ConsControl *cc) {
  function closelistfield (line 661) | static void closelistfield (FuncState *fs, struct ConsControl *cc) {
  function lastlistfield (line 672) | static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
  function listfield (line 687) | static void listfield (LexState *ls, struct ConsControl *cc) {
  function field (line 696) | static void field (LexState *ls, struct ConsControl *cc) {
  function constructor (line 718) | static void constructor (LexState *ls, expdesc *t) {
  function parlist (line 747) | static void parlist (LexState *ls) {
  function body (line 776) | static void body (LexState *ls, expdesc *e, int ismethod, int line) {
  function explist (line 798) | static int explist (LexState *ls, expdesc *v) {
  function funcargs (line 811) | static void funcargs (LexState *ls, expdesc *f, int line) {
  function primaryexp (line 865) | static void primaryexp (LexState *ls, expdesc *v) {
  function suffixedexp (line 887) | static void suffixedexp (LexState *ls, expdesc *v) {
  function simpleexp (line 925) | static void simpleexp (LexState *ls, expdesc *v) {
  function UnOpr (line 980) | static UnOpr getunopr (int op) {
  function BinOpr (line 991) | static BinOpr getbinopr (int op) {
  function BinOpr (line 1042) | static BinOpr subexpr (LexState *ls, expdesc *v, int limit) {
  function expr (line 1072) | static void expr (LexState *ls, expdesc *v) {
  function block (line 1087) | static void block (LexState *ls) {
  type LHS_assign (line 1101) | struct LHS_assign {
  function check_conflict (line 1113) | static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc...
  function assignment (line 1141) | static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
  function cond (line 1174) | static int cond (LexState *ls) {
  function gotostat (line 1184) | static void gotostat (LexState *ls, int pc) {
  function checkrepeated (line 1200) | static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) {
  function skipnoopstat (line 1214) | static void skipnoopstat (LexState *ls) {
  function labelstat (line 1220) | static void labelstat (LexState *ls, TString *label, int line) {
  function whilestat (line 1238) | static void whilestat (LexState *ls, int line) {
  function repeatstat (line 1257) | static void repeatstat (LexState *ls, int line) {
  function exp1 (line 1277) | static int exp1 (LexState *ls) {
  function forbody (line 1288) | static void forbody (LexState *ls, int base, int line, int nvars, int is...
  function fornum (line 1314) | static void fornum (LexState *ls, TString *varname, int line) {
  function forlist (line 1336) | static void forlist (LexState *ls, TString *indexname) {
  function forstat (line 1361) | static void forstat (LexState *ls, int line) {
  function test_then_block (line 1379) | static void test_then_block (LexState *ls, int *escapelist) {
  function ifstat (line 1414) | static void ifstat (LexState *ls, int line) {
  function localfunc (line 1428) | static void localfunc (LexState *ls) {
  function localstat (line 1439) | static void localstat (LexState *ls) {
  function funcname (line 1459) | static int funcname (LexState *ls, expdesc *v) {
  function funcstat (line 1473) | static void funcstat (LexState *ls, int line) {
  function exprstat (line 1485) | static void exprstat (LexState *ls) {
  function retstat (line 1501) | static void retstat (LexState *ls) {
  function statement (line 1534) | static void statement (LexState *ls) {
  function mainfunc (line 1609) | static void mainfunc (LexState *ls, FuncState *fs) {
  function LClosure (line 1623) | LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,

FILE: externals/lua/src/lparser.h
  type expkind (line 19) | typedef enum {
  type expdesc (line 41) | typedef struct expdesc {
  type Vardesc (line 59) | typedef struct Vardesc {
  type Labeldesc (line 65) | typedef struct Labeldesc {
  type Labellist (line 74) | typedef struct Labellist {
  type Dyndata (line 82) | typedef struct Dyndata {
  type BlockCnt (line 94) | struct BlockCnt
  type FuncState (line 98) | typedef struct FuncState {

FILE: externals/lua/src/lstate.c
  type LX (line 57) | typedef struct LX {
  type LG (line 66) | typedef struct LG {
  function makeseed (line 84) | static unsigned int makeseed (lua_State *L) {
  function luaE_setdebt (line 101) | void luaE_setdebt (global_State *g, l_mem debt) {
  function CallInfo (line 107) | CallInfo *luaE_extendCI (lua_State *L) {
  function luaE_freeCI (line 120) | void luaE_freeCI (lua_State *L) {
  function luaE_shrinkCI (line 134) | void luaE_shrinkCI (lua_State *L) {
  function stack_init (line 147) | static void stack_init (lua_State *L1, lua_State *L) {
  function freestack (line 167) | static void freestack (lua_State *L) {
  function init_registry (line 179) | static void init_registry (lua_State *L, global_State *g) {
  function f_luaopen (line 198) | static void f_luaopen (lua_State *L, void *ud) {
  function preinit_thread (line 219) | static void preinit_thread (lua_State *L, global_State *g) {
  function close_state (line 239) | static void close_state (lua_State *L) {
  function LUA_API (line 253) | LUA_API lua_State *lua_newthread (lua_State *L) {
  function luaE_freethread (line 283) | void luaE_freethread (lua_State *L, lua_State *L1) {
  function LUA_API (line 293) | LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
  function LUA_API (line 340) | LUA_API void lua_close (lua_State *L) {

FILE: externals/lua/src/lstate.h
  type lua_longjmp (line 33) | struct lua_longjmp
  type stringtable (line 49) | typedef struct stringtable {
  type CallInfo (line 65) | typedef struct CallInfo {
  type global_State (line 108) | typedef struct global_State {
  type lua_State (line 149) | struct lua_State {
  type TString (line 183) | struct TString
  type Udata (line 184) | struct Udata
  type Table (line 186) | struct Table
  type Proto (line 187) | struct Proto
  type lua_State (line 188) | struct lua_State

FILE: externals/lua/src/lstring.c
  function luaS_eqlngstr (line 38) | int luaS_eqlngstr (TString *a, TString *b) {
  function luaS_hash (line 47) | unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
  function luaS_resize (line 60) | void luaS_resize (lua_State *L, int newsize) {
  function TString (line 92) | static TString *createstrobj (lua_State *L, const char *str, size_t l,
  function luaS_remove (line 109) | void luaS_remove (lua_State *L, TString *ts) {
  function TString (line 122) | static TString *internshrstr (lua_State *L, const char *str, size_t l) {
  function TString (line 151) | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
  function TString (line 165) | TString *luaS_new (lua_State *L, const char *str) {
  function Udata (line 170) | Udata *luaS_newudata (lua_State *L, size_t s) {

FILE: externals/lua/src/lstrlib.c
  function str_len (line 49) | static int str_len (lua_State *L) {
  function lua_Integer (line 58) | static lua_Integer posrelat (lua_Integer pos, size_t len) {
  function str_sub (line 65) | static int str_sub (lua_State *L) {
  function str_reverse (line 79) | static int str_reverse (lua_State *L) {
  function str_lower (line 91) | static int str_lower (lua_State *L) {
  function str_upper (line 104) | static int str_upper (lua_State *L) {
  function str_rep (line 117) | static int str_rep (lua_State *L) {
  function str_byte (line 143) | static int str_byte (lua_State *L) {
  function str_char (line 162) | static int str_char (lua_State *L) {
  function writer (line 177) | static int writer (lua_State *L, const void *b, size_t size, void *B) {
  function str_dump (line 184) | static int str_dump (lua_State *L) {
  type MatchState (line 209) | typedef struct MatchState {
  function check_capture (line 237) | static int check_capture (MatchState *ms, int l) {
  function capture_to_close (line 245) | static int capture_to_close (MatchState *ms) {
  function match_class (line 277) | static int match_class (int c, int cl) {
  function matchbracketclass (line 297) | static int matchbracketclass (int c, const char *p, const char *ec) {
  function singlematch (line 320) | static int singlematch (MatchState *ms, const char *s, const char *p,
  function push_onecapture (line 545) | static void push_onecapture (MatchState *ms, int i, const char *s,
  function push_captures (line 564) | static int push_captures (MatchState *ms, const char *s, const char *e) {
  function nospecials (line 575) | static int nospecials (const char *p, size_t l) {
  function str_find_aux (line 586) | static int str_find_aux (lua_State *L, int find) {
  function str_find (line 638) | static int str_find (lua_State *L) {
  function str_match (line 643) | static int str_match (lua_State *L) {
  function gmatch_aux (line 648) | static int gmatch_aux (lua_State *L) {
  function gmatch (line 677) | static int gmatch (lua_State *L) {
  function add_s (line 687) | static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
  function add_value (line 715) | static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
  function str_gsub (line 746) | static int str_gsub (lua_State *L) {
  function addquoted (line 813) | static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
  function addlenmod (line 862) | static void addlenmod (char *form, const char *lenmod) {
  function str_format (line 872) | static int str_format (lua_State *L) {
  type cD (line 980) | struct cD {
  type Ftypes (line 991) | typedef union Ftypes {
  type Header (line 1002) | typedef struct Header {
  type KOption (line 1012) | typedef enum KOption {
  function digit (line 1029) | static int digit (int c) { return '0' <= c && c <= '9'; }
  function getnum (line 1031) | static int getnum (const char **fmt, int df) {
  function getnumlimit (line 1048) | static int getnumlimit (Header *h, const char **fmt, int df) {
  function initheader (line 1060) | static void initheader (lua_State *L, Header *h) {
  function KOption (line 1070) | static KOption getoption (Header *h, const char **fmt, int *size) {
  function KOption (line 1117) | static KOption getdetails (Header *h, size_t totalsize,
  function packint (line 1144) | static void packint (luaL_Buffer *b, lua_Unsigned n,
  function copywithendian (line 1165) | static void copywithendian (volatile char *dest, volatile const char *src,
  function str_pack (line 1179) | static int str_pack (lua_State *L) {
  function str_packsize (line 1263) | static int str_packsize (lua_State *L) {
  function lua_Integer (line 1296) | static lua_Integer unpackint (lua_State *L, const char *str,
  function str_unpack (line 1322) | static int str_unpack (lua_State *L) {
  function createmetatable (line 1410) | static void createmetatable (lua_State *L) {
  function LUAMOD_API (line 1425) | LUAMOD_API int luaopen_string (lua_State *L) {

FILE: externals/lua/src/ltable.c
  function numisinteger (line 91) | static int numisinteger (lua_Number x, lua_Integer *p) {
  function Node (line 101) | static Node *hashfloat (const Table *t, lua_Number n) {
  function Node (line 119) | static Node *mainposition (const Table *t, const TValue *key) {
  function arrayindex (line 151) | static unsigned int arrayindex (const TValue *key) {
  function findindex (line 166) | static unsigned int findindex (lua_State *L, Table *t, StkId key) {
  function luaH_next (line 193) | int luaH_next (lua_State *L, Table *t, StkId key) {
  function computesizes (line 225) | static unsigned int computesizes (unsigned int nums[], unsigned int *nar...
  function countint (line 247) | static int countint (const TValue *key, unsigned int *nums) {
  function numusearray (line 258) | static unsigned int numusearray (const Table *t, unsigned int *nums) {
  function numusehash (line 284) | static int numusehash (const Table *t, unsigned int *nums,
  function setarrayvector (line 301) | static void setarrayvector (lua_State *L, Table *t, unsigned int size) {
  function setnodevector (line 310) | static void setnodevector (lua_State *L, Table *t, unsigned int size) {
  function luaH_resize (line 335) | void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
  function luaH_resizearray (line 370) | void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) {
  function rehash (line 378) | static void rehash (lua_State *L, Table *t, const TValue *ek) {
  function Table (line 403) | Table *luaH_new (lua_State *L) {
  function luaH_free (line 415) | void luaH_free (lua_State *L, Table *t) {
  function Node (line 423) | static Node *getfreepos (Table *t) {
  function TValue (line 441) | TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
  function TValue (line 497) | const TValue *luaH_getint (Table *t, lua_Integer key) {
  function TValue (line 520) | const TValue *luaH_getstr (Table *t, TString *key) {
  function TValue (line 540) | const TValue *luaH_get (Table *t, const TValue *key) {
  function TValue (line 572) | TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
  function luaH_setint (line 580) | void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) {
  function unbound_search (line 594) | static int unbound_search (Table *t, unsigned int j) {
  function luaH_getn (line 622) | int luaH_getn (Table *t) {
  function Node (line 644) | Node *luaH_mainposition (const Table *t, const TValue *key) {
  function luaH_isdummy (line 648) | int luaH_isdummy (Node *n) { return isdummy(n); }

FILE: externals/lua/src/ltablib.c
  type TabA (line 26) | typedef struct {
  function checktab (line 36) | static void checktab (lua_State *L, int arg, TabA *ta) {
  function maxn (line 59) | static int maxn (lua_State *L) {
  function tinsert (line 76) | static int tinsert (lua_State *L) {
  function tremove (line 104) | static int tremove (lua_State *L) {
  function tmove (line 121) | static int tmove (lua_State *L) {
  function addfield (line 156) | static void addfield (lua_State *L, luaL_Buffer *b, TabA *ta, lua_Intege...
  function tconcat (line 165) | static int tconcat (lua_State *L) {
  function pack (line 192) | static int pack (lua_State *L) {
  function unpack (line 205) | static int unpack (lua_State *L) {
  function set2 (line 236) | static void set2 (lua_State *L, TabA *ta, int i, int j) {
  function sort_comp (line 241) | static int sort_comp (lua_State *L, int a, int b) {
  function auxsort (line 256) | static void auxsort (lua_State *L, TabA *ta, int l, int u) {
  function sort (line 319) | static int sort (lua_State *L) {
  function LUAMOD_API (line 348) | LUAMOD_API int luaopen_table (lua_State *L) {

FILE: externals/lua/src/ltm.c
  function luaT_init (line 37) | void luaT_init (lua_State *L) {
  function TValue (line 59) | const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
  function TValue (line 70) | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
  function luaT_callTM (line 86) | void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
  function luaT_callbinTM (line 103) | int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
  function luaT_trybinTM (line 114) | void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
  function luaT_callorderTM (line 136) | int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2,

FILE: externals/lua/src/ltm.h
  type TMS (line 18) | typedef enum {

FILE: externals/lua/src/lua.c
  function lstop (line 111) | static void lstop (lua_State *L, lua_Debug *ar) {
  function laction (line 124) | static void laction (int i) {
  function print_usage (line 130) | static void print_usage (const char *badoption) {
  function l_message (line 155) | static void l_message (const char *pname, const char *msg) {
  function report (line 166) | static int report (lua_State *L, int status) {
  function msghandler (line 179) | static int msghandler (lua_State *L) {
  function docall (line 198) | static int docall (lua_State *L, int narg, int nres) {
  function print_version (line 212) | static void print_version (void) {
  function createargtable (line 226) | static void createargtable (lua_State *L, char **argv, int argc, int scr...
  function dochunk (line 239) | static int dochunk (lua_State *L, int status) {
  function dofile (line 245) | static int dofile (lua_State *L, const char *name) {
  function dostring (line 250) | static int dostring (lua_State *L, const char *s, const char *name) {
  function dolibrary (line 259) | static int dolibrary (lua_State *L, const char *name) {
  function incomplete (line 291) | static int incomplete (lua_State *L, int status) {
  function pushline (line 307) | static int pushline (lua_State *L, int firstline) {
  function addreturn (line 332) | static int addreturn (lua_State *L) {
  function multiline (line 350) | static int multiline (lua_State *L) {
  function loadline (line 370) | static int loadline (lua_State *L) {
  function l_print (line 387) | static void l_print (lua_State *L) {
  function doREPL (line 404) | static void doREPL (lua_State *L) {
  function pushargs (line 423) | static int pushargs (lua_State *L) {
  function handle_script (line 436) | static int handle_script (lua_State *L, char **argv) {
  function collectargs (line 464) | static int collectargs (char **argv, int *first) {
  function runargs (line 513) | static int runargs (lua_State *L, char **argv, int n) {
  function handle_luainit (line 534) | static int handle_luainit (lua_State *L) {
  function pmain (line 553) | static int pmain (lua_State *L) {
  function main (line 595) | int main (int argc, char **argv) {

FILE: externals/lua/src/lua.h
  type lua_State (line 54) | typedef struct lua_State lua_State;
  type LUA_NUMBER (line 87) | typedef LUA_NUMBER lua_Number;
  type LUA_INTEGER (line 91) | typedef LUA_INTEGER lua_Integer;
  type LUA_UNSIGNED (line 94) | typedef LUA_UNSIGNED lua_Unsigned;
  type LUA_KCONTEXT (line 97) | typedef LUA_KCONTEXT lua_KContext;
  type lua_Debug (line 416) | typedef struct lua_Debug lua_Debug;
  type lua_Debug (line 440) | struct lua_Debug {

FILE: externals/lua/src/luac.c
  function fatal (line 38) | static void fatal(const char* message)
  function cannot (line 44) | static void cannot(const char* what)
  function usage (line 50) | static void usage(const char* message)
  function doargs (line 72) | static int doargs(int argc, char* argv[])
  function Proto (line 139) | static const Proto* combine(lua_State* L, int n)
  function writer (line 159) | static int writer(lua_State* L, const void* p, size_t size, void* u)
  function pmain (line 165) | static int pmain(lua_State* L)
  function main (line 192) | int main(int argc, char* argv[])
  function PrintString (line 226) | static void PrintString(const TString* ts)
  function PrintConstant (line 254) | static void PrintConstant(const Proto* f, int i)
  function PrintCode (line 288) | static void PrintCode(const Proto* f)
  function PrintHeader (line 395) | static void PrintHeader(const Proto* f)
  function PrintDebug (line 415) | static void PrintDebug(const Proto* f)
  function PrintFunction (line 442) | static void PrintFunction(const Proto* f, int full)

FILE: externals/lua/src/lundump.c
  type LoadState (line 32) | typedef struct {
  function l_noret (line 40) | static l_noret error(LoadState *S, const char *why) {
  function LoadBlock (line 52) | static void LoadBlock (LoadState *S, void *b, size_t size) {
  function lu_byte (line 61) | static lu_byte LoadByte (LoadState *S) {
  function LoadInt (line 68) | static int LoadInt (LoadState *S) {
  function lua_Number (line 75) | static lua_Number LoadNumber (LoadState *S) {
  function lua_Integer (line 82) | static lua_Integer LoadInteger (LoadState *S) {
  function TString (line 89) | static TString *LoadString (LoadState *S) {
  function LoadCode (line 103) | static void LoadCode (LoadState *S, Proto *f) {
  function LoadConstants (line 114) | static void LoadConstants (LoadState *S, Proto *f) {
  function LoadProtos (line 148) | static void LoadProtos (LoadState *S, Proto *f) {
  function LoadUpvalues (line 162) | static void LoadUpvalues (LoadState *S, Proto *f) {
  function LoadDebug (line 176) | static void LoadDebug (LoadState *S, Proto *f) {
  function LoadFunction (line 198) | static void LoadFunction (LoadState *S, Proto *f, TString *psource) {
  function checkliteral (line 215) | static void checkliteral (LoadState *S, const char *s, const char *msg) {
  function fchecksize (line 224) | static void fchecksize (LoadState *S, size_t size, const char *tname) {
  function checkHeader (line 232) | static void checkHeader (LoadState *S) {
  function LClosure (line 254) | LClosure *luaU_undump(lua_State *L, ZIO *Z, Mbuffer *buff,

FILE: externals/lua/src/lutf8lib.c
  function lua_Integer (line 29) | static lua_Integer u_posrelat (lua_Integer pos, size_t len) {
  function utflen (line 70) | static int utflen (lua_State *L) {
  function codepoint (line 99) | static int codepoint (lua_State *L) {
  function pushutfchar (line 127) | static void pushutfchar (lua_State *L, int arg) {
  function utfchar (line 137) | static int utfchar (lua_State *L) {
  function byteoffset (line 159) | static int byteoffset (lua_State *L) {
  function iter_aux (line 200) | static int iter_aux (lua_State *L) {
  function iter_codes (line 224) | static int iter_codes (lua_State *L) {
  type luaL_Reg (line 237) | struct luaL_Reg
  function LUAMOD_API (line 249) | LUAMOD_API int luaopen_utf8 (lua_State *L) {

FILE: externals/lua/src/lvm.c
  function tofloat (line 51) | static int tofloat (const TValue *obj, lua_Number *n) {
  function luaV_tonumber_ (line 69) | int luaV_tonumber_ (const TValue *obj, lua_Number *n) {
  function tointeger_aux (line 91) | static int tointeger_aux (const TValue *obj, lua_Integer *p, int mode) {
  function luaV_tointeger_ (line 120) | int luaV_tointeger_ (const TValue *obj, lua_Integer *p) {
  function forlimit (line 140) | static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step,
  function luaV_gettable (line 164) | void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId va...
  function luaV_settable (line 194) | void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId va...
  function l_strcmp (line 240) | static int l_strcmp (const TString *ls, const TString *rs) {
  function luaV_lessthan (line 266) | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
  function luaV_lessequal (line 284) | int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
  function luaV_equalobj (line 305) | int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) {
  function luaV_concat (line 361) | void luaV_concat (lua_State *L, int total) {
  function luaV_objlen (line 404) | void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {
  function lua_Integer (line 435) | lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) {
  function lua_Integer (line 455) | lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) {
  function lua_Integer (line 476) | lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) {
  function LClosure (line 493) | static LClosure *getcached (Proto *p, UpVal **encup, StkId base) {
  function pushclosure (line 515) | static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base,
  function luaV_finishOp (line 539) | void luaV_finishOp (lua_State *L) {
  function luaV_execute (line 650) | void luaV_execute (lua_State *L) {

FILE: externals/lua/src/lzio.c
  function luaZ_fill (line 23) | int luaZ_fill (ZIO *z) {
  function luaZ_init (line 38) | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
  function luaZ_read (line 48) | size_t luaZ_read (ZIO *z, void *b, size_t n) {

FILE: externals/lua/src/lzio.h
  type ZIO (line 18) | typedef struct Zio ZIO;
  type Mbuffer (line 23) | typedef struct Mbuffer {
  type Zio (line 56) | struct Zio {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_DistortionRenderer.cpp
  type OVR (line 39) | namespace OVR { namespace CAPI {
    type CAPI (line 39) | namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_DistortionRenderer.h
  function namespace (line 38) | namespace OVR { namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_DistortionTiming.cpp
  type OVR (line 33) | namespace OVR { namespace CAPI {
    type CAPI (line 33) | namespace CAPI {
      function calculateFrameStartTime (line 87) | static double calculateFrameStartTime(double now,

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_DistortionTiming.h
  function namespace (line 67) | namespace OVR { namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_FrameLatencyTracker.cpp
  type OVR (line 30) | namespace OVR { namespace CAPI {
    type CAPI (line 30) | namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_FrameLatencyTracker.h
  function namespace (line 36) | namespace OVR { namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_FrameTimeManager3.cpp
  type OVR (line 33) | namespace OVR { namespace CAPI { namespace FTM3 {
    type CAPI (line 33) | namespace CAPI { namespace FTM3 {
      type FTM3 (line 33) | namespace FTM3 {
        function LogTime (line 40) | void LogTime(const char* msg)
        function quick_select (line 381) | static double quick_select(double arr[], int n)

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_FrameTimeManager3.h
  function namespace (line 35) | namespace OVR { namespace CAPI { namespace FTM3 {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_HMDRenderState.cpp
  type OVR (line 30) | namespace OVR { namespace CAPI {
    type CAPI (line 30) | namespace CAPI {
      function ovrHmdDesc (line 36) | ovrHmdDesc HMDRenderState::GetDesc() const
      function ovrSizei (line 128) | ovrSizei HMDRenderState::GetFOVTextureSize(int eye, ovrFovPort fov, ...
      function ovrEyeRenderDesc (line 135) | ovrEyeRenderDesc HMDRenderState::CalcRenderDesc(ovrEyeType eyeType, ...

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_HMDRenderState.h
  function namespace (line 35) | namespace OVR { namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_HMDState.cpp
  type OVR (line 48) | namespace OVR { namespace CAPI {
    type CAPI (line 48) | namespace CAPI {
      function Vector3f (line 188) | static Vector3f GetNeckModelFromProfile(Profile* profile)
      function GetCenterPupilDepthFromRenderInfo (line 207) | static float GetCenterPupilDepthFromRenderInfo(HmdRenderInfo* hmdRen...
      function HMDState (line 272) | HMDState* HMDState::CreateHMDState(NetClient* client, const HMDNetwo...
      function HMDState (line 304) | HMDState* HMDState::CreateDebugHMDState(ovrHmdType hmdType)
      function ovrTrackingState (line 355) | ovrTrackingState HMDState::PredictedTrackingState(double absTime, vo...
      function CopyFloatArrayWithLimit (line 514) | static unsigned CopyFloatArrayWithLimit(float dest[], unsigned destS...
      function AppTiming (line 695) | AppTiming HMDState::GetAppTiming(uint32_t frameIndex)
      function ovrFrameTiming (line 708) | ovrFrameTiming HMDState::GetFrameTiming(uint32_t frameIndex)
      function ovrTrackingState (line 733) | ovrTrackingState HMDState::GetMidpointPredictionTracking(uint32_t fr...
      function Posef (line 740) | Posef HMDState::GetEyePredictionPose(ovrEyeType eye)

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_HMDState.h
  type ovrHmdStruct (line 47) | struct ovrHmdStruct { }
  function namespace (line 49) | namespace OVR { namespace CAPI {
  function checkBeginFrameScope (line 187) | void checkBeginFrameScope(const char* functionName)
  function checkRenderingConfigured (line 196) | void checkRenderingConfigured(const char* functionName)
  function checkBeginFrameTimingScope (line 203) | void checkBeginFrameTimingScope(const char* functionName)
  function VirtualHmdId (line 222) | VirtualHmdId GetNetId() { return NetId; }

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_HSWDisplay.cpp
  type OVR (line 72) | namespace OVR { namespace CAPI {
    type CAPI (line 72) | namespace CAPI {
      function String (line 310) | static String getHSWTimeKey(const char* userName)
      function time_t (line 323) | time_t HSWDisplay::GetCurrentProfileLastHSWTime() const

FILE: externals/ovr-0.5.0.1/Src/CAPI/CAPI_HSWDisplay.h
  function namespace (line 81) | namespace OVR { namespace CAPI {

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D1X/CAPI_D3D11_DistortionRenderer.cpp
  type OVR (line 37) | namespace OVR { namespace CAPI { namespace D3D11 {
    type CAPI (line 37) | namespace CAPI { namespace D3D11 {
      type D3D11 (line 37) | namespace D3D11 {
        function interface (line 54) | interface IOVRDXGISwapChain : IUnknown
        type PrecompiledShader (line 72) | struct PrecompiledShader
        function DistortionShaderBitIndexCheck (line 110) | void DistortionShaderBitIndexCheck()
        type DistortionVertex (line 117) | struct DistortionVertex         // Must match the VB description D...
        type DistortionComputePin (line 126) | struct DistortionComputePin     // Must match the ones declared in...
        type Vertex (line 138) | struct Vertex
          method Vertex (line 145) | Vertex(const Vector3f& p, const Color& c = Color(64, 0, 0, 255),
          method Vertex (line 149) | Vertex(float x, float y, float z, const Color& c = Color(64, 0, ...
        function ID3D11SamplerState (line 1374) | ID3D11SamplerState* DistortionRenderer::getSamplerState(int sm)

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D1X/CAPI_D3D11_DistortionRenderer.h
  function namespace (line 35) | namespace OVR { namespace CAPI { namespace D3D11 {

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D1X/CAPI_D3D11_HSWDisplay.cpp
  function DXGI_FORMAT (line 42) | static DXGI_FORMAT GetFullyTypedDXGIFormat(DXGI_FORMAT textureFormat)
  type OVR (line 96) | namespace OVR { namespace CAPI {
    type CAPI (line 96) | namespace CAPI {
      type D3D11 (line 101) | namespace D3D11 {
        function Texture (line 104) | Texture* LoadTextureTga(RenderParams& rParams, ID3D11SamplerState*...
        function Texture (line 152) | Texture* LoadTextureTga(RenderParams& rParams, ID3D11SamplerState*...
        function Texture (line 161) | Texture* LoadTextureTga(RenderParams& rParams, ID3D11SamplerState*...
        type HASWVertex (line 174) | struct HASWVertex
          method HASWVertex (line 180) | HASWVertex(const Vector3f& p, const Color& c = Color(64, 0, 0, 2...
          method HASWVertex (line 184) | HASWVertex(float x, float y, float z, const Color& c = Color(64,...

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D1X/CAPI_D3D11_HSWDisplay.h
  function namespace (line 33) | namespace OVR { namespace CAPI { namespace D3D11 {

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D1X/CAPI_D3D11_Util.cpp
  type OVR (line 29) | namespace OVR { namespace CAPI { namespace D3D11 {
    type CAPI (line 29) | namespace CAPI { namespace D3D11 {
      type D3D11 (line 29) | namespace D3D11 {

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D1X/CAPI_D3D11_Util.h
  function namespace (line 37) | namespace OVR { namespace CAPI { namespace D3D11 {
  function class (line 149) | class ShaderSet : public RefCountBase<ShaderSet>
  function SetUniformv (line 208) | bool SetUniformv(const char* name, const Vector3f& v)
  function virtual (line 214) | virtual bool SetUniform4x4f(const char* name, const Matrix4f& m)
  function virtual (line 219) | virtual bool SetUniform3x3f(const char* name, const Matrix4f& m)
  function class (line 231) | class ShaderFill : public RefCountBase<ShaderFill>
  function class (line 262) | class ShaderBase : public Shader
  type ShaderImpl (line 322) | typedef ShaderImpl<Shader_Vertex,  ID3D11VertexShader> VertexShader;
  type ShaderImpl (line 323) | typedef ShaderImpl<Shader_Fragment, ID3D11PixelShader> PixelShader;
  type ShaderImpl (line 324) | typedef ShaderImpl<Shader_Compute, ID3D11ComputeShader> ComputeShader;
  function class (line 327) | class Buffer : public RefCountBase<Buffer>
  function class (line 366) | class Texture : public RefCountBase<Texture>
  function class (line 450) | class GpuTimer : public RefCountBase<GpuTimer>

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D9/CAPI_D3D9_DistortionRenderer.cpp
  type OVR (line 35) | namespace OVR { namespace CAPI { namespace D3D9 {
    type CAPI (line 35) | namespace CAPI { namespace D3D9 {
      type D3D9 (line 35) | namespace D3D9 {
        function ConvertSRGB (line 273) | static void ConvertSRGB(unsigned char c[3])

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D9/CAPI_D3D9_DistortionRenderer.h
  function namespace (line 37) | namespace OVR { namespace CAPI { namespace D3D9 {

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D9/CAPI_D3D9_HSWDisplay.cpp
  type OVR (line 39) | namespace OVR { namespace CAPI {
    type CAPI (line 39) | namespace CAPI {
      type D3D9 (line 46) | namespace D3D9 {
        function IDirect3DTexture9 (line 49) | IDirect3DTexture9* LoadTextureTga(HSWRenderParams& rParams, OVR::F...
        function IDirect3DTexture9 (line 116) | IDirect3DTexture9* LoadTextureTga(HSWRenderParams& rParams, const ...
        function IDirect3DTexture9 (line 125) | IDirect3DTexture9* LoadTextureTga(HSWRenderParams& rParams, const ...
        type HASWVertex (line 138) | struct HASWVertex
          method HASWVertex (line 144) | HASWVertex(const Vector3f& p, const Color& c = Color(64,0,0,255)...
          method HASWVertex (line 148) | HASWVertex(float x, float y, float z, const Color& c = Color(64,...

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D9/CAPI_D3D9_HSWDisplay.h
  function namespace (line 33) | namespace OVR { namespace CAPI { namespace D3D9 {

FILE: externals/ovr-0.5.0.1/Src/CAPI/D3D9/CAPI_D3D9_Util.cpp
  type OVR (line 31) | namespace OVR { namespace CAPI { namespace D3D9 {
    type CAPI (line 31) | namespace CAPI { namespace D3D9 {
      type D3D9 (line 31) | namespace D3D9 {
        function ID3DBlob (line 112) | ID3DBlob* ShaderCompile(char * shaderName, const char * shaderSrcS...

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp
  type ShaderInfo (line 53) | struct ShaderInfo
  function DistortionShaderBitIndexCheck (line 79) | void DistortionShaderBitIndexCheck()
  type DistortionVertex (line 86) | struct DistortionVertex
  type LatencyVertex (line 98) | struct LatencyVertex
    method LatencyVertex (line 101) | LatencyVertex (const Vector3f& p) : Pos(p) {}
  type _XDisplay (line 391) | struct _XDisplay

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
  type StandardUniformData (line 119) | struct StandardUniformData

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_DistortionShaders.h
  function namespace (line 34) | namespace OVR { namespace CAPI { namespace GL {

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp
  type OVR (line 40) | namespace OVR { namespace CAPI {
    type CAPI (line 40) | namespace CAPI {
      type GL (line 163) | namespace GL {
        type HASWVertex (line 167) | struct HASWVertex
          method HASWVertex (line 173) | HASWVertex(const Vector3f& p, const Color& c = Color(64,0,0,255)...
          method HASWVertex (line 177) | HASWVertex(float x, float y, float z, const Color& c = Color(64,...
        function Texture (line 190) | Texture* LoadTextureTga(RenderParams& rParams, int samplerMode, OV...
        function Texture (line 224) | Texture* LoadTextureTga(RenderParams& rParams, int samplerMode, co...

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_HSWDisplay.h
  function namespace (line 35) | namespace OVR { namespace CAPI { namespace GL {

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_Util.cpp
  class MacContextImpl (line 41) | class MacContextImpl
    method MacContextImpl (line 44) | MacContextImpl(NSOpenGLContext* ctxIn, NSOpenGLPixelFormat* fmt) :
    method MacContextImpl (line 48) | MacContextImpl(NSOpenGLContext* ctxIn) :
  type OVR (line 80) | namespace OVR {
    type CAPI (line 92) | namespace CAPI { namespace GL {
      type GL (line 92) | namespace GL {
        function InitGLExtensions (line 95) | void InitGLExtensions()
        function GLint (line 173) | GLint ShaderSet::GetGLShader(Shader* s)

FILE: externals/ovr-0.5.0.1/Src/CAPI/GL/CAPI_GL_Util.h
  function namespace (line 54) | namespace OVR
  function namespace (line 61) | namespace OVR { namespace CAPI { namespace GL {
  function class (line 216) | class ShaderSet : public RefCountBase<ShaderSet>
  function SetUniformv (line 279) | bool SetUniformv(const char* name, const Vector3f& v)
  function virtual (line 285) | virtual bool SetUniform4x4f(const char* name, const Matrix4f& m)
  function virtual (line 291) | virtual bool SetUniform3x3f(const char* name, const Matrix4f& m)
  function class (line 307) | class ShaderFill : public RefCountBase<ShaderFill>
  type DisplayId (line 335) | struct DisplayId
  function class (line 361) | class ShaderBase : public Shader
  function Compile (line 438) | bool Compile(const char* src)
  type ShaderImpl (line 468) | typedef ShaderImpl<Shader_Vertex,  GL_VERTEX_SHADER> VertexShader;
  type ShaderImpl (line 469) | typedef ShaderImpl<Shader_Fragment, GL_FRAGMENT_SHADER> FragmentShader;
  function class (line 474) | class Context
  function AutoContext (line 521) | struct AutoContext

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Display.cpp
  type OVR (line 31) | namespace OVR {
    type EDID_Header (line 77) | struct EDID_Header
    type EDID_Detailed_Timing_Descriptor (line 91) | struct EDID_Detailed_Timing_Descriptor
    type EDID_Other_Descriptor (line 148) | struct EDID_Other_Descriptor
    function StripTrailingWhitespace (line 159) | static void StripTrailingWhitespace(char* str)
    function HmdTypeEnum (line 259) | HmdTypeEnum HmdTypeFromModelNumber(int modelNumber)

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Display.h
  type DisplayEDID (line 49) | struct DisplayEDID
  type DisplayDesc (line 72) | struct DisplayDesc
  function class (line 87) | class DisplaySearchHandle

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_OSX_Display.cpp
  type OVR (line 38) | namespace OVR {
    function blockType (line 80) | static int blockType( UByte* block )
    function parseEdid (line 116) | static bool parseEdid( UByte* edid, OVR::OSX::DisplayEDID& edidResult )
    function discoverExtendedRifts (line 186) | static int discoverExtendedRifts(OVR::OSX::DisplayDesc* descriptorArra...
    function DisplaySearchHandle (line 330) | DisplaySearchHandle* Display::GetDisplaySearchHandle()

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_OSX_Display.h
  function namespace (line 32) | namespace OVR { namespace OSX {

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_Display.cpp
  type OVR (line 76) | namespace OVR {
    function ULONG (line 82) | ULONG getRiftCount( HANDLE hDevice )
    function ULONG (line 96) | ULONG getRift( HANDLE hDevice, int index )
    function getEdid (line 124) | static bool getEdid(HANDLE hDevice, ULONG uid, DisplayEDID& edid)
    function GetMonitorEDID (line 179) | static bool GetMonitorEDID(const wchar_t* deviceID, DisplayEDID& edid)
    function FillDisplayDesc (line 244) | static bool FillDisplayDesc(DXGI_OUTPUT_DESC const& outputDesc, DISPLA...
    function DiscoverRiftMonitors (line 300) | static int DiscoverRiftMonitors(DisplayDesc* descriptorArray = nullptr...
    function DisplaySearchHandle (line 555) | DisplaySearchHandle* Display::GetDisplaySearchHandle()
    function SetDisplayPower (line 669) | static bool SetDisplayPower(HANDLE hDevice, ULONG childId, int mode)

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_Display.h
  function namespace (line 34) | namespace OVR { namespace Win32 {

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_Dxgi_Display.h
  type HANDLE (line 75) | typedef HMODULE  (WINAPI *WinLoadLibraryExA) ( LPCSTR, HANDLE, DWORD  );
  type HANDLE (line 76) | typedef HMODULE  (WINAPI *WinLoadLibraryExW) ( LPCWSTR, HANDLE, DWORD  );
  type LPCSTR (line 77) | typedef BOOL     (WINAPI *WinGetModuleHandleExA)( DWORD, LPCSTR, HMODULE...
  type LPCWSTR (line 78) | typedef BOOL     (WINAPI *WinGetModuleHandleExW)( DWORD, LPCWSTR, HMODUL...
  type UINT (line 109) | typedef BOOL  (WINAPI *IsInitializingDisplay) ( PVOID, UINT, UINT );
  type HANDLE (line 117) | typedef BOOL (WINAPI *CloseRiftForContext)( PVOID, HANDLE, ULONG );
  type UINT (line 118) | typedef BOOL (WINAPI *WindowDisplayResolution)( PVOID, UINT*, UINT*, UIN...
  type UINT (line 133) | typedef BOOL (WINAPI *ExpectedResolution)( PVOID, UINT*, UINT*, UINT* );
  type LINK_APPLICATION_DRIVER (line 156) | typedef struct _LINK_APPLICATION_DRIVER
  type LPCSTR (line 196) | typedef HRESULT (WINAPI *PreloadLibraryFn) ( WinLoadLibraryA , LPCSTR, P...
  type QUERY_KM_DRIVER (line 202) | typedef struct _QUERY_KM_DRIVER
  type UINT (line 210) | typedef UINT D3DKMT_HANDLE;
  type HandleNotepad (line 213) | typedef struct _HandleNotepad
  type ALLOC_PRIVATE_STRUCTURE (line 237) | typedef struct _ALLOC_PRIVATE_STRUCTURE
  type ESCAPE_STRUCTURE (line 254) | typedef struct _ESCAPE_STRUCTURE
  type RIFT_SYNC (line 267) | typedef struct _RIFT_SYNC
  type RIFT_MODE (line 273) | typedef struct _RIFT_MODE
  type RIFT_STATUS (line 281) | typedef struct _RIFT_STATUS
  type RIFT_STATUS_ARRAY (line 289) | typedef struct _RIFT_STATUS_ARRAY

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_FocusReader.cpp
  type OVR (line 33) | namespace OVR { namespace Win32 {
    type Win32 (line 33) | namespace Win32 {
      function HWND (line 36) | HWND RenderFocusReader::ReadActiveWindow()

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_FocusReader.h
  function namespace (line 35) | namespace OVR { namespace Win32 {

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_RenderShim.cpp
  type OVRTargetAPI (line 81) | enum OVRTargetAPI
  function CHAR (line 91) | static CHAR* ReadRegStr(HKEY keySub, const char* keyName, const char* va...
  type ShimedLibraries (line 164) | enum ShimedLibraries
  function checkForOverride (line 196) | static bool checkForOverride( LPCSTR libFileName, OVRTargetAPI& targetApi )
  function HMODULE (line 261) | static HMODULE createShim( LPCSTR lpLibFileName, OVRTargetAPI targetAPI )
  function HMODULE (line 294) | static HMODULE
  function HMODULE (line 308) | static HMODULE
  function HMODULE (line 325) | static HMODULE
  function HMODULE (line 344) | static HMODULE
  function BOOL (line 364) | static BOOL WINAPI OVRGetModuleHandleExA(
  function BOOL (line 383) | static BOOL WINAPI OVRGetModuleHandleExW(
  function restoreFunction (line 405) | static void restoreFunction( PROC pfnHookAPIAddr, PBYTE oldData )
  function setFunction (line 419) | static void setFunction( PROC pfnHookAPIAddr, PROC replacementFunction, ...
  function restoreFunction (line 444) | static void restoreFunction( PROC pfnHookAPIAddr, PBYTE oldData )
  function setFunction (line 458) | static void setFunction( PROC pfnHookAPIAddr, PROC replacementFunction, ...
  function BOOL (line 480) | static BOOL WINAPI OVRLocalIsInitializingDisplay( PVOID context, UINT wi...
  function HRESULT (line 516) | HRESULT APIENTRY OVRDirect3DCreate9Ex(UINT SDKVersion, void** aDevice)
  function HRESULT (line 550) | HRESULT APIENTRY OVRCreateDXGIFactory(
  function HRESULT (line 576) | HRESULT APIENTRY OVRCreateDXGIFactory1(
  function HRESULT (line 602) | HRESULT APIENTRY OVRCreateDXGIFactory2(
  function PROC (line 629) | static PROC SetProcAddressDirect(
  function PROC (line 653) | static PROC SetProcAddressA(
  function clearUMDriverOverrides (line 726) | void clearUMDriverOverrides()
  function checkUMDriverOverrides (line 827) | bool checkUMDriverOverrides(void* context)

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_ShimFunctions.cpp
  function BOOL (line 56) | BOOL WINAPI OVRIsInitializingDisplay(PVOID context, UINT width, UINT hei...
  function BOOL (line 65) | BOOL WINAPI OVRExpectedResolution( PVOID context, UINT* width, UINT* hei...
  function BOOL (line 75) | BOOL WINAPI OVRIsCreatingBackBuffer(PVOID context)
  function BOOL (line 84) | BOOL WINAPI OVRShouldVSync( )
  function ULONG (line 90) | ULONG WINAPI OVRRiftForContext(PVOID context, HANDLE driverHandle)
  function HWND (line 98) | HWND WINAPI OVRGetWindowForContext(PVOID context)
  function BOOL (line 112) | BOOL WINAPI OVRShouldPresentOnContext(PVOID context)
  function BOOL (line 119) | BOOL WINAPI OVRCloseRiftForContext( PVOID context, HANDLE driverHandle, ...
  function BOOL (line 126) | BOOL WINAPI OVRWindowDisplayResolution( PVOID context, UINT* width, UINT...
  function BOOL (line 164) | BOOL WINAPI OVRShouldEnableDebug()
  function BOOL (line 169) | BOOL WINAPI OVRMirroringEnabled( PVOID context )
  function ovr_GetDX11SwapChain (line 181) | ovr_GetDX11SwapChain()
  type OVR (line 188) | namespace OVR { namespace Win32 {
    type Win32 (line 188) | namespace Win32 {

FILE: externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_ShimFunctions.h
  function namespace (line 32) | namespace OVR {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_BitStream.cpp
  type OVR (line 35) | namespace OVR { namespace Net {
    type Net (line 35) | namespace Net {
      function BitSize_t (line 733) | BitSize_t BitStream::GetNumberOfBitsAllocated(void) const
      function BitSize_t (line 893) | BitSize_t BitStream::CopyData( unsigned char** _data ) const

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_BitStream.h
  function namespace (line 40) | namespace OVR { namespace Net {
  function SerializeNormVector (line 930) | bool BitStream::SerializeNormVector(bool writeToBitstream, templateType ...
  function SerializeVector (line 940) | bool BitStream::SerializeVector(bool writeToBitstream,  templateType &x,...
  function SerializeNormQuat (line 950) | bool BitStream::SerializeNormQuat(bool writeToBitstream,  templateType &...
  function SerializeOrthMatrix (line 960) | bool BitStream::SerializeOrthMatrix(
  function SerializeBits (line 973) | inline bool BitStream::SerializeBits(bool writeToBitstream, unsigned cha...
  function Write (line 983) | void BitStream::Write(const templateType &inTemplateVar)
  function WritePtr (line 1006) | void BitStream::WritePtr(templateType *inTemplateVar)
  function Write (line 1031) | inline void BitStream::Write(const bool &inTemplateVar)
  function Write (line 1043) | inline void BitStream::Write(const OVR::String &inTemplateVar)
  function Write (line 1050) | inline void BitStream::Write(const char * const &inStringVar)
  function Write (line 1057) | inline void BitStream::Write(const unsigned char * const &inTemplateVar)
  function Write (line 1062) | inline void BitStream::Write(char * const &inTemplateVar)
  function Write (line 1067) | inline void BitStream::Write(unsigned char * const &inTemplateVar)
  function WriteDelta (line 1078) | void BitStream::WriteDelta(const templateType &currentValue, const templ...
  function WriteDelta (line 1095) | inline void BitStream::WriteDelta(const bool &currentValue, const bool &...
  function WriteDelta (line 1105) | void BitStream::WriteDelta(const templateType &currentValue)
  function WriteCompressed (line 1118) | void BitStream::WriteCompressed(const templateType &inTemplateVar)
  function WriteCompressed (line 1145) | inline void BitStream::WriteCompressed(const bool &inTemplateVar)
  function WriteCompressed (line 1152) | inline void BitStream::WriteCompressed(const float &inTemplateVar)
  function WriteCompressed (line 1165) | inline void BitStream::WriteCompressed(const double &inTemplateVar)
  function WriteCompressedDelta (line 1185) | void BitStream::WriteCompressedDelta(const templateType &currentValue, c...
  function WriteCompressedDelta (line 1202) | inline void BitStream::WriteCompressedDelta(const bool &currentValue, co...
  function WriteCompressedDelta (line 1212) | void BitStream::WriteCompressedDelta(const templateType &currentValue)
  function WriteCompressedDelta (line 1221) | inline void BitStream::WriteCompressedDelta(const bool &currentValue)
  function Read (line 1229) | bool BitStream::Read(templateType &outTemplateVar)
  function Read (line 1261) | inline bool BitStream::Read(bool &outTemplateVar)
  function Read (line 1278) | inline bool BitStream::Read(OVR::String &outTemplateVar)
  function Read (line 1296) | inline bool BitStream::Read(char *&varString)
  function Read (line 1313) | inline bool BitStream::Read(unsigned char *&varString)
  function ReadDelta (line 1336) | bool BitStream::ReadDelta(templateType &outTemplateVar)
  function ReadDelta (line 1349) | inline bool BitStream::ReadDelta(bool &outTemplateVar)
  function ReadCompressed (line 1361) | bool BitStream::ReadCompressed(templateType &outTemplateVar)
  function ReadCompressed (line 1388) | inline bool BitStream::ReadCompressed(bool &outTemplateVar)
  function ReadCompressed (line 1395) | inline bool BitStream::ReadCompressed(float &outTemplateVar)
  function ReadCompressed (line 1408) | inline bool BitStream::ReadCompressed(double &outTemplateVar)
  function ReadCompressedDelta (line 1429) | bool BitStream::ReadCompressedDelta(templateType &outTemplateVar)
  function ReadCompressedDelta (line 1442) | inline bool BitStream::ReadCompressedDelta(bool &outTemplateVar)

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_MessageIDTypes.h
  function namespace (line 27) | namespace OVR { namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_NetworkPlugin.cpp
  type OVR (line 29) | namespace OVR { namespace Net { namespace Plugins {
    type Net (line 29) | namespace Net { namespace Plugins {
      type Plugins (line 29) | namespace Plugins {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_NetworkPlugin.h
  function namespace (line 33) | namespace OVR { namespace Net { namespace Plugins {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_NetworkTypes.h
  function namespace (line 33) | namespace OVR {	namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_PacketizedTCPSocket.cpp
  type OVR (line 29) | namespace OVR { namespace Net {
    type Net (line 29) | namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_PacketizedTCPSocket.h
  function namespace (line 41) | namespace OVR { namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_RPC1.cpp
  type OVR (line 32) | namespace OVR { namespace Net { namespace Plugins {
    type Net (line 32) | namespace Net { namespace Plugins {
      type Plugins (line 32) | namespace Plugins {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_RPC1.h
  function namespace (line 39) | namespace OVR { namespace Net { namespace Plugins {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Session.cpp
  type OVR (line 32) | namespace OVR { namespace Net {
    type Net (line 32) | namespace Net {
      function SessionResult (line 188) | SessionResult Session::Listen(ListenerDescription* pListenerDescript...
      function SessionResult (line 211) | SessionResult Session::Connect(ConnectParameters *cp)
      function SessionResult (line 302) | SessionResult Session::ListenPTCP(OVR::Net::BerkleyBindParameters *bbp)
      function SessionResult (line 324) | SessionResult Session::ConnectPTCP(OVR::Net::BerkleyBindParameters* ...

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Session.h
  function namespace (line 42) | namespace OVR { namespace Net {
  function class (line 270) | class TCPConnection : public NetworkConnection
  function class (line 287) | class PacketizedTCPConnection : public TCPConnection
  function class (line 302) | class ListenerDescription
  function class (line 316) | class BerkleyListenerDescription : public ListenerDescription
  type ReceivePayload (line 336) | struct ReceivePayload
  function class (line 345) | class BroadcastParameters
  function class (line 367) | class SendParameters
  type ConnectParameters (line 391) | struct ConnectParameters
  function ConnectParameters (line 402) | struct ConnectParametersBerkleySocket : public ConnectParameters
  type ListenerReceiveResult (line 421) | enum ListenerReceiveResult
  function class (line 438) | class SessionListener
  function virtual (line 482) | virtual ~Session()

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Socket.cpp
  type OVR (line 29) | namespace OVR { namespace Net {
    type Net (line 29) | namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Socket.h
  function namespace (line 51) | namespace OVR { namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Unix_Socket.cpp
  type OVR (line 35) | namespace OVR { namespace Net {
    type Net (line 35) | namespace Net {
      function SInt32 (line 49) | SInt32 BerkleySocket::GetSockname(SockAddr *pSockAddrOut)
      function BitStream (line 66) | BitStream& operator<<(BitStream& out, SockAddr& in)
      function BitStream (line 72) | BitStream& operator>>(BitStream& in, SockAddr& out)
      type addrinfo (line 122) | struct addrinfo
      type addrinfo (line 140) | struct addrinfo
      function UInt16 (line 161) | UInt16 SockAddr::GetPort()
      function String (line 166) | String SockAddr::ToString(bool writePort, char portDelineator) const
      function SetSocketOptions (line 222) | static bool SetSocketOptions(SocketHandle sock)
      function _Ioctlsocket (line 275) | void _Ioctlsocket(SocketHandle sock, unsigned long nonblocking)
      function SocketHandle (line 284) | static SocketHandle BindShared(int ai_family, int ai_socktype, Berkl...
      function SocketHandle (line 350) | SocketHandle UDPSocket::Bind(BerkleyBindParameters *pBindParameters)
      type sockaddr_storage (line 381) | struct sockaddr_storage
      function SocketHandle (line 431) | SocketHandle TCPSocket::Bind(BerkleyBindParameters* pBindParameters)
      type sockaddr (line 465) | struct sockaddr
      type sockaddr_storage (line 584) | struct sockaddr_storage

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Unix_Socket.h
  function namespace (line 41) | namespace Net {

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Win32_Socket.cpp
  type OVR (line 36) | namespace OVR { namespace Net {
    type Net (line 36) | namespace Net {
      class WSAStartupSingleton (line 42) | class WSAStartupSingleton
      type sockaddr_in6 (line 103) | struct sockaddr_in6
      function BitStream (line 118) | BitStream& operator<<(BitStream& out, SockAddr& in)
      function BitStream (line 124) | BitStream& operator>>(BitStream& in, SockAddr& out)
      type addrinfo (line 182) | struct addrinfo
      type addrinfo (line 197) | struct addrinfo
      function String (line 223) | String SockAddr::ToString(bool writePort, char portDelineator) const
      function SetSocketOptions (line 277) | static bool SetSocketOptions(SocketHandle sock)
      function _Ioctlsocket (line 298) | void _Ioctlsocket(SocketHandle sock, unsigned long nonblocking)
      function SocketHandle (line 303) | static SocketHandle BindShared(int ai_family, int ai_socktype, Berkl...
      function SocketHandle (line 367) | SocketHandle UDPSocket::Bind(BerkleyBindParameters *pBindParameters)
      type sockaddr_storage (line 392) | struct sockaddr_storage
      function SocketHandle (line 446) | SocketHandle TCPSocket::Bind(BerkleyBindParameters* pBindParameters)
      type sockaddr (line 482) | struct sockaddr
      type sockaddr_storage (line 598) | struct sockaddr_storage

FILE: externals/ovr-0.5.0.1/Src/Net/OVR_Win32_Socket.h
  function namespace (line 39) | namespace Net {

FILE: externals/ovr-0.5.0.1/Src/OVR_CAPI.cpp
  function CaptureHmdDescTrace (line 64) | static bool CaptureHmdDescTrace(const OVR::CAPI::HMDState* state)
  function ovrTrackingState (line 73) | static ovrTrackingState GetNullTrackingState()
  function ovrFrameTiming (line 81) | static ovrFrameTiming GetNullFrameTiming()
  type OVR (line 95) | namespace OVR {
  function HMDState (line 154) | static HMDState* GetHMDStateFromOvrHmd(ovrHmd hmddesc)
  function ovr_GetTimeInSeconds (line 163) | ovr_GetTimeInSeconds()
  function ovrBool (line 177) | ovrBool ovr_InitializeRenderingShim()
  function ovr_InitializeRenderingShimVersion (line 184) | ovr_InitializeRenderingShimVersion(int requestedMinorVersion)
  function LogLocationOfThisModule (line 196) | static void LogLocationOfThisModule()
  function ovr_Initialize (line 236) | ovr_Initialize(ovrInitParams const* params)
  function ovr_Shutdown (line 339) | ovr_Shutdown()
  function ovrHmd_Detect (line 368) | ovrHmd_Detect()
  function ovrHmd_Create (line 381) | ovrHmd_Create(int index)
  function ovrHmd_AttachToWindow (line 447) | ovrHmd_AttachToWindow(ovrHmd hmddesc, void* window,
  function ovrHmd_CreateDebug (line 474) | ovrHmd_CreateDebug(ovrHmdType type)
  function ovrHmd_Destroy (line 486) | ovrHmd_Destroy(ovrHmd hmddesc)
  function ovrHmd_GetLastError (line 511) | ovrHmd_GetLastError(ovrHmd hmddesc)
  function ovr_GetVersionString (line 529) | ovr_GetVersionString()
  function ovrHmd_GetEnabledCaps (line 542) | ovrHmd_GetEnabledCaps(ovrHmd hmddesc)
  function ovrHmd_SetEnabledCaps (line 553) | ovrHmd_SetEnabledCaps(ovrHmd hmddesc, unsigned int capsBits)
  function ovrHmd_ConfigureTracking (line 578) | ovrHmd_ConfigureTracking(ovrHmd hmddesc, unsigned int supportedCaps,
  function ovrHmd_RecenterPose (line 589) | ovrHmd_RecenterPose(ovrHmd hmddesc)
  function ovrHmd_GetTrackingState (line 598) | ovrHmd_GetTrackingState(ovrHmd hmddesc, double absTime)
  function ovrHmd_GetFovTextureSize (line 615) | ovrHmd_GetFovTextureSize(ovrHmd hmddesc, ovrEyeType eye,
  function ovrHmd_ConfigureRendering (line 629) | ovrHmd_ConfigureRendering(ovrHmd hmddesc,
  function ovrHmd_BeginFrame (line 643) | ovrHmd_BeginFrame(ovrHmd hmddesc, unsigned int frameIndex)
  function ovrHmd_EndFrame (line 670) | ovrHmd_EndFrame(ovrHmd hmddesc,
  function ovrHmd_RegisterPostDistortionCallback (line 729) | ovrHmd_RegisterPostDistortionCallback(ovrHmd hmddesc, PostDistortionCall...
  function ovrHmd_GetFrameTiming (line 743) | ovrHmd_GetFrameTiming(ovrHmd hmddesc, unsigned int frameIndex)
  function ovrHmd_BeginFrameTiming (line 759) | ovrHmd_BeginFrameTiming(ovrHmd hmddesc, unsigned int frameIndex)
  function ovrHmd_EndFrameTiming (line 792) | ovrHmd_EndFrameTiming(ovrHmd hmddesc)
  function ovrHmd_ResetFrameTiming (line 808) | ovrHmd_ResetFrameTiming(ovrHmd hmddesc, unsigned int frameIndex)
  function ovrHmd_GetEyePoses (line 821) | ovrHmd_GetEyePoses(ovrHmd hmddesc, unsigned int frameIndex, const ovrVec...
  function ovrHmd_GetHmdPosePerEye (line 861) | ovrHmd_GetHmdPosePerEye(ovrHmd hmddesc, ovrEyeType eye)
  function ovrHmd_AddDistortionTimeMeasurement (line 876) | ovrHmd_AddDistortionTimeMeasurement(ovrHmd hmddesc, double distortionTim...
  function ovrHmd_GetEyeTimewarpMatricesDebug (line 887) | ovrHmd_GetEyeTimewarpMatricesDebug(ovrHmd hmddesc, ovrEyeType eye, ovrPo...
  function ovrHmd_GetEyeTimewarpMatrices (line 917) | ovrHmd_GetEyeTimewarpMatrices(ovrHmd hmddesc, ovrEyeType eye, ovrPosef r...
  function ovrHmd_GetRenderDesc (line 935) | ovrHmd_GetRenderDesc(ovrHmd hmddesc,
  function ovrHmd_CreateDistortionMeshDebug (line 949) | ovrHmd_CreateDistortionMeshDebug(ovrHmd hmddesc,
  function ovrHmd_CreateDistortionMesh (line 973) | ovrHmd_CreateDistortionMesh(ovrHmd hmddesc,
  function ovrHmd_DestroyDistortionMesh (line 991) | ovrHmd_DestroyDistortionMesh(ovrDistortionMesh* meshData)
  function ovrHmd_GetRenderScaleAndOffset (line 1012) | ovrHmd_GetRenderScaleAndOffset(ovrFovPort fov,
  function ovrHmd_GetLatencyTestDrawColor (line 1040) | ovrHmd_GetLatencyTestDrawColor(ovrHmd hmddesc, unsigned char rgbColorOut...
  function ovrHmd_ProcessLatencyTest (line 1056) | ovrHmd_ProcessLatencyTest(ovrHmd hmddesc, unsigned char rgbColorOut[3])
  function ovrHmd_GetLatencyTestResult (line 1069) | ovrHmd_GetLatencyTestResult(ovrHmd hmddesc)
  function ovrHmd_GetLatencyTest2DrawColor (line 1076) | ovrHmd_GetLatencyTest2DrawColor(ovrHmd hmddesc, unsigned char rgbColorOu...
  function ovrHmd_GetMeasuredLatencyTest2 (line 1110) | ovrHmd_GetMeasuredLatencyTest2(ovrHmd hmddesc)
  function ovrHmd_GetHSWDisplayState (line 1126) | ovrHmd_GetHSWDisplayState(ovrHmd hmddesc, ovrHSWDisplayState *hswDisplay...
  function ovrHmd_DismissHSWDisplay (line 1144) | ovrHmd_DismissHSWDisplay(ovrHmd hmddesc)
  function ovrHmd_GetBool (line 1162) | ovrHmd_GetBool(ovrHmd hmddesc,
  function ovrHmd_SetBool (line 1183) | ovrHmd_SetBool(ovrHmd hmddesc,
  function ovrHmd_GetInt (line 1204) | ovrHmd_GetInt(ovrHmd hmddesc,
  function ovrHmd_SetInt (line 1223) | ovrHmd_SetInt(ovrHmd hmddesc,
  function ovrHmd_GetFloat (line 1244) | ovrHmd_GetFloat(ovrHmd hmddesc,
  function ovrHmd_SetFloat (line 1263) | ovrHmd_SetFloat(ovrHmd hmddesc,
  function ovrHmd_GetFloatArray (line 1284) | ovrHmd_GetFloatArray(ovrHmd hmddesc,
  function ovrHmd_SetFloatArray (line 1300) | ovrHmd_SetFloatArray(ovrHmd hmddesc,
  function ovrHmd_GetString (line 1315) | ovrHmd_GetString(ovrHmd hmddesc,
  function ovrHmd_SetString (line 1338) | ovrHmd_SetString(ovrHmd hmddesc,
  function ovr_TraceMessage (line 1377) | ovr_TraceMessage(int level, const char* message)
  function ovrHmd_StartPerfLog (line 1405) | ovrHmd_StartPerfLog(ovrHmd hmddesc, const char* fileName, const char* us...
  function ovrHmd_StopPerfLog (line 1412) | ovrHmd_StopPerfLog(ovrHmd hmddesc)

FILE: externals/ovr-0.5.0.1/Src/OVR_Profile.cpp
  type OVR (line 62) | namespace OVR {
    function String (line 90) | String ProfileDeviceKey::SanitizeProductName(String productName)
    function String (line 122) | String GetBaseOVRPath(bool create_dir)
    function String (line 196) | String ProfileManager::GetProfilePath()
    function JSON (line 201) | static JSON* FindTaggedData(JSON* data, const char** tag_names, const ...
    function FilterTaggedData (line 244) | static void FilterTaggedData(JSON* data, const char* tag_name, const c...
    function ProfileManager (line 280) | ProfileManager* OVR::SystemSingletonBase<ProfileManager>::SlowGetInsta...
    function Profile (line 343) | Profile* ProfileManager::GetDefaultProfile(HmdTypeEnum device)
    function Profile (line 788) | Profile* ProfileManager::CreateProfile()
    function Profile (line 872) | Profile* ProfileManager::GetTaggedProfile(const char** tag_names, cons...
    function Profile (line 1049) | Profile* ProfileManager::GetDefaultUserProfile(const ProfileDeviceKey&...
    function Profile (line 1064) | Profile* ProfileManager::GetProfile(const ProfileDeviceKey& deviceKey,...
    function BCDByte (line 1198) | static int BCDByte(unsigned int byte)

FILE: externals/ovr-0.5.0.1/Src/OVR_Profile.h
  function namespace (line 44) | namespace OVR {
  function class (line 153) | class Profile : public RefCountBase<Profile>

FILE: externals/ovr-0.5.0.1/Src/OVR_SerialFormat.cpp
  type OVR (line 39) | namespace OVR {
    function SerialFormatType (line 44) | SerialFormatType DetectBufferFormat(uint8_t firstByte, int sizeInBytes)
    function ValidDK2ProductId (line 64) | static bool ValidDK2ProductId(int x)
    function ValidDK2PartId (line 79) | static bool ValidDK2PartId(int x)
    function String (line 297) | String DK2PrintedSerialFormat::ToBase32()

FILE: externals/ovr-0.5.0.1/Src/OVR_SerialFormat.h
  function namespace (line 36) | namespace OVR {

FILE: externals/ovr-0.5.0.1/Src/OVR_Stereo.cpp
  type OVR (line 40) | namespace OVR {
    function FitCubicPolynomial (line 53) | bool FitCubicPolynomial ( float *pResult, const float *pFitX, const fl...
    function EvalCatmullRom10Spline (line 100) | float EvalCatmullRom10Spline ( float const *K, float scaledVal )
    function SetEyeCup (line 174) | void SetEyeCup(HmdRenderInfo* renderInfo, const char* cup)
    function Vector3f (line 237) | Vector3f LensConfig::DistortionFnScaleRadiusSquaredChroma (float rsq) ...
    type LensConfigStoredVersion (line 428) | enum LensConfigStoredVersion
    type LensConfigStored_CatmullRom10Version1 (line 435) | struct LensConfigStored_CatmullRom10Version1
    function EncodeFixedPointUInt16 (line 447) | uint16_t EncodeFixedPointUInt16 ( float val, uint16_t zeroVal, int fra...
    function DecodeFixedPointUInt16 (line 457) | float DecodeFixedPointUInt16 ( uint16_t val, uint16_t zeroVal, int fra...
    function LoadLensConfig (line 468) | bool LoadLensConfig ( LensConfig *presult, uint8_t const *pbuffer, int...
    function SaveLensConfigSizeInBytes (line 534) | int SaveLensConfigSizeInBytes ( LensConfig const &config )
    function SaveLensConfig (line 541) | bool SaveLensConfig ( uint8_t *pbuffer, int bufferSizeInBytes, LensCon...
    function TestSaveLoadLensConfig (line 587) | void TestSaveLoadLensConfig ( LensConfig const &config )
    function ProfileRenderInfo (line 628) | ProfileRenderInfo GenerateProfileRenderInfoFromProfile( HMDInfo const&...
    function HMDInfo (line 702) | HMDInfo CreateDebugHMDInfo(HmdTypeEnum hmdType)
    function HmdRenderInfo (line 785) | HmdRenderInfo GenerateHmdRenderInfoFromHmdInfo ( HMDInfo const &hmdInfo,
    function ExtEvalCatmullRom10Spline (line 2090) | float ExtEvalCatmullRom10Spline ( float const *K, float scaledVal )

FILE: externals/ovr-0.5.0.1/Src/OVR_Stereo.h
  type ovrFovPort (line 39) | typedef struct ovrFovPort_ ovrFovPort;
  type ovrRecti (line 40) | typedef struct ovrRecti_ ovrRecti;
  function namespace (line 42) | namespace OVR {
  type DistortionRenderDesc (line 146) | struct DistortionRenderDesc
  type ExtraMonitorInfo (line 182) | struct ExtraMonitorInfo
  function SetScreenParameters (line 332) | void SetScreenParameters(int hres, int vres,
  function IsSameDisplay (line 344) | bool IsSameDisplay(const HMDInfo& o) const
  type ShutterInfo (line 388) | struct ShutterInfo
  type EyeConfig (line 400) | struct EyeConfig
  function EyeConfig (line 442) | EyeConfig GetEyeCenter() const
  function Vector2f (line 594) | inline Vector2f TransformTanFovSpaceToRendertargetNDC ( StereoEyeParams ...

FILE: externals/ovr-0.5.0.1/Src/Sensors/OVR_DeviceConstants.h
  type ovrSensorData_ (line 35) | struct ovrSensorData_
  type ovrSensorData (line 36) | typedef struct ovrSensorData_ ovrSensorData;
  type DeviceType (line 44) | enum DeviceType
  type DistortionEqnType (line 59) | enum DistortionEqnType
  type HmdTypeEnum (line 77) | enum HmdTypeEnum
  type HmdShutterTypeEnum (line 102) | enum HmdShutterTypeEnum
  type EyeCupType (line 117) | enum EyeCupType
  function class (line 149) | class SensorDataType

FILE: externals/ovr-0.5.0.1/Src/Service/Service_NetClient.cpp
  type OVR (line 36) | namespace OVR { namespace Service {
    type Service (line 36) | namespace Service {

FILE: externals/ovr-0.5.0.1/Src/Service/Service_NetClient.h
  function namespace (line 36) | namespace OVR { namespace Service {

FILE: externals/ovr-0.5.0.1/Src/Service/Service_NetSessionCommon.cpp
  type OVR (line 30) | namespace OVR { namespace Service {
    type Service (line 30) | namespace Service {
      function SerializeUInt32 (line 85) | static bool SerializeUInt32(bool write, Net::BitStream* bitStream, T...
      function SerializeBool (line 104) | static bool SerializeBool(bool write, Net::BitStream* bitStream, boo...
      function IsInStringArray (line 210) | bool IsInStringArray(const char* a[], const char* key)

FILE: externals/ovr-0.5.0.1/Src/Service/Service_NetSessionCommon.h
  function namespace (line 39) | namespace OVR {
  function class (line 103) | class NetSessionCommon : public Thread

FILE: externals/ovr-0.5.0.1/Src/Service/Service_Win32_FastIPC_Client.cpp
  type OVR (line 29) | namespace OVR { namespace Service { namespace Win32 {
    type Service (line 29) | namespace Service { namespace Win32 {
      type Win32 (line 29) | namespace Win32 {

FILE: externals/ovr-0.5.0.1/Src/Service/Service_Win32_FastIPC_Client.h
  function namespace (line 34) | namespace OVR { namespace Service { namespace Win32 {

FILE: externals/ovr-0.5.0.1/Src/Util/Util_LatencyTest2Reader.cpp
  type OVR (line 29) | namespace OVR { namespace Util {
    type Util (line 29) | namespace Util {
      function FrameTimeRecord (line 74) | const FrameTimeRecord& FrameTimeRecordSet::operator [] (int i) const
      function FrameTimeRecord (line 79) | const FrameTimeRecord& FrameTimeRecordSet::GetMostRecentFrame()

FILE: externals/ovr-0.5.0.1/Src/Util/Util_LatencyTest2Reader.h
  function namespace (line 33) | namespace OVR { namespace Util {

FILE: externals/ovr-0.5.0.1/Src/Util/Util_LatencyTest2State.h
  function namespace (line 32) | namespace OVR { namespace Util {

FILE: externals/ovr-0.5.0.1/Src/Util/Util_MatFile.cpp
  type OVR (line 36) | namespace OVR { namespace Util {
    type Util (line 36) | namespace Util {
      type Fmatrix (line 64) | struct Fmatrix

FILE: externals/ovr-0.5.0.1/Src/Util/Util_MatFile.h
  function namespace (line 36) | namespace OVR { namespace Util {

FILE: externals/ovr-0.5.0.1/Src/Util/Util_Render_Stereo.cpp
  type OVR (line 29) | namespace OVR { namespace Util { namespace Render {
    type Util (line 29) | namespace Util { namespace Render {
      type Render (line 29) | namespace Render {
        type DistortionAndFov (line 89) | struct DistortionAndFov
        function DistortionAndFov (line 95) | static DistortionAndFov CalculateDistortionAndFovInternal ( Stereo...
        function Recti (line 123) | static Recti CalculateViewportInternal ( StereoEye eyeType,
        function Recti (line 153) | static Recti CalculateViewportDensityInternal ( StereoEye eyeType,
        function ViewportScaleAndOffset (line 173) | static ViewportScaleAndOffset CalculateViewportScaleAndOffsetInter...
        function StereoEyeParams (line 186) | static StereoEyeParams CalculateStereoEyeParamsInternal ( StereoEy...
        function Vector3f (line 232) | Vector3f CalculateEyeVirtualCameraOffset(HmdRenderInfo const &hmd,
        function Sizei (line 260) | Sizei CalculateRecommendedTextureSize ( HmdRenderInfo const &hmd,
        function StereoEyeParams (line 287) | StereoEyeParams CalculateStereoEyeParams ( HmdRenderInfo const &hmd,
        function FovPort (line 326) | FovPort CalculateRecommendedFov ( HmdRenderInfo const &hmd,
        function ViewportScaleAndOffset (line 346) | ViewportScaleAndOffset ModifyRenderViewport ( StereoEyeParams cons...
        function ViewportScaleAndOffset (line 353) | ViewportScaleAndOffset ModifyRenderSize ( StereoEyeParams const &p...
        function ViewportScaleAndOffset (line 362) | ViewportScaleAndOffset ModifyRenderDensity ( StereoEyeParams const...
        function StereoEyeParamsWithOrtho (line 452) | const StereoEyeParamsWithOrtho& StereoConfig::GetEyeRenderParams(S...
        function Sizei (line 537) | Sizei StereoConfig::CalculateRecommendedTextureSize ( bool rendert...
        function ViewportScaleAndOffsetBothEyes (line 689) | ViewportScaleAndOffsetBothEyes StereoConfig::setupViewportScaleAnd...
        function ViewportScaleAndOffsetBothEyes (line 753) | ViewportScaleAndOffsetBothEyes StereoConfig::SetRenderDensity ( fl...
        function ViewportScaleAndOffsetBothEyes (line 761) | ViewportScaleAndOffsetBothEyes StereoConfig::SetRenderSize ( Sizei...
        function ViewportScaleAndOffsetBothEyes (line 770) | ViewportScaleAndOffsetBothEyes StereoConfig::SetRenderViewport ( R...
        function Matrix4f (line 778) | Matrix4f StereoConfig::GetProjectionWithZoom ( StereoEye eye, floa...
        function DistortionMeshVertexData (line 808) | DistortionMeshVertexData DistortionMeshMakeVertex ( Vector2f scree...
        function DistortionMeshDestroy (line 919) | void DistortionMeshDestroy ( DistortionMeshVertexData *pVertices, ...
        function DistortionMeshCreate (line 925) | void DistortionMeshCreate ( DistortionMeshVertexData **ppVertices,...
        function DistortionMeshCreate (line 943) | void DistortionMeshCreate( DistortionMeshVertexData **ppVertices, ...
        function HeightmapMeshDestroy (line 1085) | void HeightmapMeshDestroy ( HeightmapMeshVertexData *pVertices, ui...
        function HeightmapMeshCreate (line 1091) | void HeightmapMeshCreate ( HeightmapMeshVertexData **ppVertices, u...
        function HeightmapMeshCreate (line 1109) | void HeightmapMeshCreate( HeightmapMeshVertexData **ppVertices, ui...
        function PredictionValues (line 1271) | PredictionValues PredictionGetDeviceValues ( const HmdRenderInfo &...
        function Matrix4f (line 1337) | Matrix4f TimewarpComputePoseDelta ( Matrix4f const &renderedViewFr...
        function Matrix4f (line 1371) | Matrix4f TimewarpComputePoseDeltaPosition ( Matrix4f const &render...

FILE: externals/ovr-0.5.0.1/Src/Util/Util_Render_Stereo.h
  function namespace (line 34) | namespace OVR { namespace Util { namespace Render {

FILE: externals/ovr-0.5.0.1/Src/Vision/SensorFusion/Vision_SensorState.h
  function namespace (line 38) | namespace OVR { namespace Vision {

FILE: externals/ovr-0.5.0.1/Src/Vision/SensorFusion/Vision_SensorStateReader.cpp
  type OVR (line 30) | namespace OVR { namespace Vision {
    type Vision (line 30) | namespace Vision {
      function calcPredictedPose (line 41) | static Pose<double> calcPredictedPose(const PoseState<double>& poseS...
      function calcPredictedPoseState (line 72) | PoseState<float> calcPredictedPoseState(const LocklessSensorState& s...

FILE: externals/ovr-0.5.0.1/Src/Vision/SensorFusion/Vision_SensorStateReader.h
  type ovrTrackingState_ (line 37) | struct ovrTrackingState_
  type ovrTrackingState (line 38) | typedef struct ovrTrackingState_ ovrTrackingState;
  function namespace (line 40) | namespace Vision {

FILE: externals/ovr-0.5.0.1/Src/Vision/Vision_Common.h
  type ovrPoseStatef (line 37) | typedef struct ovrPoseStatef_ ovrPoseStatef;
  type ovrPoseStated (line 38) | typedef struct ovrPoseStated_ ovrPoseStated;
  function namespace (line 40) | namespace OVR { namespace Vision {
  type PoseState (line 244) | typedef PoseState<float>  PoseStatef;
  type PoseState (line 245) | typedef PoseState<double> PoseStated;
  type CompatibleTypes (line 248) | struct CompatibleTypes
  type ovrPoseStatef (line 248) | typedef ovrPoseStatef Type;
  type CompatibleTypes (line 249) | struct CompatibleTypes
  type ovrPoseStated (line 249) | typedef ovrPoseStated Type;

FILE: externals/ovr/Src/CAPI/CAPI_DistortionRenderer.cpp
  type OVR (line 48) | namespace OVR { namespace CAPI {
    type CAPI (line 48) | namespace CAPI {

FILE: externals/ovr/Src/CAPI/CAPI_DistortionRenderer.h
  function namespace (line 35) | namespace OVR { namespace CAPI {

FILE: externals/ovr/Src/CAPI/CAPI_FrameTimeManager.cpp
  type OVR (line 31) | namespace OVR { namespace CAPI {
    type CAPI (line 31) | namespace CAPI {
      function ovrTrackingState (line 555) | ovrTrackingState FrameTimeManager::GetEyePredictionTracking(ovrHmd h...
      function Posef (line 571) | Posef FrameTimeManager::GetEyePredictionPose(ovrHmd hmd, ovrEyeType ...
      function CalculateListMedianRecursive (line 864) | double CalculateListMedianRecursive(const double inputList[TimeDelta...

FILE: externals/ovr/Src/CAPI/CAPI_FrameTimeManager.h
  function namespace (line 35) | namespace OVR { namespace CAPI {

FILE: externals/ovr/Src/CAPI/CAPI_HMDRenderState.cpp
  type OVR (line 29) | namespace OVR { namespace CAPI {
    type CAPI (line 29) | namespace CAPI {
      function ovrHmdDesc (line 35) | ovrHmdDesc HMDRenderState::GetDesc() const
      function ovrSizei (line 120) | ovrSizei HMDRenderState::GetFOVTextureSize(int eye, ovrFovPort fov, ...
      function ovrEyeRenderDesc (line 127) | ovrEyeRenderDesc HMDRenderState::CalcRenderDesc(ovrEyeType eyeType, ...

FILE: externals/ovr/Src/CAPI/CAPI_HMDRenderState.h
  function namespace (line 35) | namespace OVR { namespace CAPI {

FILE: externals/ovr/Src/CAPI/CAPI_HMDState.cpp
  type OVR (line 35) | namespace OVR { namespace CAPI {
    type CAPI (line 35) | namespace CAPI {
      function Vector3f (line 181) | static Vector3f GetNeckModelFromProfile(Profile* profile)
      function GetCenterPupilDepthFromRenderInfo (line 200) | static float GetCenterPupilDepthFromRenderInfo(HmdRenderInfo* hmdRen...
      function HMDState (line 257) | HMDState* HMDState::CreateHMDState(NetClient* client, const HMDNetwo...
      function HMDState (line 292) | HMDState* HMDState::CreateHMDState(ovrHmdType hmdType)
      function ovrTrackingState (line 333) | ovrTrackingState HMDState::PredictedTrackingState(double absTime)
      function CopyFloatArrayWithLimit (line 506) | static unsigned CopyFloatArrayWithLimit(float dest[], unsigned destS...
      type X (line 537) | struct X {
      function ovrBool (line 758) | ovrBool ovrHmd_CreateDistortionMeshInternal( ovrHmdStruct *  hmd,

FILE: externals/ovr/Src/CAPI/CAPI_HMDState.h
  type ovrHmdStruct (line 45) | struct ovrHmdStruct { }
  function namespace (line 47) | namespace OVR { namespace CAPI {
  function checkBeginFrameScope (line 182) | void checkBeginFrameScope(const char* functionName)
  function checkRenderingConfigured (line 191) | void checkRenderingConfigured(const char* functionName)
  function checkBeginFrameTimingScope (line 198) | void checkBeginFrameTimingScope(const char* functionName)
  function VirtualHmdId (line 217) | VirtualHmdId GetNetId() { return NetId; }

FILE: externals/ovr/Src/CAPI/CAPI_HSWDisplay.cpp
  function OVR_EXPORT (line 75) | OVR_EXPORT void ovrhmd_EnableHSWDisplaySDKRender(ovrHmd hmd, ovrBool ena...
  type OVR (line 96) | namespace OVR { namespace CAPI {
    type CAPI (line 96) | namespace CAPI {
      function String (line 325) | static String getHSWTimeKey(const char* userName)
      function time_t (line 338) | time_t HSWDisplay::GetCurrentProfileLastHSWTime() const

FILE: externals/ovr/Src/CAPI/CAPI_HSWDisplay.h
  function namespace (line 98) | namespace OVR { namespace CAPI {

FILE: externals/ovr/Src/CAPI/CAPI_LatencyStatistics.cpp
  type OVR (line 33) | namespace OVR { namespace CAPI {
    type CAPI (line 33) | namespace CAPI {

FILE: externals/ovr/Src/CAPI/CAPI_LatencyStatistics.h
  function namespace (line 36) | namespace OVR { namespace CAPI {

FILE: externals/ovr/Src/CAPI/GL/CAPI_GLE.cpp
  type ValueStringPair (line 737) | struct ValueStringPair
  function CheckExtensions (line 745) | static void CheckExtensions(ValueStringPair* pValueStringPairArray, size...
  function GLboolean (line 1220) | GLboolean OVR::GLEContext::glAreTexturesResident_Hook(GLsizei n, const G...
  type OVR (line 1781) | namespace OVR {
  function GLuint (line 1983) | GLuint OVR::GLEContext::glGenLists_Hook(GLsizei range)
  function GLenum (line 2024) | GLenum OVR::GLEContext::glGetError_Hook()
  function GLubyte (line 2145) | const GLubyte * OVR::GLEContext::glGetString_Hook(GLenum name)
  function GLboolean (line 2354) | GLboolean OVR::GLEContext::glIsEnabled_Hook(GLenum cap)
  function GLboolean (line 2363) | GLboolean OVR::GLEContext::glIsList_Hook(GLuint list)
  function GLboolean (line 2372) | GLboolean OVR::GLEContext::glIsTexture_Hook(GLuint texture)
  function GLint (line 3181) | GLint OVR::GLEContext::glRenderMode_Hook(GLenum mode)
  function GLboolean (line 4833) | GLboolean OVR::GLEContext::glIsQuery_Hook(GLuint id)
  function GLboolean (line 4898) | GLboolean OVR::GLEContext::glIsBuffer_Hook(GLuint buffer)
  function GLvoid (line 4928) | GLvoid* OVR::GLEContext::glMapBuffer_Hook(GLenum target, GLenum access)
  function GLboolean (line 4937) | GLboolean OVR::GLEContext::glUnmapBuffer_Hook(GLenum target)
  function GLuint (line 5018) | GLuint OVR::GLEContext::glCreateProgram_Hook()
  function GLuint (line 5027) | GLuint OVR::GLEContext::glCreateShader_Hook(GLenum type)
  function GLint (line 5092) | GLint OVR::GLEContext::glGetAttribLocation_Hook(GLuint program, const GL...
  function GLint (line 5136) | GLint OVR::GLEContext::glGetUniformLocation_Hook(GLuint program, const G...
  function GLboolean (line 5187) | GLboolean OVR::GLEContext::glIsProgram_Hook(GLuint program)
  function GLboolean (line 5196) | GLboolean OVR::GLEContext::glIsShader_Hook(GLuint shader)
  function GLboolean (line 5706) | GLboolean OVR::GLEContext::glIsEnabledi_Hook(GLenum target, GLuint index)
  function GLint (line 5953) | GLint OVR::GLEContext::glGetFragDataLocation_Hook(GLuint program, const ...
  function GLubyte (line 6074) | const GLubyte* OVR::GLEContext::glGetStringi_Hook(GLenum name, GLuint in...
  function GLuint (line 6205) | GLuint OVR::GLEContext::glGetDebugMessageLogAMD_Hook(GLuint count, GLsiz...
  function GLboolean (line 6275) | GLboolean OVR::GLEContext::glIsFenceAPPLE_Hook(GLuint fence)
  function GLboolean (line 6284) | GLboolean OVR::GLEContext::glTestFenceAPPLE_Hook(GLuint fence)
  function GLboolean (line 6300) | GLboolean OVR::GLEContext::glTestObjectAPPLE_Hook(GLenum object, GLuint ...
  function GLenum (line 6334) | GLenum OVR::GLEContext::glObjectPurgeableAPPLE_Hook(GLenum objectType, G...
  function GLenum (line 6343) | GLenum OVR::GLEContext::glObjectUnpurgeableAPPLE_Hook(GLenum objectType,...
  function GLboolean (line 6398) | GLboolean OVR::GLEContext::glIsVertexArrayAPPLE_Hook(GLuint array)
  function GLboolean (line 6446) | GLboolean OVR::GLEContext::glIsVertexAttribEnabledAPPLE_Hook(GLuint inde...
  function GLuint (line 6507) | GLuint OVR::GLEContext::glGetDebugMessageLogARB_Hook(GLuint count, GLsiz...
  function GLboolean (line 6555) | GLboolean OVR::GLEContext::glIsRenderbuffer_Hook(GLuint renderbuffer)
  function GLboolean (line 6599) | GLboolean OVR::GLEContext::glIsFramebuffer_Hook(GLuint framebuffer)
  function GLenum (line 6629) | GLenum OVR::GLEContext::glCheckFramebufferStatus_Hook(GLenum target)
  function GLboolean (line 6777) | GLboolean OVR::GLEContext::glIsVertexArray_Hook(GLuint array)
  function GLboolean (line 6823) | GLboolean OVR::GLEContext::glIsEnabledIndexedEXT_Hook(GLenum target, GLu...
  function GLuint (line 6855) | GLuint OVR::GLEContext::glGetDebugMessageLog_Hook(GLuint count, GLsizei ...
  function HANDLE (line 7099) | HANDLE OVR::GLEContext::wglCreateBufferRegionARB_Hook(HDC hDC, int iLaye...
  function VOID (line 7108) | VOID OVR::GLEContext::wglDeleteBufferRegionARB_Hook(HANDLE hRegion)
  function BOOL (line 7115) | BOOL OVR::GLEContext::wglSaveBufferRegionARB_Hook(HANDLE hRegion, int x,...
  function BOOL (line 7124) | BOOL OVR::GLEContext::wglRestoreBufferRegionARB_Hook(HANDLE hRegion, int...
  function BOOL (line 7144) | BOOL OVR::GLEContext::wglGetPixelFormatAttribivARB_Hook(HDC hdc, int iPi...
  function BOOL (line 7153) | BOOL OVR::GLEContext::wglGetPixelFormatAttribfvARB_Hook(HDC hdc, int iPi...
  function BOOL (line 7162) | BOOL OVR::GLEContext::wglChoosePixelFormatARB_Hook(HDC hdc, const int *p...
  function BOOL (line 7172) | BOOL OVR::GLEContext::wglMakeContextCurrentARB_Hook(HDC hDrawDC, HDC hRe...
  function HDC (line 7181) | HDC OVR::GLEContext::wglGetCurrentReadDCARB_Hook()
  function HPBUFFERARB (line 7191) | HPBUFFERARB OVR::GLEContext::wglCreatePbufferARB_Hook(HDC hDC, int iPixe...
  function HDC (line 7200) | HDC OVR::GLEContext::wglGetPbufferDCARB_Hook(HPBUFFERARB hPbuffer)
  function BOOL (line 7218) | BOOL OVR::GLEContext::wglDestroyPbufferARB_Hook(HPBUFFERARB hPbuffer)
  function BOOL (line 7227) | BOOL OVR::GLEContext::wglQueryPbufferARB_Hook(HPBUFFERARB hPbuffer, int ...
  function BOOL (line 7237) | BOOL OVR::GLEContext::wglBindTexImageARB_Hook(HPBUFFERARB hPbuffer, int ...
  function BOOL (line 7246) | BOOL OVR::GLEContext::wglReleaseTexImageARB_Hook(HPBUFFERARB hPbuffer, i...
  function BOOL (line 7255) | BOOL OVR::GLEContext::wglSetPbufferAttribARB_Hook(HPBUFFERARB hPbuffer, ...
  function BOOL (line 7274) | BOOL OVR::GLEContext::wglBindVideoDeviceNV_Hook(HDC hDC, unsigned int uV...
  function BOOL (line 7283) | BOOL OVR::GLEContext::wglQueryCurrentContextNV_Hook(int iAttribute, int ...
  function HGLRC (line 7293) | HGLRC OVR::GLEContext::wglCreateContextAttribsARB_Hook(HDC hDC, HGLRC hS...
  function BOOL (line 7313) | BOOL OVR::GLEContext::wglSwapIntervalEXT_Hook(int interval)
  function BOOL (line 7332) | BOOL  OVR::GLEContext::wglGetSyncValuesOML_Hook(HDC hdc, INT64 *ust, INT...
  function BOOL (line 7341) | BOOL  OVR::GLEContext::wglGetMscRateOML_Hook(HDC hdc, INT32 *numerator, ...
  function INT64 (line 7350) | INT64 OVR::GLEContext::wglSwapBuffersMscOML_Hook(HDC hdc, INT64 target_m...
  function INT64 (line 7359) | INT64 OVR::GLEContext::wglSwapLayerBuffersMscOML_Hook(HDC hdc, int fuPla...
  function BOOL (line 7368) | BOOL  OVR::GLEContext::wglWaitForMscOML_Hook(HDC hdc, INT64 target_msc, ...
  function BOOL (line 7377) | BOOL  OVR::GLEContext::wglWaitForSbcOML_Hook(HDC hdc, INT64 target_sbc, ...
  function BOOL (line 7387) | BOOL OVR::GLEContext::wglGetVideoDeviceNV_Hook(HDC hDC, int numDevices, ...
  function BOOL (line 7396) | BOOL OVR::GLEContext::wglReleaseVideoDeviceNV_Hook(HPVIDEODEV hVideoDevice)
  function BOOL (line 7405) | BOOL OVR::GLEContext::wglBindVideoImageNV_Hook(HPVIDEODEV hVideoDevice, ...
  function BOOL (line 7414) | BOOL OVR::GLEContext::wglReleaseVideoImageNV_Hook(HPBUFFERARB hPbuffer, ...
  function BOOL (line 7423) | BOOL OVR::GLEContext::wglSendPbufferToVideoNV_Hook(HPBUFFERARB hPbuffer,...
  function BOOL (line 7432) | BOOL OVR::GLEContext::wglGetVideoInfoNV_Hook(HPVIDEODEV hpVideoDevice, u...
  function BOOL (line 7442) | BOOL OVR::GLEContext::wglJoinSwapGroupNV_Hook(HDC hDC, GLuint group)
  function BOOL (line 7451) | BOOL OVR::GLEContext::wglBindSwapBarrierNV_Hook(GLuint group, GLuint bar...
  function BOOL (line 7460) | BOOL OVR::GLEContext::wglQuerySwapGroupNV_Hook(HDC hDC, GLuint *group, G...
  function BOOL (line 7469) | BOOL OVR::GLEContext::wglQueryMaxSwapGroupsNV_Hook(HDC hDC, GLuint *maxG...
  function BOOL (line 7478) | BOOL OVR::GLEContext::wglQueryFrameCountNV_Hook(HDC hDC, GLuint *count)
  function BOOL (line 7487) | BOOL OVR::GLEContext::wglResetFrameCountNV_Hook(HDC hDC)
  function BOOL (line 7497) | BOOL OVR::GLEContext::wglBindVideoCaptureDeviceNV_Hook(UINT uVideoSlot, ...
  function UINT (line 7506) | UINT OVR::GLEContext::wglEnumerateVideoCaptureDevicesNV_Hook(HDC hDc, HV...
  function BOOL (line 7515) | BOOL OVR::GLEContext::wglLockVideoCaptureDeviceNV_Hook(HDC hDc, HVIDEOIN...
  function BOOL (line 7524) | BOOL OVR::GLEContext::wglQueryVideoCaptureDeviceNV_Hook(HDC hDc, HVIDEOI...
  function BOOL (line 7533) | BOOL OVR::GLEContext::wglReleaseVideoCaptureDeviceNV_Hook(HDC hDc, HVIDE...
  function BOOL (line 7543) | BOOL OVR::GLEContext::wglCopyImageSubDataNV_Hook(HGLRC hSrcRC, GLuint sr...
  function BOOL (line 7554) | BOOL OVR::GLEContext::wglDXSetResourceShareHandleNV_Hook(void *dxObject,...
  function HANDLE (line 7563) | HANDLE OVR::GLEContext::wglDXOpenDeviceNV_Hook(void *dxDevice)
  function BOOL (line 7572) | BOOL OVR::GLEContext::wglDXCloseDeviceNV_Hook(HANDLE hDevice)
  function HANDLE (line 7581) | HANDLE OVR::GLEContext::wglDXRegisterObjectNV_Hook(HANDLE hDevice, void ...
  function BOOL (line 7590) | BOOL OVR::GLEContext::wglDXUnregisterObjectNV_Hook(HANDLE hDevice, HANDL...
  function BOOL (line 7599) | BOOL OVR::GLEContext::wglDXObjectAccessNV_Hook(HANDLE hObject, GLenum ac...
  function BOOL (line 7608) | BOOL OVR::GLEContext::wglDXLockObjectsNV_Hook(HANDLE hDevice, GLint coun...
  function BOOL (line 7617) | BOOL OVR::GLEContext::wglDXUnlockObjectsNV_Hook(HANDLE hDevice, GLint co...
  function GLXFBConfig (line 7649) | GLXFBConfig* OVR::GLEContext::glXChooseFBConfig_Hook(Display *dpy, int s...
  function GLXContext (line 7658) | GLXContext OVR::GLEContext::glXCreateNewContext_Hook(Display *dpy, GLXFB...
  function GLXPbuffer (line 7667) | GLXPbuffer OVR::GLEContext::glXCreatePbuffer_Hook(Display *dpy, GLXFBCon...
  function GLXPixmap (line 7676) | GLXPixmap OVR::GLEContext::glXCreatePixmap_Hook(Display *dpy, GLXFBConfi...
  function GLXWindow (line 7685) | GLXWindow OVR::GLEContext::glXCreateWindow_Hook(Display *dpy, GLXFBConfi...
  function GLXDrawable (line 7715) | GLXDrawable OVR::GLEContext::glXGetCurrentReadDrawable_Hook(void)
  function GLXFBConfig (line 7733) | GLXFBConfig* OVR::GLEContext::glXGetFBConfigs_Hook(Display *dpy, int scr...
  function XVisualInfo (line 7749) | XVisualInfo* OVR::GLEContext::glXGetVisualFromFBConfig_Hook(Display *dpy...
  function Bool (line 7758) | Bool OVR::GLEContext::glXMakeContextCurrent_Hook(Display *dpy, GLXDrawab...
  function GLXContext (line 7794) | GLXContext OVR::GLEContext::glXCreateContextAttribsARB_Hook(Display* dpy...
  function Bool (line 7812) | Bool OVR::GLEContext::glXGetMscRateOML_Hook(Display* dpy, GLXDrawable dr...
  function Bool (line 7821) | Bool OVR::GLEContext::glXGetSyncValuesOML_Hook(Display* dpy, GLXDrawable...
  function Bool (line 7839) | Bool OVR::GLEContext::glXWaitForMscOML_Hook(Display* dpy, GLXDrawable dr...
  function Bool (line 7848) | Bool OVR::GLEContext::glXWaitForSbcOML_Hook(Display* dpy, GLXDrawable dr...

FILE: externals/ovr/Src/CAPI/GL/CAPI_GLE.h
  function namespace (line 116) | namespace OVR

FILE: externals/ovr/Src/CAPI/GL/CAPI_GLE_GL.h
  type GLenum (line 185) | typedef unsigned int GLenum;
  type GLbitfield (line 186) | typedef unsigned int GLbitfield;
  type GLuint (line 187) | typedef unsigned int GLuint;
  type GLint (line 188) | typedef int GLint;
  type GLsizei (line 189) | typedef int GLsizei;
  type GLboolean (line 190) | typedef unsigned char GLboolean;
  type GLbyte (line 191) | typedef signed char GLbyte;
  type GLshort (line 192) | typedef short GLshort;
  type GLubyte (line 193) | typedef unsigned char GLubyte;
  type GLushort (line 194) | typedef unsigned short GLushort;
  type GLulong (line 195) | typedef unsigned long GLulong;
  type GLfloat (line 196) | typedef float GLfloat;
  type GLclampf (line 197) | typedef float GLclampf;
  type GLdouble (line 198) | typedef double GLdouble;
  type GLclampd (line 199) | typedef double GLclampd;
  type GLvoid (line 200) | typedef void GLvoid;
  type GLint64EXT (line 201) | typedef int64_t GLint64EXT;
  type GLuint64EXT (line 202) | typedef uint64_t GLuint64EXT;
  type GLint64EXT (line 203) | typedef GLint64EXT  GLint64;
  type GLuint64EXT (line 204) | typedef GLuint64EXT GLuint64;
  type __GLsync (line 205) | struct __GLsync
  type GLchar (line 206) | typedef char GLchar;
  type GLintptr (line 1920) | typedef ptrdiff_t GLintptr;
  type GLsizeiptr (line 1921) | typedef ptrdiff_t GLsizeiptr;
  type GLubyte (line 2421) | typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC) (GLenum name, ...
  type GLfixed (line 3358) | typedef int GLfixed;
  type HGLRC (line 3883) | typedef BOOL  (WINAPI * PFNWGLCOPYCONTEXTPROC)(HGLRC, HGLRC, UINT);
  type DWORD (line 3892) | typedef BOOL  (WINAPI * PFNWGLUSEFONTBITMAPSAPROC)(HDC, DWORD, DWORD, DW...
  type DWORD (line 3893) | typedef BOOL  (WINAPI * PFNWGLUSEFONTBITMAPSWPROC)(HDC, DWORD, DWORD, DW...
  type DWORD (line 3894) | typedef BOOL  (WINAPI * PFNWGLUSEFONTOUTLINESAPROC)(HDC, DWORD, DWORD, D...
  type DWORD (line 3895) | typedef BOOL  (WINAPI * PFNWGLUSEFONTOUTLINESWPROC)(HDC, DWORD, DWORD, D...
  type UINT (line 3896) | typedef BOOL  (WINAPI * PFNWGLDESCRIBELAYERPLANEPROC)(HDC, int, int, UIN...
  type BOOL (line 3899) | typedef BOOL  (WINAPI * PFNWGLREALIZELAYERPALETTEPROC)(HDC, int, BOOL);
  type CONST (line 3901) | typedef DWORD (WINAPI * PFNWGLSWAPMULTIPLEBUFFERSPROC)(UINT, CONST
  type const (line 4014) | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, in...
  type const (line 4015) | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, in...
  type const (line 4016) | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const i...
  type const (line 4053) | typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int ...
  type const (line 4166) | typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGL...
  type GPU_DEVICE (line 4314) | typedef struct _GPU_DEVICE {
  type XID (line 4455) | typedef XID GLXDrawable;
  type XID (line 4456) | typedef XID GLXPixmap;
  type GLXVideoDeviceNV (line 4457) | typedef unsigned int GLXVideoDeviceNV;
  type __GLXcontextRec (line 4458) | struct __GLXcontextRec
  type Display (line 4507) | typedef Display* (* PFNGLXGETCURRENTDISPLAYPROC) (void);
  type XID (line 4574) | typedef XID GLXFBConfigID;
  type XID (line 4575) | typedef XID GLXPbuffer;
  type XID (line 4576) | typedef XID GLXWindow;
  type __GLXFBConfigRec (line 4577) | struct __GLXFBConfigRec
  type GLXPbufferClobberEvent (line 4579) | typedef struct {
  type GLXEvent (line 4593) | typedef union __GLXEvent {
  type GLXFBConfig (line 4598) | typedef GLXFBConfig* (* PFNGLXCHOOSEFBCONFIGPROC) (::Display *dpy, int s...
  type GLXContext (line 4599) | typedef GLXContext   (* PFNGLXCREATENEWCONTEXTPROC) (::Display *dpy, GLX...
  type GLXPbuffer (line 4600) | typedef GLXPbuffer   (* PFNGLXCREATEPBUFFERPROC) (::Display *dpy, GLXFBC...
  type GLXPixmap (line 4601) | typedef GLXPixmap    (* PFNGLXCREATEPIXMAPPROC) (::Display *dpy, GLXFBCo...
  type GLXWindow (line 4602) | typedef GLXWindow    (* PFNGLXCREATEWINDOWPROC) (::Display *dpy, GLXFBCo...
  type GLXDrawable (line 4606) | typedef GLXDrawable  (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
  type GLXFBConfig (line 4608) | typedef GLXFBConfig* (* PFNGLXGETFBCONFIGSPROC) (::Display *dpy, int scr...
  type XVisualInfo (line 4610) | typedef XVisualInfo* (* PFNGLXGETVISUALFROMFBCONFIGPROC) (::Display *dpy...
  type Bool (line 4611) | typedef Bool         (* PFNGLXMAKECONTEXTCURRENTPROC) (::Display *displa...
  type GLXContext (line 4663) | typedef GLXContext (* PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, ...
  type Bool (line 4712) | typedef Bool    (* PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable d...
  type Bool (line 4713) | typedef Bool    (* PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawabl...
  type Bool (line 4715) | typedef Bool    (* PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable d...
  type Bool (line 4716) | typedef Bool    (* PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable d...

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp
  type ShaderInfo (line 55) | struct ShaderInfo
  function DistortionShaderBitIndexCheck (line 82) | void DistortionShaderBitIndexCheck()
  type DistortionVertex (line 90) | struct DistortionVertex
  type LatencyVertex (line 102) | struct LatencyVertex
    method LatencyVertex (line 105) | LatencyVertex (const Vector3f& p) : Pos(p) {}
  type _XDisplay (line 389) | struct _XDisplay

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h
  type StandardUniformData (line 124) | struct StandardUniformData

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_DistortionShaders.h
  function namespace (line 34) | namespace OVR { namespace CAPI { namespace GL {

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp
  type OVR (line 40) | namespace OVR { namespace CAPI {
    type CAPI (line 40) | namespace CAPI {
      type GL (line 157) | namespace GL {
        type HASWVertex (line 161) | struct HASWVertex
          method HASWVertex (line 167) | HASWVertex(const Vector3f& p, const Color& c = Color(64,0,0,255)...
          method HASWVertex (line 171) | HASWVertex(float x, float y, float z, const Color& c = Color(64,...
        function Texture (line 184) | Texture* LoadTextureTga(RenderParams& rParams, int samplerMode, OV...
        function Texture (line 218) | Texture* LoadTextureTga(RenderParams& rParams, int samplerMode, co...

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_HSWDisplay.h
  function namespace (line 35) | namespace OVR { namespace CAPI { namespace GL {

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_Util.cpp
  type OVR (line 50) | namespace OVR {
    type CAPI (line 62) | namespace CAPI { namespace GL {
      type GL (line 62) | namespace GL {
        function InitGLExtensions (line 65) | void InitGLExtensions()
        function GLint (line 143) | GLint ShaderSet::GetGLShader(Shader* s)

FILE: externals/ovr/Src/CAPI/GL/CAPI_GL_Util.h
  function namespace (line 54) | namespace OVR
  function namespace (line 61) | namespace OVR { namespace CAPI { namespace GL {
  function class (line 216) | class ShaderSet : public RefCountBase<ShaderSet>
  function SetUniformv (line 279) | bool SetUniformv(const char* name, const Vector3f& v)
  function virtual (line 285) | virtual bool SetUniform4x4f(const char* name, const Matrix4f& m)
  function virtual (line 291) | virtual bool SetUniform3x3f(const char* name, const Matrix4f& m)
  function class (line 307) | class ShaderFill : public RefCountBase<ShaderFill>
  type DisplayId (line 335) | struct DisplayId
  function class (line 361) | class ShaderBase : public Shader
  function Compile (line 438) | bool Compile(const char* src)
  type ShaderImpl (line 468) | typedef ShaderImpl<Shader_Vertex,  GL_VERTEX_SHADER> VertexShader;
  type ShaderImpl (line 469) | typedef ShaderImpl<Shader_Fragment, GL_FRAGMENT_SHADER> FragmentShader;
  function class (line 474) | class Context
  function AutoContext (line 520) | struct AutoContext

FILE: externals/ovr/Src/Displays/OVR_Display.cpp
  type OVR (line 30) | namespace OVR {

FILE: externals/ovr/Src/Displays/OVR_Display.h
  function class (line 43) | class DisplaySearchHandle : virtual public RefCountBaseV<DisplaySearchHa...

FILE: externals/ovr/Src/Displays/OVR_OSX_Display.cpp
  type OVR (line 38) | namespace OVR {
    function blockType (line 80) | static int blockType( UByte* block )
    function parseEdid (line 116) | static bool parseEdid( UByte* edid, OVR::OSX::DisplayEDID& edidResult )
    function discoverExtendedRifts (line 186) | static int discoverExtendedRifts(OVR::OSX::DisplayDesc* descriptorArra...
    function DisplaySearchHandle (line 296) | DisplaySearchHandle* Display::GetDisplaySearchHandle()

FILE: externals/ovr/Src/Displays/OVR_OSX_FocusObserver.h
  function namespace (line 38) | namespace OVR { namespace OSX{

FILE: externals/ovr/Src/Displays/OVR_OSX_FocusReader.h
  function interface (line 34) | interface FocusReader : NSObject <NSApplicationDelegate>{

FILE: externals/ovr/Src/Kernel/OVR_Alg.cpp
  type OVR (line 29) | namespace OVR { namespace Alg {
    type Alg (line 29) | namespace Alg {

FILE: externals/ovr/Src/Kernel/OVR_Alg.h
  function namespace (line 34) | namespace OVR { namespace Alg {
  type typename (line 432) | typedef typename Array::ValueType ValueType;
  function T (line 636) | const T& operator [] (size_t i) const { return Data[i]; }
  function T (line 657) | const T& operator [] (size_t i) const { return Data[i]; }
  function UpperBit (line 672) | inline uint8_t UpperBit(size_t val)
  function LowerBit (line 717) | inline uint8_t LowerBit(size_t val)
  function class (line 765) | class MemUtil
  function Cmp16 (line 778) | inline int MemUtil::Cmp16(const void* p1, const void* p2, size_t int16Co...
  function Cmp32 (line 790) | inline int MemUtil::Cmp32(const void* p1, const void* p2, size_t int32Co...
  function Cmp64 (line 802) | inline int MemUtil::Cmp64(const void* p1, const void* p2, size_t int64Co...
  function namespace (line 820) | namespace ByteUtil {
  function DecodeUInt16 (line 988) | inline uint16_t DecodeUInt16(const uint8_t* buffer)
  function DecodeSInt16 (line 993) | inline int16_t DecodeSInt16(const uint8_t* buffer)
  function DecodeUInt32 (line 998) | inline uint32_t DecodeUInt32(const uint8_t* buffer)
  function DecodeSInt32 (line 1003) | inline int32_t DecodeSInt32(const uint8_t* buffer)
  function DecodeFloat (line 1008) | inline float DecodeFloat(const uint8_t* buffer)
  function EncodeUInt16 (line 1019) | inline void EncodeUInt16(uint8_t* buffer, uint16_t val)
  function EncodeSInt16 (line 1024) | inline void EncodeSInt16(uint8_t* buffer, int16_t val)
  function EncodeUInt32 (line 1029) | inline void EncodeUInt32(uint8_t* buffer, uint32_t val)
  function EncodeSInt32 (line 1034) | inline void EncodeSInt32(uint8_t* buffer, int32_t val)
  function EncodeFloat (line 1039) | inline void EncodeFloat(uint8_t* buffer, float val)
  function DecodeBCD (line 1051) | inline int8_t DecodeBCD(uint8_t byte)

FILE: externals/ovr/Src/Kernel/OVR_Allocator.cpp
  type OVR (line 42) | namespace OVR {
    function MMapFree (line 125) | void MMapFree(void* memory, size_t size)

FILE: externals/ovr/Src/Kernel/OVR_Allocator.h
  function OVR_FORCE_INLINE (line 59) | OVR_FORCE_INLINE void* operator new     (size_t n, void *ptr) { OVR_UNUS...
  function operator (line 60) | operator delete  (void *, void *)     { }
  function namespace (line 95) | namespace OVR {

FILE: externals/ovr/Src/Kernel/OVR_Array.h
  function namespace (line 33) | namespace OVR {
  function ResizeNoConstruct (line 179) | void ResizeNoConstruct(size_t newSize)
  type Allocator (line 217) | typedef Allocator                                   AllocatorType;
  type SizePolicy (line 218) | typedef SizePolicy                                  SizePolicyType;
  type ArrayDataBase (line 219) | typedef ArrayDataBase<T, Allocator, SizePolicy>     BaseType;
  type ArrayData (line 220) | typedef ArrayData    <T, Allocator, SizePolicy>     SelfType;
  function BaseType (line 225) | ArrayData(size_t size)
  function BaseType (line 228) | ArrayData(const SelfType& a)
  function Resize (line 232) | void Resize(size_t newSize)
  function PushBack (line 240) | void PushBack(const ValueType& val)
  function Append (line 255) | void Append(const ValueType other[], size_t count)
  type Allocator (line 277) | typedef Allocator                                   AllocatorType;
  type SizePolicy (line 278) | typedef SizePolicy                                  SizePolicyType;
  type ArrayDataBase (line 279) | typedef ArrayDataBase<T, Allocator, SizePolicy>     BaseType;
  type ArrayDataCC (line 280) | typedef ArrayDataCC  <T, Allocator, SizePolicy>     SelfType;
  function Resize (line 292) | void Resize(size_t newSize)
  function PushBack (line 300) | void PushBack(const ValueType& val)
  function Append (line 314) | void Append(const ValueType other[], size_t count)
  type typename (line 348) | typedef typename ArrayData::AllocatorType   AllocatorType;
  type typename (line 349) | typedef typename ArrayData::SizePolicyType  SizePolicyType;
  type ArrayBase (line 350) | typedef ArrayBase<ArrayData>                SelfType;
  function Data (line 363) | ArrayBase(size_t size)
  function Data (line 365) | ArrayBase(const SelfType& a)
  function Data (line 368) | ArrayBase(const ValueType& defval)
  function SizePolicyType (line 373) | SizePolicyType* GetSizePolicy() const                  { return Data.Pol...
  function SetSizePolicy (line 374) | void            SetSizePolicy(const SizePolicyType& p) { Data.Policy = p; }
  function ClearAndRelease (line 383) | void    ClearAndRelease()           { Data.ClearAndRelease(); }
  function Clear (line 384) | void    Clear()                     { Data.Resize(0); }
  function Resize (line 385) | void    Resize(size_t newSize)       { Data.Resize(newSize); }
  function Reserve (line 388) | void    Reserve(size_t newCapacity)
  function ValueType (line 400) | const ValueType& At(size_t index) const
  function ValueType (line 406) | ValueType ValueAt(size_t index) const
  function ValueType (line 425) | const ValueType* GetDataPtr() const { return Data.Data; }
  function ValueType (line 426) | ValueType* GetDataPtr()       { return Data.Data; }
  function PushBack (line 429) | void    PushBack(const ValueType& val)
  function ValueType (line 457) | ValueType Pop()
  function RemoveMultipleAt (line 486) | void    RemoveMultipleAt(size_t index, size_t num)
  function RemoveAt (line 509) | void    RemoveAt(size_t index)
  function RemoveAtUnordered (line 530) | void    RemoveAtUnordered(size_t index)
  function InsertMultipleAt (line 570) | void    InsertMultipleAt(size_t index, size_t num, const ValueType& val ...
  function Append (line 587) | void    Append(const SelfType& other)
  function Append (line 593) | void    Append(const ValueType other[], size_t count)
  function class (line 598) | class Iterator
  function BaseType (line 831) | ArrayCC(const SelfType& a) : BaseType(a) {}

FILE: externals/ovr/Src/Kernel/OVR_Atomic.cpp
  type OVR (line 40) | namespace OVR {
    function Lock (line 81) | Lock* SharedLock::GetLockAddRef()

FILE: externals/ovr/Src/Kernel/OVR_Atomic.h
  function namespace (line 50) | namespace OVR {
  function explicit (line 632) | explicit inline AtomicValueBase(T val)    { Ops::Store_Release(&Value, v...
  function T (line 639) | inline T     Exchange_Sync(T val)               { return Ops::Exchange_S...
  function T (line 640) | inline T     Exchange_Release(T val)            { return Ops::Exchange_R...
  function T (line 641) | inline T     Exchange_Acquire(T val)            { return Ops::Exchange_A...
  function T (line 642) | inline T     Exchange_NoSync(T val)             { return Ops::Exchange_N...
  function CompareAndSet_Sync (line 643) | inline bool  CompareAndSet_Sync(T c, T val)     { return Ops::CompareAnd...
  function CompareAndSet_Release (line 644) | inline bool  CompareAndSet_Release(T c, T val)  { return Ops::CompareAnd...
  function CompareAndSet_Acquire (line 645) | inline bool  CompareAndSet_Acquire(T c, T val)  { return Ops::CompareAnd...
  function CompareAndSet_NoSync (line 646) | inline bool  CompareAndSet_NoSync(T c, T val)   { return Ops::CompareAnd...
  function Store_Release (line 648) | inline void  Store_Release(T val)               { Ops::Store_Release(&Va...
  type typename (line 661) | typedef typename AtomicValueBase<T*>::Ops Ops;
  function explicit (line 666) | explicit inline AtomicPtr(T* val) : AtomicValueBase<T*>(val)   { }
  function T (line 669) | inline T* operator -> () const     { return this->Load_Acquire(); }
  function T (line 681) | T*     ExchangeAdd_Sync(I incr)      { return Ops::ExchangeAdd_Sync(&thi...
  function T (line 683) | T*     ExchangeAdd_Release(I incr)   { return Ops::ExchangeAdd_Release(&...
  function T (line 685) | T*     ExchangeAdd_Acquire(I incr)   { return Ops::ExchangeAdd_Acquire(&...
  function T (line 687) | T*     ExchangeAdd_NoSync(I incr)    { return Ops::ExchangeAdd_NoSync(&t...
  function T (line 698) | inline T* operator ++ ()      { return ExchangeAdd_Sync(1) + 1; }
  function T (line 699) | inline T* operator -- ()      { return ExchangeAdd_Sync(-1) - 1; }
  function T (line 700) | inline T* operator ++ (int)   { return ExchangeAdd_Sync(1); }
  function T (line 701) | inline T* operator -- (int)   { return ExchangeAdd_Sync(-1); }
  type typename (line 714) | typedef typename AtomicValueBase<T>::Ops Ops;
  function explicit (line 718) | explicit inline AtomicInt(T val) : AtomicValueBase<T>(val)    { }
  function T (line 722) | inline T     ExchangeAdd_Sync(T val)            { return Ops::ExchangeAd...
  function T (line 723) | inline T     ExchangeAdd_Release(T val)         { return Ops::ExchangeAd...
  function T (line 724) | inline T     ExchangeAdd_Acquire(T val)         { return Ops::ExchangeAd...
  function T (line 725) | inline T     ExchangeAdd_NoSync(T val)          { return Ops::ExchangeAd...
  function Increment_Sync (line 727) | inline void  Increment_Sync()                   { ExchangeAdd_Sync((T)1); }
  function Increment_Release (line 728) | inline void  Increment_Release()                { ExchangeAdd_Release((T...
  function Increment_Acquire (line 729) | inline void  Increment_Acquire()                { ExchangeAdd_Acquire((T...
  function Increment_NoSync (line 730) | inline void  Increment_NoSync()                 { ExchangeAdd_NoSync((T)...
  function T (line 735) | inline T operator += (T val) { return ExchangeAdd_Sync(val) + val; }
  function T (line 736) | inline T operator -= (T val) { return ExchangeAdd_Sync(0 - val) - val; }
  function T (line 738) | inline T operator ++ ()      { return ExchangeAdd_Sync((T)1) + 1; }
  function T (line 739) | inline T operator -- ()      { return ExchangeAdd_Sync(((T)0)-1) - 1; }
  function T (line 740) | inline T operator ++ (int)   { return ExchangeAdd_Sync((T)1); }
  function T (line 741) | inline T operator -- (int)   { return ExchangeAdd_Sync(((T)0)-1); }
  function T (line 744) | T operator &= (T arg)
  function T (line 754) | T operator |= (T arg)
  function T (line 764) | T operator ^= (T arg)
  function T (line 774) | T operator *= (T arg)
  function T (line 784) | T operator /= (T arg)
  function T (line 794) | T operator >>= (unsigned bits)
  function T (line 804) | T operator <<= (unsigned bits)
  function class (line 822) | class Lock
  function class (line 896) | class SharedLock

FILE: externals/ovr/Src/Kernel/OVR_CRC32.cpp
  type OVR (line 29) | namespace OVR {
    function CRC32_Calculate (line 70) | uint32_t CRC32_Calculate(const void* data, int bytes, uint32_t accumul...

FILE: externals/ovr/Src/Kernel/OVR_CRC32.h
  function namespace (line 33) | namespace OVR {

FILE: externals/ovr/Src/Kernel/OVR_Color.h
  function namespace (line 32) | namespace OVR {
  function GetRGBA (line 61) | void  GetRGBA(float *r, float *g, float *b, float* a) const

FILE: externals/ovr/Src/Kernel/OVR_ContainerAllocator.h
  function namespace (line 35) | namespace OVR {

FILE: externals/ovr/Src/Kernel/OVR_DebugHelp.cpp
  type THREAD_BASIC_INFORMATION (line 55) | struct THREAD_BASIC_INFORMATION
  type mach_header_64 (line 93) | struct mach_header_64
  type segment_command_64 (line 94) | struct segment_command_64
  type section_64 (line 95) | struct section_64
  type mach_header (line 98) | struct mach_header
  type segment_command (line 99) | struct segment_command
  type section (line 100) | struct section
  type dyld_all_image_infos (line 104) | struct dyld_all_image_infos
  function kern_return_t (line 141) | kern_return_t catch_mach_exception_raise_OVR(mach_port_t /*exceptionPort...
  function kern_return_t (line 148) | kern_return_t catch_mach_exception_raise_state_OVR(mach_port_t /*excepti...
  function kern_return_t (line 156) | kern_return_t catch_mach_exception_raise_state_identity_OVR(mach_port_t ...
  type OVR (line 178) | namespace OVR {
    function GetInstructionPointer (line 181) | void GetInstructionPointer(void*& pInstruction)
    function SprintfAddress (line 191) | static size_t SprintfAddress(char* threadHandleStr, size_t threadHandl...
    function SprintfThreadHandle (line 209) | static size_t SprintfThreadHandle(char* threadHandleStr, size_t thread...
    function SprintfThreadSysId (line 215) | static size_t SprintfThreadSysId(char* threadSysIdStr, size_t threadSy...
    function GetThreadStackBounds (line 228) | void GetThreadStackBounds(void*& pStackBase, void*& pStackLimit, Threa...
    function OVRIsDebuggerPresent (line 340) | bool OVRIsDebuggerPresent()
    function ExitProcess (line 418) | void ExitProcess(intptr_t processReturnValue)
    function SafeMMapFree (line 442) | void SafeMMapFree(const void* memory, size_t size)
    function Is64BitOS (line 458) | static bool Is64BitOS()
    function SpawnShellCommand (line 482) | size_t SpawnShellCommand(const char* shellCommand, char* output, size_...
    function GetUserDocumentsDirectory (line 524) | static size_t GetUserDocumentsDirectory(char* directoryPath, size_t di...
    function GetThreadName (line 564) | bool GetThreadName(OVR::ThreadHandle threadHandle, char* threadName, s...
    function ConvertThreadHandleToThreadSysId (line 585) | OVR::ThreadSysId ConvertThreadHandleToThreadSysId(OVR::ThreadHandle th...
    function ConvertThreadSysIdToThreadHandle (line 644) | OVR::ThreadHandle ConvertThreadSysIdToThreadHandle(OVR::ThreadSysId th...
    function FreeThreadHandle (line 669) | void FreeThreadHandle(OVR::ThreadHandle threadHandle)
    function GetCurrentThreadSysId (line 680) | OVR::ThreadSysId GetCurrentThreadSysId()
    function GetCurrentProcessFilePath (line 693) | static void GetCurrentProcessFilePath(char* appPath, size_t appPathCap...
    function FormatDateTime (line 812) | static void FormatDateTime(char* buffer, size_t bufferCapacity, time_t...
    function GetOSVersionName (line 836) | static void GetOSVersionName(char* versionName, size_t versionNameCapa...
    function CreateException (line 922) | void CreateException(CreateExceptionType exceptionType)
    type StackFrame (line 1252) | struct StackFrame
    type MacModuleInfo (line 1535) | struct MacModuleInfo // This struct exists solely so we can have a loc...
      method AddMacModuleInfo (line 1537) | static void AddMacModuleInfo(ModuleInfo* pModuleInfoArrayL, size_t& ...
    type dyld_all_image_infos (line 1586) | struct dyld_all_image_infos
    type stat (line 2007) | struct stat
    function ModuleInfo (line 2044) | const ModuleInfo* SymbolLookup::GetModuleInfoForAddress(uint64_t address)
    function LONG (line 2137) | LONG WINAPI Win32ExceptionFilter(LPEXCEPTION_POINTERS pExceptionPointers)
    function LONG (line 2144) | LONG ExceptionHandler::ExceptionFilter(LPEXCEPTION_POINTERS pException...
    function kern_return_t (line 2283) | kern_return_t ExceptionHandler::HandleMachException(mach_port_t /*mach...
    type CancelMessage (line 2435) | struct CancelMessage
    function kern_return_t (line 2486) | kern_return_t ExceptionHandler::ForwardMachException(mach_port_t threa...
    type MachExceptionInfo (line 2672) | struct MachExceptionInfo
    type MODULEINFO (line 3349) | struct MODULEINFO {
    type Find (line 3880) | struct Find { static char* PreviousChar(char* p, char c){ while(*p != ...

FILE: externals/ovr/Src/Kernel/OVR_DebugHelp.h
  type ThreadSysId (line 59) | typedef uintptr_t   ThreadSysId;
  type CONTEXT (line 74) | typedef CONTEXT CPUContext;
  type CPUContext (line 76) | struct CPUContext
  type CPUContext (line 87) | typedef int CPUContext;
  type ModuleInfo (line 152) | struct ModuleInfo
  type ExceptionListener (line 316) | struct ExceptionListener
  type ExceptionResponse (line 325) | enum ExceptionResponse
  function SetExceptionResponse (line 334) | void SetExceptionResponse(ExceptionResponse er)
  type SavedExceptionPorts (line 397) | struct SavedExceptionPorts

FILE: externals/ovr/Src/Kernel/OVR_Delegates.h
  function namespace (line 69) | namespace OVR {
  type ret_type (line 191) | typedef ret_type (*StubPointer)(void *, arg1_type);
  type Delegate1 (line 192) | typedef Delegate1<ret_type, arg1_type> this_type;
  function OVR_FORCE_INLINE (line 197) | OVR_FORCE_INLINE Delegate1(void *object, StubPointer stub)
  function OVR_FORCE_INLINE (line 206) | OVR_FORCE_INLINE ret_type FreeStub(void * /*object*/, arg1_type a1)
  function OVR_FORCE_INLINE (line 212) | OVR_FORCE_INLINE ret_type MemberStub(void *object, arg1_type a1)
  function OVR_FORCE_INLINE (line 219) | OVR_FORCE_INLINE ret_type ConstMemberStub(void *object, arg1_type a1)
  function OVR_FORCE_INLINE (line 230) | OVR_FORCE_INLINE ret_type operator()(arg1_type a1) const
  function OVR_FORCE_INLINE (line 252) | OVR_FORCE_INLINE bool operator!() const
  function OVR_FORCE_INLINE (line 257) | OVR_FORCE_INLINE void Invalidate()
  function OVR_FORCE_INLINE (line 265) | OVR_FORCE_INLINE this_type FromFree()
  function OVR_FORCE_INLINE (line 271) | OVR_FORCE_INLINE this_type FromMember(T *object)
  function OVR_FORCE_INLINE (line 277) | OVR_FORCE_INLINE this_type FromConstMember(T const *object)
  function SetFree (line 285) | void SetFree()
  function SetMember (line 291) | void SetMember(T *object)
  function SetConstMember (line 297) | void SetConstMember(T const *object)
  type ret_type (line 307) | typedef ret_type (*StubPointer)(void *, arg1_type, arg2_type);
  type Delegate2 (line 308) | typedef Delegate2<ret_type, arg1_type, arg2_type> this_type;
  function OVR_FORCE_INLINE (line 313) | OVR_FORCE_INLINE Delegate2(void *object, StubPointer stub)
  function OVR_FORCE_INLINE (line 322) | OVR_FORCE_INLINE ret_type FreeStub(void * /*object*/, arg1_type a1, arg2...
  function OVR_FORCE_INLINE (line 328) | OVR_FORCE_INLINE ret_type MemberStub(void *object, arg1_type a1, arg2_ty...
  function OVR_FORCE_INLINE (line 335) | OVR_FORCE_INLINE ret_type ConstMemberStub(void *object, arg1_type a1, ar...
  function OVR_FORCE_INLINE (line 346) | OVR_FORCE_INLINE ret_type operator()(arg1_type a1, arg2_type a2) const
  function OVR_FORCE_INLINE (line 368) | OVR_FORCE_INLINE bool operator!() const
  function OVR_FORCE_INLINE (line 373) | OVR_FORCE_INLINE void Invalidate()
  function OVR_FORCE_INLINE (line 381) | OVR_FORCE_INLINE this_type FromFree()
  function OVR_FORCE_INLINE (line 387) | OVR_FORCE_INLINE this_type FromMember(T *object)
  function OVR_FORCE_INLINE (line 393) | OVR_FORCE_INLINE this_type FromConstMember(T const *object)
  function SetFree (line 401) | void SetFree()
  function SetMember (line 407) | void SetMember(T *object)
  function SetConstMember (line 413) | void SetConstMember(T const *object)
  type ret_type (line 423) | typedef ret_type (*StubPointer)(void *, arg1_type, arg2_type, arg3_type);
  type Delegate3 (line 424) | typedef Delegate3<ret_type, arg1_type, arg2_type, arg3_type> this_type;
  function OVR_FORCE_INLINE (line 429) | OVR_FORCE_INLINE Delegate3(void *object, StubPointer stub)
  function OVR_FORCE_INLINE (line 438) | OVR_FORCE_INLINE ret_type FreeStub(void * /*object*/, arg1_type a1, arg2...
  function OVR_FORCE_INLINE (line 444) | OVR_FORCE_INLINE ret_type MemberStub(void *object, arg1_type a1, arg2_ty...
  function OVR_FORCE_INLINE (line 451) | OVR_FORCE_INLINE ret_type ConstMemberStub(void *object, arg1_type a1, ar...
  function OVR_FORCE_INLINE (line 462) | OVR_FORCE_INLINE ret_type operator()(arg1_type a1, arg2_type a2, arg3_ty...
  function OVR_FORCE_INLINE (line 484) | OVR_FORCE_INLINE bool operator!() const
  function OVR_FORCE_INLINE (line 489) | OVR_FORCE_INLINE void Invalidate()
  function OVR_FORCE_INLINE (line 497) | OVR_FORCE_INLINE this_type FromFree()
  function OVR_FORCE_INLINE (line 503) | OVR_FORCE_INLINE this_type FromMember(T *object)
  function OVR_FORCE_INLINE (line 509) | OVR_FORCE_INLINE this_type FromConstMember(T const *object)
  function SetFree (line 517) | void SetFree()
  function SetMember (line 523) | void SetMember(T *object)
  function SetConstMember (line 529) | void SetConstMember(T const *object)

FILE: externals/ovr/Src/Kernel/OVR_Deque.h
  function namespace (line 32) | namespace OVR{

FILE: externals/ovr/Src/Kernel/OVR_File.cpp
  type OVR (line 35) | namespace OVR {

FILE: externals/ovr/Src/Kernel/OVR_File.h
  function namespace (line 43) | namespace OVR {

FILE: externals/ovr/Src/Kernel/OVR_FileFILE.cpp
  type OVR (line 45) | namespace OVR {
    function SFerror (line 51) | static int SFerror ()
    class SysErrorModeDisabler (line 68) | class SysErrorModeDisabler
      method SysErrorModeDisabler (line 73) | SysErrorModeDisabler(const char* pfileName)
      method SysErrorModeDisabler (line 97) | SysErrorModeDisabler(const char* pfileName) { OVR_UNUSED(pfileName); }
    class SysErrorModeDisabler (line 94) | class SysErrorModeDisabler
      method SysErrorModeDisabler (line 73) | SysErrorModeDisabler(const char* pfileName)
      method SysErrorModeDisabler (line 97) | SysErrorModeDisabler(const char* pfileName) { OVR_UNUSED(pfileName); }
    class FILEFile (line 112) | class FILEFile : public File
      method FILEFile (line 136) | FILEFile() :
    function FileFILEOpen (line 578) | Ptr<File> FileFILEOpen(const String& path, int flags, int mode)
    type __stat64 (line 589) | struct __stat64
    type stat (line 598) | struct stat

FILE: externals/ovr/Src/Kernel/OVR_Hash.h
  function namespace (line 37) | namespace OVR {
  function GetCachedHash (line 135) | size_t  GetCachedHash(size_t maskValue) const  { return HashF()(Value) &...
  function SetCachedHash (line 136) | void    SetCachedHash(size_t)                  {}
  function Clear (line 138) | void    Clear()
  function Free (line 145) | void    Free() { Clear(); }
  function GetCachedHash (line 171) | size_t  GetCachedHash(size_t maskValue) const  { OVR_UNUSED(maskValue); ...
  function SetCachedHash (line 172) | void    SetCachedHash(size_t hashValue)        { HashValue = hashValue; }
  function Clear (line 174) | void    Clear()
  function Free (line 181) | void    Free() { Clear(); }
  function pTable (line 205) | pTable(NULL)                       {   }
  function pTable (line 206) | HashSetBase(int sizeHint) : pTable(NULL)           { SetCapacity(this, s...
  function pTable (line 207) | HashSetBase(const SelfType& src) : pTable(NULL)    { Assign(this, src); }
  function Assign (line 227) | void Assign(const SelfType& src)
  function Clear (line 243) | void Clear()
  function Add (line 291) | void Add(const CRef& key)
  function C (line 372) | C* Get(const K& key) const
  function C (line 382) | C* GetAlt(const K& key) const
  function CheckExpand (line 422) | void CheckExpand()
  function Resize (line 437) | void Resize(size_t n)
  function SetCapacity (line 451) | void SetCapacity(size_t newSize)
  type ConstIterator (line 467) | struct ConstIterator
  function operator (line 481) | void    operator ++ ()
  function operator (line 495) | bool    operator == (const ConstIterator& it) const
  function operator (line 507) | bool    operator != (const ConstIterator& it) const
  function ConstIterator (line 551) | struct Iterator : public ConstIterator
  type HashSet (line 919) | typedef HashSet<C, HashF, AltHashF, Allocator, Entry>     SelfType;
  function BaseType (line 922) | HashSet(int sizeHint) : BaseType(sizeHint)     {   }
  function BaseType (line 923) | HashSet(const SelfType& src) : BaseType(src)   {   }
  function Add (line 938) | void Add(const CRef& key)
  function Resize (line 944) | void Resize(size_t n)
  function SetCapacity (line 952) | void SetCapacity(size_t newSize)
  type HashSet (line 968) | typedef HashSet<C, HashF, AltHashF, Allocator, HashsetEntry<C, HashF> > ...
  function BaseType (line 972) | HashSetUncached(int sizeHint) : BaseType(sizeHint)       { }
  function BaseType (line 973) | HashSetUncached(const SelfType& src) : BaseType(src)     { }
  type HashNode (line 991) | typedef HashNode<C, U, HashF>   SelfType;
  type C (line 992) | typedef C                       FirstType;
  type U (line 993) | typedef U                       SecondType;
  type NodeRef (line 1000) | struct NodeRef
  function CalcHash (line 1023) | size_t CalcHash(const K& data)   { return HashF()(data); }
  type NodeHashF (line 1028) | struct NodeHashF
  type NodeAltHashF (line 1033) | struct NodeAltHashF
  function GetCachedHash (line 1069) | size_t  GetCachedHash(size_t maskValue) const  { return HashF()(Value) &...
  function SetCachedHash (line 1070) | void    SetCachedHash(size_t hashValue)        { OVR_UNUSED(hashValue); }
  function Clear (line 1072) | void    Clear()
  function Free (line 1079) | void    Free() { Clear(); }
  function GetCachedHash (line 1104) | size_t  GetCachedHash(size_t maskValue) const  { OVR_UNUSED(maskValue); ...
  function SetCachedHash (line 1105) | void    SetCachedHash(size_t hashValue)        { HashValue = hashValue; }
  function Clear (line 1107) | void    Clear()
  function Free (line 1114) | void    Free() { Clear(); }
  type Hash (line 1134) | typedef Hash<C, U, HashF, Allocator, HashNode, Entry, Container>    Self...
  function mHash (line 1141) | Hash(int sizeHint) : mHash(sizeHint)                        { }
  function mHash (line 1142) | Hash(const SelfType& src) : mHash(src.mHash)                { }
  function Clear (line 1148) | inline void    Clear() { mHash.Clear(); }
  function Set (line 1153) | inline void    Set(const C& key, const U& value)
  function Add (line 1158) | inline void    Add(const C& key, const U& value)
  function Remove (line 1165) | inline void     Remove(const C& key)
  function RemoveAlt (line 1170) | void     RemoveAlt(const K& key)
  function Get (line 1179) | bool    Get(const C& key, U* pvalue) const
  function U (line 1207) | inline U*  Get(const C& key)
  function U (line 1212) | inline const U* Get(const C
Copy disabled (too large) Download .json
Condensed preview — 480 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (11,712K chars).
[
  {
    "path": ".gitignore",
    "chars": 411,
    "preview": "*.dSYM\n/build/*.png\n/c/**/*.png\n/build\n/c/add-markers\n/c/batch\n/c/demod-fm\n/c/demod-fm-streaming\n/c/export\n/c/fft\n/c/fft"
  },
  {
    "path": "API.md",
    "chars": 11165,
    "preview": "## Introduction\n\nHere's a typical example of a script:\n\n    function setup()\n        -- Load the model, shaders, camera,"
  },
  {
    "path": "AUTHORS",
    "chars": 168,
    "preview": "# Primary Author\nFrederik De Bleser <frederik@debleser.be>\n\n# Contributors\nLieven Menschaert <lieven.menschaert@gmail.co"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 2105,
    "preview": "cmake_minimum_required(VERSION 2.8.4)\nproject(frequensea)\n\nSET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} --std=c99 -g -Wall -Werro"
  },
  {
    "path": "LICENSE",
    "chars": 1084,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Frederik De Bleser\n\nPermission is hereby granted, free of charge, to any perso"
  },
  {
    "path": "NOTES",
    "chars": 99,
    "preview": "## hackrf public header\n\nhttps://github.com/mossmann/hackrf/blob/master/host/libhackrf/src/hackrf.h"
  },
  {
    "path": "README.md",
    "chars": 2479,
    "preview": "## Frequensea\n\nFrequensea is an open-source toolkit for visualizing the electromagnetic spectrum.\n\n![A sea of FFT data]("
  },
  {
    "path": "c/Makefile",
    "chars": 4255,
    "preview": "add-markers: add-markers.c\n\tgcc --std=c99 -g -Wall -Werror -pedantic -I /opt/homebrew/include -I /usr/local/include -L /"
  },
  {
    "path": "c/README.md",
    "chars": 107,
    "preview": "Mac OS X\n========\nTo install on OS X:\n\n    sudo port install hackrf glfw libpng fftw\n    make vis && ./vis\n"
  },
  {
    "path": "c/_export/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "c/add-all-markers.sh",
    "chars": 261,
    "preview": "#!/bin/sh\nmake add-markers\n./add-markers 10 465\n./add-markers 470 925\n./add-markers 930 1385\n./add-markers 1390 1845\n./a"
  },
  {
    "path": "c/add-markers.c",
    "chars": 9323,
    "preview": "// Add markers\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <math.h>\n#include <string.h>\n\n#defin"
  },
  {
    "path": "c/batch.c",
    "chars": 2627,
    "preview": "// Process frequency range in batch.\n\n#include <libhackrf/hackrf.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <uni"
  },
  {
    "path": "c/demod-fm-streaming.c",
    "chars": 14209,
    "preview": "// Demodulate FM stream, continuously.\n\n#include <assert.h>\n#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n#in"
  },
  {
    "path": "c/demod-fm.c",
    "chars": 13438,
    "preview": "// Play random noise as audio\n\n#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <un"
  },
  {
    "path": "c/easypng.h",
    "chars": 1654,
    "preview": "#include <stdlib.h>\n#include <stdio.h>\n#include <png.h>\n\n// Write a grayscale PNG image.\nstatic void write_gray_png(cons"
  },
  {
    "path": "c/fft-batch-broad.c",
    "chars": 6638,
    "preview": "// Batch export of FFT data as images.\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <math.h>\n#in"
  },
  {
    "path": "c/fft-batch.c",
    "chars": 5593,
    "preview": "// Batch export of FFT data as images.\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <math.h>\n#in"
  },
  {
    "path": "c/fft-stitch-broad.c",
    "chars": 3373,
    "preview": "#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <math.h>\n#include <string.h>\n\n#d"
  },
  {
    "path": "c/fft-stitch.c",
    "chars": 8407,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <math.h>\n#include <string.h>\n\n#define STB_IMAGE_IMPL"
  },
  {
    "path": "c/fft.c",
    "chars": 8704,
    "preview": "// Perform FFT analysis on HackRF data.\n\n#include <GLFW/glfw3.h>\n#include <libhackrf/hackrf.h>\n#include <fftw3.h>\n\n#incl"
  },
  {
    "path": "c/gradual-noise.c",
    "chars": 3694,
    "preview": "// Gradual noise movie.\n// Expects noise data files in ../rfdata/rf-x.xxx-big.raw\n\n#include <stdio.h>\n#include <stdlib.h"
  },
  {
    "path": "c/gridvis.c",
    "chars": 12037,
    "preview": "// 3D visualization of spectrum\n\n#include <GLFW/glfw3.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <libhackrf/hack"
  },
  {
    "path": "c/iq-lines.c",
    "chars": 10286,
    "preview": "// Slowly show a single sample, frame by frame. Used for exporting to movie.\n\n#include <assert.h>\n#include <stdio.h>\n#in"
  },
  {
    "path": "c/iqvis-rtl.c",
    "chars": 8486,
    "preview": "#include <math.h>\n#include <png.h>\n#include <pthread.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#incl"
  },
  {
    "path": "c/iqvis.c",
    "chars": 8733,
    "preview": "#include <GLFW/glfw3.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <libhackrf/hackrf.h>\n#include <unistd.h>\n#includ"
  },
  {
    "path": "c/osc-server.c",
    "chars": 7475,
    "preview": "// A simple OSC listening server.\n// Can be used to receive messages from OSCulator.\n\n#include <assert.h>\n#include <errn"
  },
  {
    "path": "c/piqvis.c",
    "chars": 9750,
    "preview": "// Visualisation on the Raspberry PI\n\n#include <math.h>\n#include <pthread.h>\n#include <stdlib.h>\n#include <stdio.h>\n#inc"
  },
  {
    "path": "c/play.c",
    "chars": 2786,
    "preview": "// Play random noise as audio\n\n#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <un"
  },
  {
    "path": "c/reader-all.sh",
    "chars": 16219,
    "preview": "./reader 1.00 100\n./reader 1.01 100\n./reader 1.02 100\n./reader 1.03 100\n./reader 1.04 100\n./reader 1.05 100\n./reader 1.0"
  },
  {
    "path": "c/reader.c",
    "chars": 2584,
    "preview": "#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n\n#include <libhackrf/hackrf.h>\n\nconst uin"
  },
  {
    "path": "c/render-text.c",
    "chars": 4666,
    "preview": "#include <math.h>\n\n#define STB_TRUETYPE_IMPLEMENTATION\n#include \"../externals/stb/stb_truetype.h\"\n\n#include \"easypng.h\"\n"
  },
  {
    "path": "c/rfcap.c",
    "chars": 2168,
    "preview": "// Capture n samples of a frequency range.\n\n#include <libhackrf/hackrf.h>\n#include <stdio.h>\n#include <stdlib.h>\n#includ"
  },
  {
    "path": "c/sender.c",
    "chars": 2076,
    "preview": "#include <libhackrf/hackrf.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n\nint send_sample_block(hackrf_t"
  },
  {
    "path": "c/single-sample.c",
    "chars": 4385,
    "preview": "// Slowly show a single sample, frame by frame. Used for exporting to movie.\n\n#include <assert.h>\n#include <stdio.h>\n#in"
  },
  {
    "path": "c/tv-sender.c",
    "chars": 3813,
    "preview": "#include <libhackrf/hackrf.h>\n#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <m"
  },
  {
    "path": "c/vis.c",
    "chars": 8117,
    "preview": "#include <GLFW/glfw3.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <libhackrf/hackrf.h>\n#include <unistd.h>\n#includ"
  },
  {
    "path": "data-wrangling/bipt_freqs.csv",
    "chars": 46706,
    "preview": "start_freq,end_freq,allocation,applications\n9000,14000,not allocated,\"Inductive applications, Ultra Low Power Active Med"
  },
  {
    "path": "data-wrangling/csv2lua.py",
    "chars": 1238,
    "preview": "# Convert a CSV file to a Lua table script that can be imported using `dofile`.\n\nimport csv\n\ndef csv2lua(in_file, out_fi"
  },
  {
    "path": "externals/lua/CMakeLists.txt",
    "chars": 674,
    "preview": "cmake_minimum_required(VERSION 2.8.4)\n\nset(LUA_SOURCES\n    src/lapi.c\n    src/lauxlib.c\n    src/lbaselib.c\n    src/lbitl"
  },
  {
    "path": "externals/lua/src/Makefile",
    "chars": 6894,
    "preview": "# Makefile for building Lua\n# See ../doc/readme.html for installation and customization instructions.\n\n# == CHANGE THE S"
  },
  {
    "path": "externals/lua/src/lapi.c",
    "chars": 30159,
    "preview": "/*\n** $Id: lapi.c,v 2.244 2014/12/26 14:43:45 roberto Exp $\n** Lua API\n** See Copyright Notice in lua.h\n*/\n\n#define lapi"
  },
  {
    "path": "externals/lua/src/lapi.h",
    "chars": 535,
    "preview": "/*\n** $Id: lapi.h,v 2.8 2014/07/15 21:26:50 roberto Exp $\n** Auxiliary functions from Lua API\n** See Copyright Notice in"
  },
  {
    "path": "externals/lua/src/lauxlib.c",
    "chars": 28389,
    "preview": "/*\n** $Id: lauxlib.c,v 1.279 2014/12/14 18:32:26 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** See "
  },
  {
    "path": "externals/lua/src/lauxlib.h",
    "chars": 8433,
    "preview": "/*\n** $Id: lauxlib.h,v 1.128 2014/10/29 16:11:17 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** See "
  },
  {
    "path": "externals/lua/src/lbaselib.c",
    "chars": 14507,
    "preview": "/*\n** $Id: lbaselib.c,v 1.309 2014/12/10 12:26:42 roberto Exp $\n** Basic library\n** See Copyright Notice in lua.h\n*/\n\n#d"
  },
  {
    "path": "externals/lua/src/lbitlib.c",
    "chars": 4946,
    "preview": "/*\n** $Id: lbitlib.c,v 1.28 2014/11/02 19:19:04 roberto Exp $\n** Standard library for bitwise operations\n** See Copyrigh"
  },
  {
    "path": "externals/lua/src/lcode.c",
    "chars": 24737,
    "preview": "/*\n** $Id: lcode.c,v 2.99 2014/12/29 16:49:25 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua.h\n*"
  },
  {
    "path": "externals/lua/src/lcode.h",
    "chars": 3189,
    "preview": "/*\n** $Id: lcode.h,v 1.63 2013/12/30 20:47:58 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua.h\n*"
  },
  {
    "path": "externals/lua/src/lcorolib.c",
    "chars": 3752,
    "preview": "/*\n** $Id: lcorolib.c,v 1.9 2014/11/02 19:19:04 roberto Exp $\n** Coroutine Library\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "externals/lua/src/lctype.c",
    "chars": 2318,
    "preview": "/*\n** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $\n** 'ctype' functions for Lua\n** See Copyright Notice in lua"
  },
  {
    "path": "externals/lua/src/lctype.h",
    "chars": 1837,
    "preview": "/*\n** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $\n** 'ctype' functions for Lua\n** See Copyright Notice in lua"
  },
  {
    "path": "externals/lua/src/ldblib.c",
    "chars": 12219,
    "preview": "/*\n** $Id: ldblib.c,v 1.148 2015/01/02 12:52:22 roberto Exp $\n** Interface from Lua to its debug API\n** See Copyright No"
  },
  {
    "path": "externals/lua/src/ldebug.c",
    "chars": 18157,
    "preview": "/*\n** $Id: ldebug.c,v 2.110 2015/01/02 12:52:22 roberto Exp $\n** Debug Interface\n** See Copyright Notice in lua.h\n*/\n\n#d"
  },
  {
    "path": "externals/lua/src/ldebug.h",
    "chars": 1399,
    "preview": "/*\n** $Id: ldebug.h,v 2.12 2014/11/10 14:46:05 roberto Exp $\n** Auxiliary functions from Debug Interface module\n** See C"
  },
  {
    "path": "externals/lua/src/ldo.c",
    "chars": 22438,
    "preview": "/*\n** $Id: ldo.c,v 2.135 2014/11/11 17:13:39 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice in"
  },
  {
    "path": "externals/lua/src/ldo.h",
    "chars": 1527,
    "preview": "/*\n** $Id: ldo.h,v 2.21 2014/10/25 11:50:46 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice in "
  },
  {
    "path": "externals/lua/src/ldump.c",
    "chars": 4432,
    "preview": "/*\n** $Id: ldump.c,v 2.34 2014/11/02 19:19:04 roberto Exp $\n** save precompiled Lua chunks\n** See Copyright Notice in lu"
  },
  {
    "path": "externals/lua/src/lfunc.c",
    "chars": 3691,
    "preview": "/*\n** $Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp $\n** Auxiliary functions to manipulate prototypes and closures"
  },
  {
    "path": "externals/lua/src/lfunc.h",
    "chars": 1503,
    "preview": "/*\n** $Id: lfunc.h,v 2.14 2014/06/19 18:27:20 roberto Exp $\n** Auxiliary functions to manipulate prototypes and closures"
  },
  {
    "path": "externals/lua/src/lgc.c",
    "chars": 35746,
    "preview": "/*\n** $Id: lgc.c,v 2.201 2014/12/20 13:58:15 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n#de"
  },
  {
    "path": "externals/lua/src/lgc.h",
    "chars": 4362,
    "preview": "/*\n** $Id: lgc.h,v 2.86 2014/10/25 11:50:46 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n#ifn"
  },
  {
    "path": "externals/lua/src/linit.c",
    "chars": 1722,
    "preview": "/*\n** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $\n** Initialization of libraries for lua.c and other clients\n*"
  },
  {
    "path": "externals/lua/src/liolib.c",
    "chars": 19877,
    "preview": "/*\n** $Id: liolib.c,v 2.142 2015/01/02 12:50:28 roberto Exp $\n** Standard I/O (and system) library\n** See Copyright Noti"
  },
  {
    "path": "externals/lua/src/llex.c",
    "chars": 17124,
    "preview": "/*\n** $Id: llex.c,v 2.89 2014/11/14 16:06:09 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n#def"
  },
  {
    "path": "externals/lua/src/llex.h",
    "chars": 2316,
    "preview": "/*\n** $Id: llex.h,v 1.78 2014/10/29 15:38:24 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n#ifn"
  },
  {
    "path": "externals/lua/src/llimits.h",
    "chars": 5463,
    "preview": "/*\n** $Id: llimits.h,v 1.125 2014/12/19 13:30:23 roberto Exp $\n** Limits, basic types, and some other 'installation-depe"
  },
  {
    "path": "externals/lua/src/lmathlib.c",
    "chars": 9777,
    "preview": "/*\n** $Id: lmathlib.c,v 1.114 2014/12/27 20:32:26 roberto Exp $\n** Standard mathematical library\n** See Copyright Notice"
  },
  {
    "path": "externals/lua/src/lmem.c",
    "chars": 2631,
    "preview": "/*\n** $Id: lmem.c,v 1.89 2014/11/02 19:33:33 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in lua"
  },
  {
    "path": "externals/lua/src/lmem.h",
    "chars": 2435,
    "preview": "/*\n** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in lua"
  },
  {
    "path": "externals/lua/src/loadlib.c",
    "chars": 23524,
    "preview": "/*\n** $Id: loadlib.c,v 1.124 2015/01/05 13:51:39 roberto Exp $\n** Dynamic library loader for Lua\n** See Copyright Notice"
  },
  {
    "path": "externals/lua/src/lobject.c",
    "chars": 14103,
    "preview": "/*\n** $Id: lobject.c,v 2.101 2014/12/26 14:43:45 roberto Exp $\n** Some generic functions over Lua objects\n** See Copyrig"
  },
  {
    "path": "externals/lua/src/lobject.h",
    "chars": 13918,
    "preview": "/*\n** $Id: lobject.h,v 2.106 2015/01/05 13:52:37 roberto Exp $\n** Type definitions for Lua objects\n** See Copyright Noti"
  },
  {
    "path": "externals/lua/src/lopcodes.c",
    "chars": 3542,
    "preview": "/*\n** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $\n** Opcodes for Lua virtual machine\n** See Copyright Notic"
  },
  {
    "path": "externals/lua/src/lopcodes.h",
    "chars": 8788,
    "preview": "/*\n** $Id: lopcodes.h,v 1.148 2014/10/25 11:50:46 roberto Exp $\n** Opcodes for Lua virtual machine\n** See Copyright Noti"
  },
  {
    "path": "externals/lua/src/loslib.c",
    "chars": 8701,
    "preview": "/*\n** $Id: loslib.c,v 1.54 2014/12/26 14:46:07 roberto Exp $\n** Standard Operating System library\n** See Copyright Notic"
  },
  {
    "path": "externals/lua/src/lparser.c",
    "chars": 46215,
    "preview": "/*\n** $Id: lparser.c,v 2.147 2014/12/27 20:31:43 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n#defin"
  },
  {
    "path": "externals/lua/src/lparser.h",
    "chars": 3362,
    "preview": "/*\n** $Id: lparser.h,v 1.74 2014/10/25 11:50:46 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n#ifndef"
  },
  {
    "path": "externals/lua/src/lprefix.h",
    "chars": 867,
    "preview": "/*\n** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $\n** Definitions for Lua code that must come before any other"
  },
  {
    "path": "externals/lua/src/lstate.c",
    "chars": 8537,
    "preview": "/*\n** $Id: lstate.c,v 2.127 2014/11/02 19:33:33 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n#defi"
  },
  {
    "path": "externals/lua/src/lstate.h",
    "chars": 7497,
    "preview": "/*\n** $Id: lstate.h,v 2.119 2014/10/30 18:53:28 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n#ifnd"
  },
  {
    "path": "externals/lua/src/lstring.c",
    "chars": 4548,
    "preview": "/*\n** $Id: lstring.c,v 2.45 2014/11/02 19:19:04 roberto Exp $\n** String table (keeps all strings handled by Lua)\n** See "
  },
  {
    "path": "externals/lua/src/lstring.h",
    "chars": 1283,
    "preview": "/*\n** $Id: lstring.h,v 1.56 2014/07/18 14:46:47 roberto Exp $\n** String table (keep all strings handled by Lua)\n** See C"
  },
  {
    "path": "externals/lua/src/lstrlib.c",
    "chars": 41632,
    "preview": "/*\n** $Id: lstrlib.c,v 1.221 2014/12/11 14:03:07 roberto Exp $\n** Standard library for string operations and pattern-mat"
  },
  {
    "path": "externals/lua/src/ltable.c",
    "chars": 18654,
    "preview": "/*\n** $Id: ltable.c,v 2.100 2015/01/05 13:52:37 roberto Exp $\n** Lua tables (hash)\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "externals/lua/src/ltable.h",
    "chars": 1682,
    "preview": "/*\n** $Id: ltable.h,v 2.20 2014/09/04 18:15:29 roberto Exp $\n** Lua tables (hash)\n** See Copyright Notice in lua.h\n*/\n\n#"
  },
  {
    "path": "externals/lua/src/ltablib.c",
    "chars": 9918,
    "preview": "/*\n** $Id: ltablib.c,v 1.79 2014/11/02 19:19:04 roberto Exp $\n** Library for Table Manipulation\n** See Copyright Notice "
  },
  {
    "path": "externals/lua/src/ltm.c",
    "chars": 3898,
    "preview": "/*\n** $Id: ltm.c,v 2.33 2014/11/21 12:15:57 roberto Exp $\n** Tag methods\n** See Copyright Notice in lua.h\n*/\n\n#define lt"
  },
  {
    "path": "externals/lua/src/ltm.h",
    "chars": 1749,
    "preview": "/*\n** $Id: ltm.h,v 2.21 2014/10/25 11:50:46 roberto Exp $\n** Tag methods\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lt"
  },
  {
    "path": "externals/lua/src/lua.c",
    "chars": 17947,
    "preview": "/*\n** $Id: lua.c,v 1.222 2014/11/11 19:41:27 roberto Exp $\n** Lua stand-alone interpreter\n** See Copyright Notice in lua"
  },
  {
    "path": "externals/lua/src/lua.h",
    "chars": 14734,
    "preview": "/*\n** $Id: lua.h,v 1.325 2014/12/26 17:24:27 roberto Exp $\n** Lua - A Scripting Language\n** Lua.org, PUC-Rio, Brazil (ht"
  },
  {
    "path": "externals/lua/src/lua.hpp",
    "chars": 191,
    "preview": "// lua.hpp\n// Lua header files for C++\n// <<extern \"C\">> not supplied automatically because Lua also compiles as C++\n\nex"
  },
  {
    "path": "externals/lua/src/luac.c",
    "chars": 10261,
    "preview": "/*\n** $Id: luac.c,v 1.72 2015/01/06 03:09:13 lhf Exp $\n** Lua compiler (saves bytecodes to files; also lists bytecodes)\n"
  },
  {
    "path": "externals/lua/src/luaconf.h",
    "chars": 20227,
    "preview": "/*\n** $Id: luaconf.h,v 1.238 2014/12/29 13:27:55 roberto Exp $\n** Configuration file for Lua\n** See Copyright Notice in "
  },
  {
    "path": "externals/lua/src/lualib.h",
    "chars": 1173,
    "preview": "/*\n** $Id: lualib.h,v 1.44 2014/02/06 17:32:33 roberto Exp $\n** Lua standard libraries\n** See Copyright Notice in lua.h\n"
  },
  {
    "path": "externals/lua/src/lundump.c",
    "chars": 6023,
    "preview": "/*\n** $Id: lundump.c,v 2.41 2014/11/02 19:19:04 roberto Exp $\n** load precompiled Lua chunks\n** See Copyright Notice in "
  },
  {
    "path": "externals/lua/src/lundump.h",
    "chars": 847,
    "preview": "/*\n** $Id: lundump.h,v 1.44 2014/06/19 18:27:20 roberto Exp $\n** load precompiled Lua chunks\n** See Copyright Notice in "
  },
  {
    "path": "externals/lua/src/lutf8lib.c",
    "chars": 7000,
    "preview": "/*\n** $Id: lutf8lib.c,v 1.13 2014/11/02 19:19:04 roberto Exp $\n** Standard library for UTF-8 manipulation\n** See Copyrig"
  },
  {
    "path": "externals/lua/src/lvm.c",
    "chars": 39233,
    "preview": "/*\n** $Id: lvm.c,v 2.232 2014/12/27 20:30:38 roberto Exp $\n** Lua virtual machine\n** See Copyright Notice in lua.h\n*/\n\n#"
  },
  {
    "path": "externals/lua/src/lvm.h",
    "chars": 1864,
    "preview": "/*\n** $Id: lvm.h,v 2.34 2014/08/01 17:24:02 roberto Exp $\n** Lua virtual machine\n** See Copyright Notice in lua.h\n*/\n\n#i"
  },
  {
    "path": "externals/lua/src/lzio.c",
    "chars": 1643,
    "preview": "/*\n** $Id: lzio.c,v 1.36 2014/11/02 19:19:04 roberto Exp $\n** Buffered streams\n** See Copyright Notice in lua.h\n*/\n\n#def"
  },
  {
    "path": "externals/lua/src/lzio.h",
    "chars": 1549,
    "preview": "/*\n** $Id: lzio.h,v 1.30 2014/12/19 17:26:14 roberto Exp $\n** Buffered streams\n** See Copyright Notice in lua.h\n*/\n\n\n#if"
  },
  {
    "path": "externals/ovr/Include/OVR.h",
    "chars": 1226,
    "preview": "/************************************************************************************\n\nFilename    :   OVR.h\nContent    "
  },
  {
    "path": "externals/ovr/Include/OVR_Kernel.h",
    "chars": 1594,
    "preview": "/************************************************************************************\n\nFilename    :   OVRKernel.h\nConte"
  },
  {
    "path": "externals/ovr/Include/OVR_Version.h",
    "chars": 1260,
    "preview": "/************************************************************************************\n\nFilename    :   OVRVersion.h\nCont"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_DistortionRenderer.cpp",
    "chars": 4655,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_DistortionRe"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_DistortionRenderer.h",
    "chars": 6008,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_DistortionRe"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_FrameTimeManager.cpp",
    "chars": 34004,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_FrameTimeMan"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_FrameTimeManager.h",
    "chars": 12057,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_FrameTimeMan"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_HMDRenderState.cpp",
    "chars": 5827,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_CAPI_HMDRende"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_HMDRenderState.h",
    "chars": 2702,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_HMDRenderSta"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_HMDState.cpp",
    "chars": 25684,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_HMDState.cpp"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_HMDState.h",
    "chars": 10810,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_HMDState.h\nC"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_HSWDisplay.cpp",
    "chars": 15567,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_HSWDisplay.c"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_HSWDisplay.h",
    "chars": 11342,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_HSWDisplay.h"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_LatencyStatistics.cpp",
    "chars": 9651,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_LatencyStati"
  },
  {
    "path": "externals/ovr/Src/CAPI/CAPI_LatencyStatistics.h",
    "chars": 5860,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_LatencyStati"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GLE.cpp",
    "chars": 312662,
    "preview": "/************************************************************************************\n\nFilename    :   Render_GLE.cpp\nCo"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GLE.h",
    "chars": 126706,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GLE.h\nConten"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GLE_GL.h",
    "chars": 281123,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GLE_GL.h\nCon"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp",
    "chars": 35588,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GL_Distortio"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_DistortionRenderer.h",
    "chars": 4943,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GL_Distortio"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_DistortionShaders.h",
    "chars": 17595,
    "preview": "/************************************************************************************\n \n Filename    :   CAPI_GL_Shaders"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp",
    "chars": 18403,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GL_HSWDispla"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_HSWDisplay.h",
    "chars": 3141,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GL_HSWDispla"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_Util.cpp",
    "chars": 15060,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GL_Util.cpp\n"
  },
  {
    "path": "externals/ovr/Src/CAPI/GL/CAPI_GL_Util.h",
    "chars": 14126,
    "preview": "/************************************************************************************\n\nFilename    :   CAPI_GL_Util.h\nCo"
  },
  {
    "path": "externals/ovr/Src/CAPI/Textures/healthAndSafety.tga.h",
    "chars": 551117,
    "preview": "const uint8_t healthAndSafety_tga[107525] = {\n   0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0"
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_Display.cpp",
    "chars": 1207,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_Display.h",
    "chars": 7506,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_OSX_Display.cpp",
    "chars": 11316,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_OSX_Display.c"
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_OSX_Display.h",
    "chars": 4028,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_OSX_Display.h"
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_OSX_FocusObserver.h",
    "chars": 2059,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_OSX_FocusObse"
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_OSX_FocusObserver.mm",
    "chars": 7043,
    "preview": "/************************************************************************************\r\n\r\nFilename    :   OVR_OSX_FocusOb"
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_OSX_FocusReader.h",
    "chars": 1395,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_OSX_FocusRead"
  },
  {
    "path": "externals/ovr/Src/Displays/OVR_OSX_FocusReader.mm",
    "chars": 2933,
    "preview": "/************************************************************************************\r\n\r\nFilename    :   OVR_OSX_FocusRe"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Alg.cpp",
    "chars": 2428,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Alg.cpp\nConte"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Alg.h",
    "chars": 32425,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Allocator.cpp",
    "chars": 3922,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Allocator.cpp"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Allocator.h",
    "chars": 12264,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Array.h",
    "chars": 28117,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Atomic.cpp",
    "chars": 4010,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Atomic.cpp\nCo"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Atomic.h",
    "chars": 34818,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_CRC32.cpp",
    "chars": 4648,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_CRC32.cpp\nCon"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_CRC32.h",
    "chars": 1488,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Color.h",
    "chars": 2057,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Compiler.h",
    "chars": 65130,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR.h\nFilename   "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_ContainerAllocator.h",
    "chars": 7424,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_DebugHelp.cpp",
    "chars": 166377,
    "preview": "/************************************************************************************\n\nFilename    :   ExceptionHandler."
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_DebugHelp.h",
    "chars": 22944,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_DebugHelp.h\nC"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Delegates.h",
    "chars": 12962,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Delegates.h\nC"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Deque.h",
    "chars": 9291,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Deque.h\nConte"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_File.cpp",
    "chars": 15232,
    "preview": "/**************************************************************************\n\nFilename    :   OVR_File.cpp\nContent     : "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_File.h",
    "chars": 21541,
    "preview": "/************************************************************************************\n\nPublicHeader:   Kernel\nFilename  "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_FileFILE.cpp",
    "chars": 14557,
    "preview": "/**************************************************************************\n\nFilename    :   OVR_FileFILE.cpp\nContent   "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Hash.h",
    "chars": 41860,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_KeyCodes.h",
    "chars": 6392,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_List.h",
    "chars": 9994,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Lockless.cpp",
    "chars": 5761,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Lockless.cpp\n"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Lockless.h",
    "chars": 3629,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Log.cpp",
    "chars": 13915,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Log.cpp\nConte"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Log.h",
    "chars": 8960,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Math.cpp",
    "chars": 2272,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Math.h\nConten"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Math.h",
    "chars": 90072,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Nullptr.h",
    "chars": 4766,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Observer.h",
    "chars": 9923,
    "preview": "/************************************************************************************\n\nPublicHeader:   Kernel\nFilename  "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_RefCount.cpp",
    "chars": 2868,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_RefCount.cpp\n"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_RefCount.h",
    "chars": 15221,
    "preview": "/************************************************************************************\n\nPublicHeader:   Kernel\nFilename  "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_SharedMemory.cpp",
    "chars": 19782,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_SharedMemory."
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_SharedMemory.h",
    "chars": 7020,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Std.cpp",
    "chars": 75530,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Std.cpp\nConte"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Std.h",
    "chars": 18571,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_String.cpp",
    "chars": 20862,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_String.cpp\nCo"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_String.h",
    "chars": 21412,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_StringHash.h",
    "chars": 3247,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_String_FormatUtil.cpp",
    "chars": 2451,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_String_Format"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_String_PathUtil.cpp",
    "chars": 5866,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_String_PathUt"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_SysFile.cpp",
    "chars": 4231,
    "preview": "/**************************************************************************\n\nFilename    :   OVR_SysFile.cpp\nContent    "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_SysFile.h",
    "chars": 3595,
    "preview": "/************************************************************************************\n\nPublicHeader:   Kernel\nFilename  "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_System.cpp",
    "chars": 4402,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_System.cpp\nCo"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_System.h",
    "chars": 5721,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_ThreadCommandQueue.cpp",
    "chars": 10665,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_ThreadCommandQueue.h",
    "chars": 12095,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Threads.h",
    "chars": 14956,
    "preview": "/************************************************************************************\n\nPublicHeader:   None\nFilename    "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_ThreadsPthread.cpp",
    "chars": 23443,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_ThreadsPthrea"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Timer.cpp",
    "chars": 15737,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_Timer.cpp\nCon"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Timer.h",
    "chars": 3333,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_Types.h",
    "chars": 31473,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_UTF8Util.cpp",
    "chars": 15425,
    "preview": "/**************************************************************************\n\nFilename    :   OVR_UTF8Util.cpp\nContent   "
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_UTF8Util.h",
    "chars": 3999,
    "preview": "/************************************************************************************\n\nPublicHeader:   OVR_Kernel.h\nFile"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_mach_exc_OSX.c",
    "chars": 156462,
    "preview": "/* This file was generated by the MIG utility with:\n       mig /usr/include/mach/mach_exc.defs\n   We pre-generate them i"
  },
  {
    "path": "externals/ovr/Src/Kernel/OVR_mach_exc_OSX.h",
    "chars": 6976,
    "preview": "#ifndef\t_mach_exc_user_\n#define\t_mach_exc_user_\n\n/* Module mach_exc */\n\n#include <string.h>\n#include <mach/ndr.h>\n#inclu"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_BitStream.cpp",
    "chars": 31870,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_BitStream.cpp"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_BitStream.h",
    "chars": 70705,
    "preview": "/************************************************************************************\n\nPublicHeader:   n/a\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_MessageIDTypes.h",
    "chars": 1350,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_MessageIDType"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_NetworkPlugin.cpp",
    "chars": 1892,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_NetworkPlugin"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_NetworkPlugin.h",
    "chars": 1912,
    "preview": "/************************************************************************************\n\nPublicHeader:   n/a\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_NetworkTypes.h",
    "chars": 1336,
    "preview": "/************************************************************************************\n\nPublicHeader:   n/a\nFilename    :"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_PacketizedTCPSocket.cpp",
    "chars": 5219,
    "preview": "/************************************************************************************\n\nFilename    :   OVR_PacketizedTCP"
  },
  {
    "path": "externals/ovr/Src/Net/OVR_PacketizedTCPSocket.h",
    "chars": 2623,
    "preview": "/************************************************************************************\n\nPublicHeader:   n/a\nFilename    :"
  }
]

// ... and 280 more files (download for full content)

About this extraction

This page contains the full source code of the fdb/frequensea GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 480 files (61.9 MB), approximately 2.8M tokens, and a symbol index with 3835 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!